Write up Java source codes for compiling and execution of program below.
Draw UML diagram for codes.
There is a very simple solution to keeping Tic-tac-toe fresh and interesting, though, and it has been thought up by a group of mathematicians. It’s being called Ultimate Tic-tac-toe and simply embeds a Tic-tac-toe board in each of the nine squares of the original game.
Now instead of just winning the main board, you also need to win each of the smaller boards first until you have a line of three.
New Rule: You can only place a mark on the board determined by the position of your opponent’s last placed mark. So, if they put an X or O in the top right corner of a square, your next move must occur in the top right board.
By adding that rule the game is no longer about winning a single board, it’s about tactically managing up to 9 games at once and plotting ahead. You still win by marking three squares in a row, but that now involves winning three games.
The effects of the New Rule:
1: Your opponent can force you to choose an open square in an already won/tie board.
1- Player X Move:
- Board# : 0
- Square#: 1
2- Player O Move: Only valid Board is Board #1
- Square#: 5
3- Player X Move: Only valid Board is Board #5
- Square#: 6
4- Player O Move: Only valid Board is Board #6
- Square#: 4
For example, after a while Board # 0 has a winner, Player O. It is the Player X turn and the only valid Board# for Player X is Board#0
Player X Move: Only valid Board is Board #0
- Square#: 6
2: If the board is already full, you get a free pass to place your mark in any board
For example, after a while Board # 0 is completely full. It is the Player X turn and the only valid Board# for Player X is Board#0. Since Board#0 is full, then the Player X gets to pick any other Board.
Player X Move:
- Board# : 8
- Square#: 8
The great thing about this rule change and board layout is it remains easy to understand.
Basic Rules:
1. Each turn, you mark one of the small squares.
2. When you get three in a row on a small board, you’ve won that board.
3. To win the game, you need to win three small boards in a row.
4. You don’t get to pick which of the nine boards to play on. That’s determined by your opponent’s previous move. Whichever square he picks, that’s the board you must play in next. (And whichever square you pick will determine which board he plays on next.)
- Clarifying rules:
1. What if my opponent sends me to a board that’s already been won/tie but not full? In that case, you get to play on that board, but your move doesn’t affect the outcome of that board.
2. What if my opponent sends me to a board that’s already been full? In that case, congratulations – you get to go anywhere you like, on any of the other boards.
Write up Java source codes for compiling and execution of program.
Draw UML diagram for codes.
Extracted text: 3 5 X0x 6 Board #0 Board #1 Board #2 2 1 1 2 4 5 4 3 4 5 6 Board #3 Board #4 Board #5 1 2 1 2 1 2 5 3 4 5 3 5 6 Board #6 Board #7 Board #8 6.
Extracted text: 2 3 Q Board #0 X Board #1 Board #2 2 1 1 3 Board #3 Board #4 Board #5 3 3 5 Board #6 Board #7 Board #8 un un un un