Question: Develop the element type that will represent each board position.Develop the element type that will represent each board position. In addition to representing the state

Develop the element type that will represent each board position.Develop the element type that will represent each board position. In addition to
representing the state of the TicTacToe board, you will also need an integer to store
the evaluation of the position in Step 2.3 below. I recommend something as simple
as the TicTacToePosition shown here. I chose to represent the board as a
String of nine characters, each position either a blank, an 'x' or an 'O'.
The root of your tree will be the blank board. There are 9 children from
here. That is, the human player can select to place their x in any position 0
through 8. Create these children. From there, each of these positions has
at most 8 counter moves for 0. This continues down until there are no
moves left. We will ignore symmetries.
There are at most 9!+dots1!(986,409) board configurations. Our tree will
need to be order 9 and this will result in many empty positions. You should
start your tree out with the capacity set at a staggering 500,000,000 places! This may require more heap memory
than your Java installation is used to. Therefore, you may need to use the option: -xm2048M to increase your
memory usage. Instructions on using this option are dependent on the IDE you use.
To perform this step, you may want to study and adapt the pre-order traversal algorithm. Remember not to
generate moves for positions that are already occupied.
If this is as far as you get, you will want to prove that your solution works. Print out the first 100 positions in the
array. Perhaps you could use code like the following (adapted to any data types/classes you have used). Put this
code in the main method of a class called GenTree.java.
for (int i=0; i100; i++){
TicTacToePosition t= gameTree * get(i);
if (t= null)
System.out.printf("%2d)%s
", i, gameTree.get(i).board);
else
System.out.printf("%2d) Empty
", i);
}
 Develop the element type that will represent each board position.Develop the

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!