} reset_board () {(int i=0; i lt; 9; ++ i) {[i]=0;
}
} update_board () {(state == PLAYING) {(player1.move!=- 1 amp; amp; player2.move == - 1) {[player1.move - 1]=player1.symbol;
} else if (player2.move!=- 1) {[player2.move - 1]=player2.symbol;
}
}
} display_result () {(player1.win) {:: cout lt; lt; player1.name lt; lt; pobedil! lt; lt; std :: endl;
} else if (player2.win) {:: cout lt; lt; player2.name lt; lt; pobedil! lt; lt; std :: endl;
} else if (player1.win == 0 amp; amp; player2.win == 0) {:: cout lt; lt; nichya! lt; lt; std :: endl;
} ( pause ); ( cls );
} update_game () {_board (); _ game_progress (); _ game_state (board);
} free_square () {(player1.move!=- 1 amp; amp; player2.move == - 1) {board [player1.move - 1] == 0;
} else if (player2.move!=- 1) {board [player2.move - 1] == 0;
} 0;
} display_board () {:: cout lt; lt; std :: endl; :: cout lt; lt; lt; lt; board [0] lt; lt; | Raquo; lt; lt; board [1] lt; lt; | Raquo; lt; lt; board [2] lt; lt; std :: endl; :: cout lt; lt; ----------- lt; lt; std :: endl; :: cout lt; lt; lt; lt; board [3] lt; lt; | Raquo; lt; lt; board [4] lt; lt; | Raquo; lt; lt; board [5] lt; lt; std :: endl; :: cout lt; lt; ----------- lt; lt; std :: endl; :: cout lt; lt; lt; lt; board [6] lt; lt; | Raquo; lt; lt; board [7] lt; lt; | Raquo; lt; lt; board [8] lt; lt; std :: endl; :: cout lt; lt; std :: endl; :: cin.sync ();
} display_game_progress () {(display_mode == PROGRESSIVE) {( cls ); _ intro ();
} :: cout lt; lt; npole posle hoda lt; lt; current_player.name lt; lt; std :: endl; _board ();
} verify_move () {(wrong_selection () ||! free_square ()) {:: cout lt; lt; nepravelnui hod. lt; lt; std :: endl; (player2.move == - 1) {.selected=1; .selected=0;
} else {.selected=0; .selected=1;
} ( pause ); (game_type == human vs computer ) {.selected=1; .selected=0;
} _ move ();
}
} seed_random_generator () {((unsigned) time (NULL));
} display_intro () {:: cout lt; lt; n ///////////////////////////////////////// lt; lt; std :: endl; :: cout lt; lt; Krestiki-Noliki lt; lt; std :: endl; :: cout lt; lt; ///////////////////////////////////////// lt; lt; std :: endl;
} setup_game_screen () {( mode con: cols=99 lines=300 );
} update_screen () {( pause ); ( cls ); :: cin.clear (); :: cin.sync (); _ intro (); _ game_type () ;
} check_game_state (char board [9]) {((board [0] == cSymbol amp; amp; board [1] == cSymbol amp; amp; board [2] == cSymbol) ||
(board [3] == cSymbol amp; amp; board [4] == cSymbol amp; amp; board [5] == cSymbol) ||
(board [6] == cSymbol amp; amp; board [7] == cSymbol amp; amp; board [8] == cSymbol) ||
(board [0] == cSymbol amp; amp; board [3] == cSymbol amp; amp; board [6] == cSymbol) ||
(board [1] == cSymbol amp; amp; board [4] == cSymbol amp; amp; board [7] == cSymbol) ||
(board [2] == cSymbol amp; amp; board [5] == cSymbol amp; amp; board [8] == cSymbol) ||
(board [0] == cSymbol amp; amp; board [4] == cSymbol amp; amp; board [8] == cSymbol) ||
(board [2] == cSymbol amp; amp; board [4] == cSymbol amp; amp; board [6] == cSymbol))
{(cSymbol == X ) {= XWIN;
} else if (cSymbol == O ) {= OWIN;
}
} {= DRAW; (int i=0; i lt; 9; ++ i) {(board [i] == 0) {= PLAYING ;;
}
}
}
} generate_moves (char _board [9], std :: list lt; int gt; amp; move_list) {(int i=0; i lt; 9; ++ i) {(_board [i] == 0) {_list.push_back (i);
}
}
} evaluate_position (char _board [9], player _player) {_game_state (_board); (game_over ()) {((state == XWIN amp; amp; _player.symbol == X raquo ;) ||
(state == OWIN amp; amp; _player.symbol == O )) {+ INFINITY;
} else if ((state == XWIN amp; amp; _player.symbol == ...