Chomp - A class for text-based play of the game of
Chomp as specified through the given game transcript. Use
ChompGame
for modeling the game state itself. All input/output should take place in the main method of this class.
First, print instructions with the following lines: {"CHOMP", "In the game of Chomp, players bite a rectangular cookie in turn.", "The player chomping the last bite (0,0) loses.", "Each chomp, a row and column, bites off all below and to the right."}.
Then prompt the user for the number of rows and columns with prompts "Rows? " and "Columns? ". Read these in as integers presumed to be in the range 1-10.
Create a
ChompGame
object using this information.
Then, while the game is not over, do the following:
Print the game board produced by the object toString() and preceded and followed with blank lines.
Prompt the user for a row and column for chomping with "Player # chomp? ", where "#" is the games current player number.
Attempt the chomp move, making the move and changing the player if the chomp move is legal, and just printing the message "That is not a legal chomp position." otherwise.
After the game is over, print a blank line and the message "Player # wins!", where "#" is the winning player.
No input/output should take place in class
Chomp
. Whenever possible, use the computation of the Chomp class to perform the modeling (i.e. play, logic) of the game.