1|2|3 ----- 4|5|6 ----- 7|8|9 Player 1 please make your move>1 o|2|3 ----- 4|5|6
ID: 3609101 • Letter: 1
Question
1|2|3
-----
4|5|6
-----
7|8|9
Player 1 please make your move>1
o|2|3
-----
4|5|6
-----
7|8|9
Player 2 please make your move>5
o|2|3
-----
4|x|6
-----
7|8|9
Player 1 please make your move>9
o|2|3
-----
4|x|6
-----
7|8|o
Player 2 please make your move>3
o|2|x
-----
4|x|6
-----
7|8|o
Player 1 please make your move>7
o|2|x
-----
4|x|6
-----
o|8|o
Player 2 please make your move>8
o|2|x
-----
4|x|6
-----
o|x|o
Player 1 please make your move>4
o|2|x
-----
o|x|6
-----
o|x|o
Congratulations!!! Player 1 won
Explanation / Answer
better? please rate - thanks import java.util.*; public class tictactoe2 { static int OPEN = 9; static int[] gameboard=new int[9]; static int done; public static void main(String[] args) { System.out.println("This is the game of Tic Tac Toe."); System.out.println("A 9 in a spot means that spot isavailable 2 2"); done = -1; init_matrix(); do { disp_matrix(); get_player_move(); done = check(); if(done!= -1) break; get_computer_move(); done = check(); } while(done== -1); if(done==1) System.out.println("You won!"); else if(done==2) System.out.println("I won!!!!"); else System.out.println("we tied!!!!"); disp_matrix(); /* show final positions */ } public static void init_matrix() {int i; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.