Question
Can anyone please help me with this Tic Tac Toe program? Thanks! // Prompt the user for row & column index. Continue asking // until
Can anyone please help me with this Tic Tac Toe program? Thanks!// Prompt the user for row & column index. Continue asking
// until an empty cell is selected. set the cell to 'O'
public static void playerPlays( char [][] board){
}
// Check by row, column, and diagonals public static boolean checkWin( char [][] board, char ch) { }
// check for tie. If there no empty cells, then it is a tie
public static boolean checkTie( char [][] board){ }
// Display the board
public static void displayBoard( char [][] board) { }
// Continue generating random values for row and col until an // empty cell selected. Set the cell to 'X'
public static void computerPlay( char [][]board) {
}
Sample run:
_______ | | || ------- |X| | | ------- | | || ------- Enter row and col: 00
_______ |O| | | ------- |X| | | ------- | | || ------- _______ |O|X| | ------- |X| | | ------- | | || ------- Enter row and col: 10
Enter row and col:11
_______
|O|X| |
-------
|X|O| |
-------
| | ||
-------
_______
|O|X| |
-------
|X|O|X|
------- | | || ------- Enter row and col: 22
_______ |O|X| | ------- |X|O|X| ------- | | |O| ------- Player WinsUsing two dimensional arrays, create a program to play game of Tic Tac Toe. Your program enables you to play against the computer Use the following skeleton import java.util.*; public class TicTacToe static scanner in = new Scanner (System.in); public static void main (String[] args) Scanner in = new Scanner (System.in); char[] [] board = new char [3] [3]; for (int i=0;i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started