Thanks for the comment @devkumi
! If the human player takes the first turn (and therefore can't win, no matter what), then that's all you need to do!
This version forces the computer to play first, which means the computer needs to know whether the human player has made a mistake or not. If the human player makes a mistake, then the remainder, r = (count - 1) mod 4 is used to compute the right move for the computer. I think in your case it would be 4 - (count mod 4) because you're going up from 0 to 21.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the comment @devkumi ! If the human player takes the first turn (and therefore can't win, no matter what), then that's all you need to do!
This version forces the computer to play first, which means the computer needs to know whether the human player has made a mistake or not. If the human player makes a mistake, then the remainder,
r = (count - 1) mod 4
is used to compute the right move for the computer. I think in your case it would be4 - (count mod 4)
because you're going up from 0 to 21.