Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. int main()
  3. {
  4. Node n1,n2,retValue;
  5. int choice = 0,turn = 0;
  6. cout << "Who wants to go first: " << endl << "1 for player " << "2 for AI"<< endl;
  7. cin >> choice;
  8. if (choice == 1)
  9. turn = 1;
  10. else if(choice == 2)
  11. turn = 2;
  12. while(turn)
  13. {
  14. cout << "Here" << endl;
  15. if(turn % 2 == 0)
  16. {
  17. n1.generateTree('o');
  18. n1.childrens[0].printBoard();
  19. retValue = minMaxAlgorithm(n1,-100,100,true,1);
  20. n1 = n1.childrens[globalIndex];
  21. if(n1.isLeaf)
  22. {
  23. cout << "GameOver" << endl;
  24. break;
  25. }
  26. }
  27. else
  28. {
  29. cin >> choice;
  30. Node player(choice,'x',n1.dataset);
  31. if(player.isLeaf)
  32. {
  33. cout << "GameOver" << endl;
  34. break;
  35. }
  36. n1 = player;
  37. }
  38. turn++;
  39. }
  40. // n1.dataset[0][1] = 'x';
  41. // n1.dataset[1][2] = 'x';
  42. // n1.dataset[2][1] = 'o';
  43. // n1.dataset[1][1] = 'o';
  44. // n1.dataset[2][2] = 'x';
  45. // n1.printBoard();
  46. // n1.generateTree('o');
  47. // n3 = minMaxAlgorithm(n1,-100,100,true,1);
  48.  
  49. // n3.printBoard();
  50. // cout << globalIndex << endl;
  51. // //Node n2(6,'o',n1.dataset);
  52. // //n2.printBoard();
  53.  
  54. // //n2.generateTree('o');
  55. // //cout << n2.isLeaf << endl;
  56. // //n3 = minMaxAlgorithm(n2,-100,100,true);
  57.  
  58. // //cout << "Hello" << endl;
  59. // //n3.printBoard();
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement