Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 7. (35 points) The Game of Nim In this part of the assignment, we will start developing a Java Object-Oriented program for the Game
Problem 7. (35 points) The Game of Nim In this part of the assignment, we will start developing a Java Object-Oriented program for the Game of Nim. We have already seen a simple, text-version of this game at the very first session. Following is a description of the game: There is a pile of some marbles and two players. The number of marbles in the pile can be between 10 and 100. The two players alternatively take marbles from one pile. In each move, a player must take at least one and at most half of the marbles. Then, the other player takes a turn. The player who takes the last marble loses the game. We consider two modes in this game. In the first mode, the computer plays against a human player. The computer can be Novice (Stupid), and in its tum just takes a random number of marbles, or it can be Smart and in its turn uses a smart strategy to take the best number of marbles trying to win the game at the end. Note that in any case, computer will follow the game rules. In the second mode two human players can play against each other. Using the above description, your first ask is to figure out and extract all the classes required for this game. Then, for each class, find the list of its properties and methods. For each property of a class, its data type and possible values must be specified. Also, for each method its return type, if any, and parameters along with their types should be determined. After extracting all the above information, create the initial version of each class. In this phase you don't need to write the body of the methods. Instead, inside each method, using a comment clearly explain its task, including the information it receives from the caller, its task, and the possible value it returns to the caller. Note that in the version, we don't create a class to run the game, and we only design the essential parts of the game as one or more Java classes
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