Question
Prepare a project in Java to implement the Game of Matches. a) The game must start with 3 rows of matches: - row 1: 3
Prepare a project in Java to implement the Game of Matches.
a) The game must start with 3 rows of matches:
- row 1: 3 matches;
- row 2: 5 matches; and
- row 3: 7 matches.
b) On each move, a player can remove any number of matches of a single row. For example, Player1 could remove 1 to 7 matches from the third row.
c) It is not allowed to remove matches from more than one row in a single move.
d) The player that gets the last match loses.
e) Example:
- Start of the game.
row1: I I I
row2: I I I I I
row3: I I I I I I I
- Player1 removes 3 matches from row 2.
row1: I I I
row2: I I
row3: I I I I I I I
- Player2 removes 5 matches from row 3.
row1: I I I
row2: I I
row3: I I
- Player1 removes 3 matches from row 1.
row1:
row2: I I
row3: I I
- Player2 removes 1 match from row 2.
row1:
row2: I
row3: I I
- Player1 removes 2 matches from row 3.
row1:
row2: I
row3:
- Player2 gets the last match.
- Player1 wins.
f) The user must be able to select the game mode:
- Player1 versus Player2; or
- Player1 versus Computer.
g) The user must be able to select the player that is going to start the game.
h) Show the rows after each move.
i) Show the winner at the end of each game.
j) Use Camel Notation and in-program comments.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started