Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public int [ ] [ ] minimax ( ( char player ) { ) { int [ ] [ ] bestMove = = new int

public int[][] minimax((char player){){
int[][] bestMove == new int[]{−1,−1}[]{-1,-1};
int bestScore == Integer.MIN__VALUE; //// Or Zero.no problem.
for ((int i =0=0; i << emptyCells().().size()(); i++){++){
Cell cell == emptyCells().().get((i));
System.out.println((cell..toString())());
cell.value == player;
int score == findMinOrMaxScore((false));
cell.value =''" id="MathJax-Element-27-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">=''='';
if ((((player =='" id="MathJax-Element-29-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">=='=='O'" id="MathJax-Element-30-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'' && score >> bestScore)||()||(player =='" id="MathJax-Element-33-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">=='=='X'" id="MathJax-Element-34-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'' && score << bestScore)){)){
bestScore == score;
bestMove[0]=[0]= cell.row;
bestMove[1]=[1]= cell.column;
}}
}}
//// for ((int i =0=0; i <3<3; i++){++){
//// for ((int j =0=0; j <3<3; j++){++){
//// if ((AllCells[[i][][j].].value ==''){" id="MathJax-Element-57-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">==''){==''){
//// AllCells[[i][][j].].value == player;
//// int score == findMinOrMaxScore((false));
//// AllCells[[i][][j].].value =''" id="MathJax-Element-71-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">=''='';
////
//// if ((((player =='" id="MathJax-Element-75-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">=='=='O'" id="MathJax-Element-76-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'' && score >> bestScore)||()||(player =='" id="MathJax-Element-79-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">=='=='X'" id="MathJax-Element-80-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'' && score << bestScore)){)){
//// bestScore == score;
//// bestMove[0]=[0]= i;
//// bestMove[1]=[1]= j;
//}//}
//}//}
//}//}
//}//} What is the difference between two code. Modify and run the first code

Step by Step Solution

3.25 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

The difference between the two code snippets lies in the way they handle the game board and the cell... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

Students also viewed these Programming questions

Question

What are the attributes of a technical decision?

Answered: 1 week ago

Question

How do the two components of this theory work together?

Answered: 1 week ago

Question

Explain what a just-in-time (JIT) compiler of Java does.

Answered: 1 week ago