Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+6 votes

I got stuck at how to set up the correct expession for While loop so that the player needs to keep clicking until they click in an empty square.

asked in CSC201 Spring 2021 by (8 points)

1 Answer

+3 votes

you want them to keep clicking untill they click a blank square, which is represented by ' ' in the matrix. so the loop should run while ' ' != gameBoard[ ][ ] , with the correct [ ] from the function call.

answered by (8 points)

got it! thanks a lot.


Side note: you could also do

while <choice> == 'X' or <choice> == 'O':

However, != ' ' is simpler.