Did you implement these functions yourself? They seem to be all mixed up. For example, plotTicTacToe is asking for inputs, getMove is checking for winners, and getWinner is doing the winner displaying unnecessarily.
Here is some advice:
- plotTicTacToe: Should only display the board as it currently is in G, and should not change G (i.e. through getSymb)
- getMove: Get the next move. This depends on the second argument, i.e., whether it is the computer's turn (turn<0) or the player's. If the players, you will need to ask them where to play. If the computer's, this is where you would put the AI, from simple (using a randi to pick a valid spot) or complex (checking the board in order to go for wins or block wins). Either way, should output the row and column to place the play in.
- getWinner: Should check all rows/columns/diagonals for three in a row from the same player and declare that player the winner by what is output: -1 (com), 0 (none yet), 1 (player), 2 (tie).
- getSymb: Unnecessary.
Once you get these functions straightened out, let us know if you are still running into problems.