int, where each array index represents a pile of matches and the number stored at each index represents the number of matchsticks in that pile.int piles[]: an array that represent the piles of matchsticksint player: represents the current player (the player about to make a move). Valid values for player can be either 0 or 1.public Nim(int numPiles, int minMatches, int maxMatches):
numPiles parameter represents the number of piles of matches in the
game. A valid game must have at least one pile of matches.minMatches parameter represents the minimum number of matches that
can be in a pile at the start of a new Nim game (inclusive)maxMatches parameter represents the maximum number of matches that
can be in a pile at the start of a new Nim game (inclusive)public Nim(int numPiles): constructs a Nim game with numPiles piles of
matches, and between 1 and five matches in each pile.
numPiles parameter represents the number of piles of matches in the
game. A valid game must have at least one pile of matches.public Nim(): constructs a Nim game with 3 piles of matches, and between 1
and 5 matches in each pile.
protected void populateEmptyBoard(int minMatches, int maxMatches)
minMatches parameter represents the minimum number of matches that
can populate any given pilemaxMatches parameter represents the maximum number of matches that
can populate any given pilepublic boolean isValidMove(int whichPile, int numMatches):
whichPile specifies which pile to remove matches from (0-indexed)numMatches specifies how many matches to movepublic void makeMove(int whichPile, int numMatches):
whichPile The pile to remove matches fromnumMatches How many matches to removepublic boolean isGameOver():
public String toString():