Need help with programming assignment. Cant seem to get it to work properly. USI
ID: 3884887 • Letter: N
Question
Need help with programming assignment. Cant seem to get it to work properly. USING ONLY GIVEN CLASSES and without adding or removing methods.
The NumberTile Game
Number tiles are squares with a number from 1 to 9 at each side. A “board” for the game is a sequence of number tiles satisfying this property:
The right side of each tile (except the last) = the left side of the next tile on the board
There are 2 players in the game, both of which are the computer. Each player starts with a "hand" of 5 number tiles. A move is made by a player removing tile from the hand and placing it on the board, if possible. A tile may be placed on the board in any of 3 ways:
As the new first tile
Between two adjacent tiles
As the new last tile
A number tile in the players hand can be rotated 90 degrees but once placed on the board its position is fixed
If none of the tiles in the hand can be placed on the board, then one random tile is added to the player's hand
A round is when player1 makes a move and then player2 makes a move (to make the game fair)
The game ends when all tiles are removed from one (or both) player's hand(s). If one player's hand is empty and the other player's hand still contains tiles, then the player with the empty hand is the winner. If both players’ hands are empty, then the game ends in a tie
III. Specifications
Your program will consist of 5 classes
The NumberTile class – models a number tile
The Hand class – models a player’s hand of number tiles
The Board class – models the board where tiles are inserted from the hands
The TileGame class – conducts the game
Test class with main method
Use the skeletons of the NumberTile, Hand, Board, and TileGame classes, available online. Do not add or remove any methods, and do not modify any of the method declarations. Simply code the bodies of the method “stubs” where necessary
Your main method will do this and only this: Create a TileGame object, call the play() method, and then print the results returned by the toString() method. After each game, ask whether the user wants to see another
To get credit, you must use the declared ArrayList in each class as your principal data structure
These are the classes:
NumberTile.java
Hand.java
Board.java
TileGame.java
Explanation / Answer
Hand.java
Board.java
TileGame.java
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.