Question: Java :) Choose is a two-player game played on a square grid of random positive numbers. One number is randomly removed; it's place is taken

 Java :) Choose is a two-player game played on a square

Java :)

Choose is a two-player game played on a square grid of random positive numbers. One number is randomly removed; it's place is taken by the selection. Players alternate choosing a new selection. The first player must choose a number from the same row as the current selection, while the second play must choose from the same column. Each time a selection is made the number is removed and added to the player's total. The game ends when no more selections can be made. The winner is the player with the highest total. The following data represents the initial configuration of a 7x7 game of Choose. The board is 7 by 7 as indicated by the first integer. The u indicates it is the horizontal (first) player's turn; v would indicate the vertical (second) player's turn. The score is "O to 0" as indicated by the last two integers. Finally the board is given with the selection indicated by @. 7 HOO 1 2 3 7 6 5 2 2 7 6 5 9 5 6 76 @ 65 6 4 3 4 8 1 2 1 1 3 4 2 2 8 7 9 5 1 2 9 8 7 6 6 7 5 1 9 7 1 The following data represents the state of the same game after the first player selected the 7 in the first column. Note that - indicates a number which has been removed from play. 7 V 70 1 2 3 7 2 7 6 5 @ 6 - 6 3 4 8 1 3 4 2 2 5 1 2 9 6 7 5 1 6 9 5 2 8 8 9 5 5 6 1 7 7 7 2 6 4 1 9 6 1 The following data represents the state of the same game after the second player selected the 6 in the bottom row. 7 H 7 6 1 2 3 7 6 5 2 2 7 6 5 9 5 6 - 6 - 6 5 6 4 3 4 8 1 2 11 3 4 2 2 8 7 9 5 1 2 9 8 7 6 @ 7 5 1 9 7 1 Write a program to read a Choose game state as described above, make the best move, and print the new game state. For this program assume the best move is the largest number available to the player. If there is a tie, choose the top-most or left- most one. Hint: Its okay to print an extra space at the end of each grid line

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!