Advertisement
Guest User

Untitled

a guest
May 25th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // This is in class NimGame. Also, NimAIPlayer and NimHumanPlayer extends NimPlayer
  2.  
  3. public NimPlayer playerOne;// = new NimPlayer();
  4. public NimPlayer playerTwo;// = new NimPlayer();
  5.  
  6. // Constructor to initialise the users who will play the current game
  7. public NimGame(NimPlayer player1, boolean isOneAI, NimPlayer player2, boolean isTwoAI) {
  8. if (isOneAI) {
  9. playerOne = new NimAIPlayer();
  10. }
  11. else {
  12. playerOne = new NimHumanPlayer();
  13. }
  14. if (isTwoAI) {
  15. playerTwo = new NimAIPlayer();
  16. }
  17. else {
  18. playerTwo = new NimHumanPlayer();
  19. }
  20. this.playerOne = player1;
  21. this.playerTwo = player2;
  22. }
  23.  
  24.  
  25. // Error is from here, cant find N and M, which are only in NimAIPlayer:
  26.  
  27. if (playerOne.isAI) {
  28. playerOne.N = stonesRemaining;
  29. playerOne.M = upperBound;
  30. }
  31. if (playerTwo.isAI) {
  32. playerTwo.N = stonesRemaining;
  33. playerTwo.M = upperBound;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement