First design an interface interactivegame that generalizes


Assignment

Statement

First, design an interface InteractiveGame that generalizes the playing of any two-person game between a human player and the computer. Design two actual games, Nim and another game of your choice, except TicTacToe, that implement your InteractiveGame interface.

Requirements

1. Write an implementation of this Nim version to implement your InteractiveGame interface. Nim should have the following 4 instance variables only:

private int pileSize; //The number of marbles currently in the pile

private boolean playSmart; //true iff the computer plays smart

private boolean playersTurn; //true iff it is the player's turn to move

private String gameRecord //Complete history of the game's progression

• The Nim constructor should generate a random number (10 ... 100) for the initial pile size.

• Instance variable, gameRecord, must be updated on every move to provide a clear complete record of the progress of the game.

• Implement the textbook strategy for playing smart.

2. Write another 2-person game to implement your InteractiveGame interface.

4. In both Nim and your game, the prompt for a player's move must include a clear representation of the current state of the game; the prompt must show sufficient information to allow the player to decide on their next move. The player prompts must be implemented using JOptionPane methods. Assume that the human player is unfamiliar with the game being played.

Solution Preview :

Prepared by a verified Expert
Programming Languages: First design an interface interactivegame that generalizes
Reference No:- TGS01720353

Now Priced at $40 (50% Discount)

Recommended (91%)

Rated (4.3/5)