Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a method static int evaluateMove9(char [] squares, lot squareNumber) {

ID: 3844956 • Letter: I

Question

Implement a method static int evaluateMove9(char [] squares, lot squareNumber) { } that does the following: puts an 'x' in the given squareNumber calls boardValue(squares) and saves the result in int temp. replaces the 'x' by a dash '-' returns temp. For reference here is the code for boardValue () and its helper method lineValue. (You don't need to code these: they're already available.) static int lineValue(char [] squares, int s1, int s2, int s3) { if (squares [s1] = = 'X' && squares [s2] = = 'X' && squares [s3] = = 'X') return 1;//win for X if (squares [s1] = = 'O' && squares [s2] = = 'O' && squares [s3] = = 'O') return -1;//win for O return 0;//nobody has won yet } static int boardValue (char [] squares) { int [] [] wins = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {1, 4, 7}, {2, 5, 8}, {3, 6, 9}, {1, 5, 9}, {3, 5, 7}}: for (int i = 0: i

Explanation / Answer

static int evaluateMove9(char[] squares, int squareNumber){
   squares[squareNumber]='X';
   int temp = boardValue(squares);
   squares[squareNumber]='-';
   return temp;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote