Теми рефератів
> Реферати > Курсові роботи > Звіти з практики > Курсові проекти > Питання та відповіді > Ессе > Доклади > Учбові матеріали > Контрольні роботи > Методички > Лекції > Твори > Підручники > Статті Контакти
Реферати, твори, дипломи, практика » Курсовые проекты » Програма перевіркі логічного мислення

Реферат Програма перевіркі логічного мислення





школа, 2 003.



ДОДАТОК А


Схема алгоритму програми


ДОДАТОК Б


Лістінг програми


# include lt; windows.h gt;

# include lt; iostream gt;

# include lt; string gt;

# include lt; ctime gt;

# include lt; list gt; const int INFINITY=1000000; enum {START, PLAYING, QUIT, OWIN, XWIN, DRAW} state; enum {REGULAR, PROGRESSIVE} display_mode; struct {:: string name ; symbol; move; game_win; draw_num; selected; win;

} player;display_board();seed_random_generator();get_move();display_result();select_game_type();get_player_symbol();get_player_name();reset_player_name();find_winner();reset_winner();update_board();update_screen();verify_move();reset_state();reset_board();initialise_player_move();display_intro();display_game_progress();update_game();setup_game_screen();wrong_symbol();wrong_selection();game_over();free_square();generate_moves(char _board [9], std :: list lt; int gt; amp; move_list); check_game_state (char board [9]); evaluate_position (char _board [9], player _player); MiniMax (char _board [9], player _player); MinMove (char _board [9], player _player); MaxMove (char _board [9], player _player); player player1, player2, current_player;// std :: string game_type; std :: string prev_game_type; char board [9]={0}; char cSymbol; int nMove; main () {_random_generator (); _ game_screen (); _ intro (); _ game_type (); (state!=QUIT) {_player_name (); _ player_symbol (); (state!=QUIT) {(state == PLAYING) {_player_move (); _ move (); _ game ();

} (game_over ()) {_winner (); _ result (); _ game_statistic (); _ state (); _ board (); _ intro ();

} _ game_type ();

}

} 0;

} select_game_type () {:: cout lt; lt; 1 - Igrat protiv computera. Raquo; lt; lt; std :: endl; :: cout lt; lt; 2 - Igrat protiv drugogo igroka. Raquo; lt; lt; std :: endl; :: cout lt; lt; 3 - Exit lt; lt; std :: endl; :: cout lt; lt; nselection: raquo ;; choice; :: cin gt; gt; choice; (! std :: cin.good ()) {:: cout lt; lt; tol ko integer lt; lt; std :: endl; _screen ();

} (choice) {1: _type= human vs computer raquo ;;; 2: _type= human vs human raquo ;;; 3:=QUIT ;; ::: cout lt; lt ; Nepravel nui vibor . lt; lt; std :: endl; _screen ();

} (choice gt; 0 amp; amp; choice lt; 3) {(prev_game_type!= amp; amp; game_type!=prev_game_type) {_game_statistic (); _ player_name (); _player_name (); _ player_symbol ();

} (game_type.length () gt; 0) {_game_type=game_type;

}

}

} get_player_name () {:: cin.sync (); (game_type == human vs computer ) {:: cout lt; lt; nVvedite vashe imya: raquo ;; :: getline (std :: cin, player1.name); (player1.name.length () == 0) {_player_name ();

}. name= computer raquo ;;

} else if (game_type == human vs human ) {(player1.name.length () == 0) {:: cout lt; lt; aIgrok 1, vvedite vashe imya: raquo ;; :: getline (std :: cin, player1.name);

} (player2.name.length () == 0) {:: cout lt; lt; Igrok 2, vvedite vashe imya: raquo ;; :: getline (std :: cin, player2.name);

}

} else if (game_type == computer vs computer ) {.name= computer player1 raquo ;;. name= computer player2 raquo ;;

}

} reset_player_name () {.name.erase () ;. name.erase ();

} get_player_symbol () {(game_type == human vs computer ) {selection=rand ()% 2; (selection == 0) {()% 2 == 0? player2.symbol= X :Player2.symbol= O raquo ;;=player2.symbol; .selected=1; :: cout lt; lt; player2.name lt; lt; budet igrat ' lt; lt; player2.symbol lt; lt; ' lt; lt; std :: endl;

} else if (selection == 1) {:: cout lt; lt; player1.name lt; lt; viberite vash simvol (X, O): raquo ;; :: cin gt; gt; player1.symbol; .symbol=toupper (player1.symbol);=player1.symbol; .selected=1;

}

} else if (game_type == human vs human ) {sel=rand ()% 2; :: string player_name= raquo ;; (sel == 0) {_name= player1.name; .selected=1;

} else if (sel == 1) {_name=player2.name; .selected=1;

} :: cout lt; lt; n lt; lt; player_name lt; lt; viberite vash simvol (X, O): raquo ;; (sel == 0) {:: cin gt; gt; player1.symbol; .symbol=toupper (player1.symbol);=player1.symbol;

...


Назад | сторінка 3 з 6 | Наступна сторінка





Схожі реферати:

  • Реферат на тему: Allusion as discourse symbol
  • Реферат на тему: Сучасні технології Виведення ІНФОРМАЦІЇ. Технології Computer to film, Comp ...
  • Реферат на тему: Human rights
  • Реферат на тему: Private sector and human-resource development in Georgia
  • Реферат на тему: Social human rights and their maintenance in Republic North Ossetia - Alani ...