} else {:: cin gt; gt; player2.symbol; .symbol=toupper (player2.symbol);=player2.symbol;
}
} else if (game_type == computer vs computer ) {:: string player_name; sel=rand ()% 2; (sel == 0) {()% 2 == 0 ? player1.symbol= X :Player1.symbol= O raquo ;; _ name=player1.name; .selected=1;=player1.symbol;
} if (sel == 1) {()% 2 == 0? player2.symbol= X :Player2.symbol= O raquo ;; _ name=player2.name; .selected=1;=player2.symbol;
} :: cout lt; lt; player_name lt; lt; budet igrat ' lt; lt; cSymbol lt; lt; ' lt; lt; std :: endl;
} (! std :: cin.good () || wrong_symbol ()) {:: cout lt; lt; tol ko X ili O! lt; lt; std :: endl; ( pause ); _ player_symbol ();
} (! player2.selected) {.symbol == X ? player2.symbol= O :Player2.symbol= X raquo ;;. Symbol == O ? player2.symbol= X :Player2.symbol= O raquo ;;
} else if (! player1.selected) {.symbol == X ? player1.symbol= O :Player1.symbol= X raquo ;;. Symbol == O ? player1.symbol= X :Player1.symbol= O raquo ;;
}=PLAYING;
} get_move () {:: cin.sync (); (game_type == human vs human ) {(player1.selected) {:: cout lt; lt; player1.name lt; lt; vvedite vash hod (1 - 9): raquo ;; :: cin gt; gt; player1.move;=player1.move;=player1.symbol; .selected=0; .selected=1; _player=player1;
} else if (player2.selected) {:: cout lt; lt; player2.name lt; lt; vvedite vash hod (1 - 9): raquo ;; :: cin gt; gt; player2.move;=player2.move;=player2.symbol; .selected=1; .selected=0; _player=player2;
}
} else if (game_type == human vs computer ) {(player1.selected) {:: cout lt; lt; n lt; lt; player1.name lt; lt; vvedite vash hod (1 - 9): raquo ;; :: cin gt; gt; player1.move; (! std :: cin.good ()) {:: cin.clear (); :: cin.sync ();
}=player1.move;=player1.symbol; _player=player1; .selected=0; .selected=1; (1000);
} else if (player2.selected) {.move=MiniMax (board, player2);=player2.move;=player2.symbol; _player=player2; .selected=1; .selected=0 ; _state (); (1500);
}
} else if (game_type == computer vs computer ) {(player1.selected) {.move=MiniMax (board, player1);=player1.move;=player1.symbol; _player =player1; .selected=0; .selected=1; _state (); (2500);
} else if (player2.selected) {.move=MiniMax (board, player2);=player2.move;=player2.symbol; _player=player2; .selected=1; .selected=0 ; _state (); (2500);
}
} _ move (); (game_over ()) {;
}
} set_game_statistic () {(state == START) {.game_win=0; .draw_num=0; .win=0; .game_win=0; .draw_num=0; .win=0;
} else if (state == XWIN || state == OWIN) {(player1.win) {.game_win ++ ;. win=0;
} else if (player2.win) {.game_win ++ ;. win=0;
}
} else if (state == DRAW) {.draw_num ++ ;. draw_num ++;
}
} reset_game_statistic () {.game_win=0; .draw_num=0; .win=0; .game_win=0; .draw_num=0; .win=0; .selected=0; .selected =0;
} display_game_statistic () {(state!=START) {:: cout lt; lt; ngame statistic lt; lt; std :: endl; :: cout lt; lt; ============== lt; lt; std :: endl; :: cout lt; lt; player1.name lt; lt; has won lt; lt; player1.game_win lt; lt; game (s). lt; lt; std :: endl; :: cout lt; lt; player2.name lt; lt; has won lt; lt; player2.game_win lt; lt; game (s). lt; lt; std :: endl; :: cout lt; lt; player1.draw_num lt; lt; game (s) ended with a draw. lt; lt; std :: endl;
}
} find_winner () {(state == XWIN amp; amp; player1.symbol == X ) {.win=1;
} else if (state == OWIN amp; amp; player1.symbol == O ) {.win=1;
} else if (state == XWIN amp; amp; player2.symbol == X ) {.win=1;
} else if (state == OWIN amp; amp; player2.symbol == O ) {.win=1;
}
} reset_winner () {.win=0; .win=0;
} wrong_symbol () {(cSymbol!= X amp; amp; cSymbol!= O );
} wrong_selection () {! (nMove gt; 0 amp; amp; nMove lt; 10);
} initialise_player_move () {.move=- 1; .move=- 1;
} game_over () {(state == XWIN || state == OWIN || state == DRAW);
} reset_state () {= PLAYING;
...