Question: with basic Java skills. Assignment Description: We are going to play a fun strategy game that only requires two players! In this game, we have
with basic Java skills.
Assignment Description: We are going to play a fun strategy game that only requires two
players! In this game, we have an board and a Knight chess piece that starts on the top left
of the board. Each player gets to move the Knight piece one square over either down, diagonal
bottom right direction or to the right of its current position a player cannot move the piece two
or more squares The Knight piece can keep moving until it reaches the bottom right corner of
the board. The respective player that moves the Knight to the bottom right corner of the board
wins the game! In this assignment you are going to implement the winning strategy for player
only.
For this assignment, you must follow these requirements.
You will create a public class called Game.
The Game Class will have the following attributes:
aD integer array that symbolizes the board to assist you with simulating the game.
bD primitive character array that stores the respective moves that will be used for
player Please store them in order of how they are presented here.
id for downward diagonal right direction index
ii for horizontal right direction index
iii. b for vertical bottom direction index
c A reference to a Random Class object. This will point to the object created by the
driver and passed to the constructor. This should be used when selecting a random
move for player in the selectPlayerTwoMove method.
The Game Class has a constructor that takes one parameter.
a A reference to a Random Class object that is instantiated in the driver class.
The Game class has a public nonstatic method called selectPlayerTwoMove. The
method will select a random move from the primitive character array attribute that
stores the respective move from b This method is intended to select player s move
only. This should not be used for player The method should return a primitive
character.
The Game class has a public nonstatic method called play. play will simulate a round
of the game where player must win against player The method has no parameters.
The method should return a value if the player wins the game, if not return or some
other value. NOTE: If a student just simply writes the statement that ONLY returns
the player's number without any simulation to the game will receive an automatic
score of on the assignment with NO partial credit from the other categories in the
rubric.
You are allowed to create helper methods as long as they are not called directly from the
driver file. The helper methods must be called from your solution file.
A driver file GameDriver java has been provided for you to show you how the methods are
called along with test cases to see if you get the same scenario result.
Hardcoding Output: For this assignment it is expected that you implement an actual solution
simulation to the game. If a student just places in their code to return the respective value without
any sort of simulation of the game, the student will automatically receive a score of with NO
partial credit on any categories in the established rubric.
About the Driver Class
The GameDriver Class will test your play method with different test cases. The first part of
the code will create different random objects with unique seeds Each object will be
associated with a test case. Please remember Dr Steinberg will change a few test cases when
grading your code. After the random objects are instantiated, the Game class objects are
instantiated with their respective random object reference. Last, all play methods with the
respective game object is invoke and will determine if player won.
Possible FAQs:
Here are some possible FAQs about the assignment.
Can either player stall each other by moving the knight piece backwards? Answer: No
this will cause an infinite loop scenario. The only moves players can make are down,
diagonal bottom right direction and right.
If the knight piece is on the last rowcolumn of the board and the respective player wants
to make an invalid move that would cause the knight piece to go out of bounds, does that
count as a move for the player? Answer: No invalid moves cannot be made in the game.
If the knight piece is on the last rowcolumn then that means each player only has one
valid option to make. You will have to include that scenario in your code.
What direction is the diagonal move? Answer: The direction is south east. This means
down and to the right.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
