Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

How does an information vision differ from an IT architecture?

Answered: 1 week ago

Question

How would we like to see ourselves?

Answered: 1 week ago