The code looks good and well-organized. Here are a few suggestions:
- Use const
const
wherever possible to make the code more readable and safe. For example, in checkWinner()checkWinner()
and isUserInputValid()isUserInputValid()
, the function parameters can be marked constconst
. - Use range-based for
for
loop wherever possible to make the code more readable and safe. For example, in isUserInputValid()isUserInputValid()
, the forfor
loop can be replaced with a range-based forfor
loop. - Use enum instead of std::vectorstd::string
std::vector<std::string>
for game options. This makes the code more readable and safer. - Use auto wherever possible to make the code more readable and safer. For example, in checkWinner()
checkWinner()
, the return type can be replaced with autoauto
. - Avoid using using namespace std
namespace std
as it is considered bad practice. - Add error handling to the code, for example, in case of invalid user input.