Elimination is a one-player game. The board consists of a set of 12 tiles, numbe
ID: 3535912 • Letter: E
Question
Elimination is a one-player game. The board consists of a set of 12 tiles, numbered 1 through 12. The player rolls a pair of dice and removes tiles based on the numbers shown on the dice. For each roll, the player can remove either the two tiles corresponding to the numbers shown on the dice or a single tile corresponding to the sum of the numbers on the dice. If the player rolls doubles (the same number on both dice), the player can remove only the tile corresponding to the sum of the dice. Play continues until the player cannot make a legal move or all the tiles have been removed. The sum of the remaining tiles is the player's score. The goal is to have a low score. Here is a sample game:
Explanation / Answer
Here is my board class, which should make the rest of your program really easy to write: http://pastebin.com/DF63GLXb
Use the removeTile() functions to attempt to remove either one or two tiles, which returns whether or not it was possible to do. If it's not, print a message to try again. If it worked, then roll the dice again and use toString to print out the board. Throw the whole thing in a while loop and there ya go. If you have any questions, let me know. Please remember to rate answers (though it looks like you are very good about that, thanks!). I'm not sure what you meant by "board clie" so I didn't attempt to answer that part.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.