Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. NimGame class // Main for the misre NIM game o public static void main(String]) / Program main 2. TheNim class // Class for the
1. NimGame class // Main for the misre NIM game o public static void main(String]) / Program main 2. TheNim class // Class for the game o private Pile pileA // First pile o private Pile pileB// Second pile private Pile pileC // Third pile o private Random nd // Random number generator o private Scanner input // Scanner for all user input o public Nim) // Default constructor, constructs the three piles o public boolean PlayerMovel) // All the rules to handle user input o private void com andomMove) // Computer move if done randomly, is computerMove) in non-bonus version o public void computerMove)// All the rules to handle computer move public boolean done) // Is the game done? o public void printPiles) / Print the current state of the piles 3. Piles class // Class to handle ONE pile o private int size // The current size of pile o public Pile) // Default constructor (Non-bonus version) o public Pile(int) // Initial constructor (Bonus version) o public int getSizel) // get current size of pile o public void remove(int) / remove the amount from pile 1. NimGame class // Main for the misre NIM game o public static void main(String]) / Program main 2. TheNim class // Class for the game o private Pile pileA // First pile o private Pile pileB// Second pile private Pile pileC // Third pile o private Random nd // Random number generator o private Scanner input // Scanner for all user input o public Nim) // Default constructor, constructs the three piles o public boolean PlayerMovel) // All the rules to handle user input o private void com andomMove) // Computer move if done randomly, is computerMove) in non-bonus version o public void computerMove)// All the rules to handle computer move public boolean done) // Is the game done? o public void printPiles) / Print the current state of the piles 3. Piles class // Class to handle ONE pile o private int size // The current size of pile o public Pile) // Default constructor (Non-bonus version) o public Pile(int) // Initial constructor (Bonus version) o public int getSizel) // get current size of pile o public void remove(int) / remove the amount from pile
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