Getting tic tac toe game to switch players
in
Programming Questions
•
3 years ago
Hello, I tried to wrap my head around the concept but have no idea how to execute it.
I've made a tic tac toe game.
I've made an array to have 2 players.
char[] player = new char[2];
player[0] = 'X';
player[1] = 'O';
My problem is trying to get these 2 players to alternate.
I was told to put "playerIndex = !playerIndex;" under mouseClicked function but obviously processing tells me "Cannot find anything named playerIndex" so what do I need to add or define in order to get my players to switch??
Thanks!
I've made a tic tac toe game.
I've made an array to have 2 players.
char[] player = new char[2];
player[0] = 'X';
player[1] = 'O';
My problem is trying to get these 2 players to alternate.
I was told to put "playerIndex = !playerIndex;" under mouseClicked function but obviously processing tells me "Cannot find anything named playerIndex" so what do I need to add or define in order to get my players to switch??
Thanks!
1