Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- Node n1,n2,retValue;
- int choice = 0,turn = 0;
- cout << "Who wants to go first: " << endl << "1 for player " << "2 for AI"<< endl;
- cin >> choice;
- if (choice == 1)
- turn = 1;
- else if(choice == 2)
- turn = 2;
- while(turn)
- {
- cout << "Here" << endl;
- if(turn % 2 == 0)
- {
- n1.generateTree('o');
- n1.childrens[0].printBoard();
- retValue = minMaxAlgorithm(n1,-100,100,true,1);
- n1 = n1.childrens[globalIndex];
- if(n1.isLeaf)
- {
- cout << "GameOver" << endl;
- break;
- }
- }
- else
- {
- cin >> choice;
- Node player(choice,'x',n1.dataset);
- if(player.isLeaf)
- {
- cout << "GameOver" << endl;
- break;
- }
- n1 = player;
- }
- turn++;
- }
- // n1.dataset[0][1] = 'x';
- // n1.dataset[1][2] = 'x';
- // n1.dataset[2][1] = 'o';
- // n1.dataset[1][1] = 'o';
- // n1.dataset[2][2] = 'x';
- // n1.printBoard();
- // n1.generateTree('o');
- // n3 = minMaxAlgorithm(n1,-100,100,true,1);
- // n3.printBoard();
- // cout << globalIndex << endl;
- // //Node n2(6,'o',n1.dataset);
- // //n2.printBoard();
- // //n2.generateTree('o');
- // //cout << n2.isLeaf << endl;
- // //n3 = minMaxAlgorithm(n2,-100,100,true);
- // //cout << "Hello" << endl;
- // //n3.printBoard();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement