Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is in class NimGame. Also, NimAIPlayer and NimHumanPlayer extends NimPlayer
- public NimPlayer playerOne;// = new NimPlayer();
- public NimPlayer playerTwo;// = new NimPlayer();
- // Constructor to initialise the users who will play the current game
- public NimGame(NimPlayer player1, boolean isOneAI, NimPlayer player2, boolean isTwoAI) {
- if (isOneAI) {
- playerOne = new NimAIPlayer();
- }
- else {
- playerOne = new NimHumanPlayer();
- }
- if (isTwoAI) {
- playerTwo = new NimAIPlayer();
- }
- else {
- playerTwo = new NimHumanPlayer();
- }
- this.playerOne = player1;
- this.playerTwo = player2;
- }
- // Error is from here, cant find N and M, which are only in NimAIPlayer:
- if (playerOne.isAI) {
- playerOne.N = stonesRemaining;
- playerOne.M = upperBound;
- }
- if (playerTwo.isAI) {
- playerTwo.N = stonesRemaining;
- playerTwo.M = upperBound;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement