// These states wait for a timeout before moving on to the next action:
case STATE_HUMAN_TO_MOVE_DRAW_DECLINED:
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, " SORRY, BUT I THINK\x80");
Print_Str_d (MESSAGE_Y-10, -120, " I'LL KEEP PLAYING...\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_HUMAN_MUST_TAKE_ANOTHER_TIMEOUT:
Fadein_text();
Print_Str_d (MESSAGE_Y-10, -120, " TAKE ANOTHER PIECE!\x80");
Dim_Board();
// OR... Print_Str_d (MESSAGE_Y-10, -120, " MULTIPLE JUMP!\x80"); ?
// For now, the human could cheat and move any of his pieces.
// However the one that just took an opponent piece is pre-selected
// so with luck it won't occur to them before I've had a chance to
// fix it! (Note there is currently a problem with the pre-selected
// piece being disallowed. You have to unselect and reselect it.)
// TO DO: should that MODIF < 12 test from above appear here somewhere?
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_CHUCKLE_TIMEOUT: // "He-He! I am going to win!!"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, " HEH HEH HEH!\x80");
Print_Str_d (MESSAGE_Y-10, -120, " I AM GOING TO WIN!\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_OTHER_PLAYER_STARTS_ON_DRAW:
Fadein_text();
Print_Str_d (MESSAGE_Y+0, -120, " I ACCEPT A DRAW!\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_OTHER_PLAYER_STARTS;
return;
case STATE_OTHER_PLAYER_STARTS:
Fadein_text();
if (First_player_was == HUMAN) {
Print_Str_d (MESSAGE_Y+0, -120, " I PLAY FIRST THIS TIME\x80");
} else {
Print_Str_d (MESSAGE_Y+0, -120, "YOUR TURN TO PLAY FIRST\x80");
}
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_OTHER_PLAYER_STARTS_NOW;
return;
case STATE_YOU_HAVE_NO_PIECE_ON_TIMEOUT: // "You do not have a piece on square "
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, "YOU HAVE NO PIECE ON\x80");
Print_Str_d (MESSAGE_Y+10, 108, &REPLY (1));
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_FROM_SQUARE_NOT_EXIST_TIMEOUT: // The square ?? does not exist!"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, " NO SUCH SQUARE AS\x80");
Print_Str_d (MESSAGE_Y+10, 108, &REPLY (1));
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_TO_SQUARE_NOT_EXIST_TIMEOUT: // You cannot move to square ??; it does not exist!"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, " NO SUCH SQUARE AS\x80");
Print_Str_d (MESSAGE_Y+10, 108, &REPLY (4));
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_TO_SQUARE_OCCUPIED_TIMEOUT: // "You cannot move to square ??; it is already occupied!"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, " OCCUPIED SQUARE\x80");
REPLY(6) = 0x80; // REPLY 4:5 SHOULD BE THE DEST SQUARE
Print_Str_d (MESSAGE_Y+10, 80, &REPLY (4));
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE;
return;
case STATE_YOU_MUST_TAKE_TIMEOUT: // "You MUST take the piece that I am offering you"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, "YOU MUST TAKE THE PIECE\x80");
Print_Str_d (MESSAGE_Y-10, -120, " I AM OFFERING YOU\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE; // WON'T WORK WITH MULTIPLE TAKES
return;
case STATE_NOT_CROWNED_TIMEOUT: // "You cannot move that piece backwards!"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -128, "YOU CANNOT MOVE BACKWARDS\x80");
Print_Str_d (MESSAGE_Y-10, -128, " WITHOUT A CROWN\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE; // WON'T WORK WITH MULTIPLE TAKES
return;
case STATE_NO_SUCH_MOVE_TIMEOUT: // "That move does not exist in my rule book!"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, "THAT MOVE DOES NOT EXIST\x80");
Print_Str_d (MESSAGE_Y-10, -120, " IN MY RULE BOOK!\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE; // WON'T WORK WITH MULTIPLE TAKES
return;
case STATE_NOT_JUMPING_MY_PIECE_TIMEOUT: // "You cannot do that. You are not jumping one of my pieces"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, "THAT IS NOT A JUMP OVER\x80");
Print_Str_d (MESSAGE_Y-10, -120, " ONE OF MY PIECES!\x80");
Dim_Board();
if (--STATE_TIMEOUT == 0)
STATE = STATE_HUMAN_TO_MOVE; // MAY NEED A DIFFERENT TARGET TO RESUME HUMAN'S PLAY?
return;
// These states wait for the user to press a button:
case STATE_NO_PIECES_LEFT_STOP: // "I have no pieces left so I suppose you have won"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, " I HAVE NO PIECES LEFT\x80");
Print_Str_d (MESSAGE_Y-10, -120, " SO I GUESS YOU WIN!\x80");
Print_Str_d (MESSAGE_Y-40, -120, " PRESS ANY BUTTON\x80");
Print_Str_d (MESSAGE_Y-60, -120, " FOR ANOTHER GAME\x80");
Dim_Board();
if ((buttons_pressed()&15) != 0) STATE = STATE_OTHER_PLAYER_STARTS;
return;
case STATE_I_CANNOT_MOVE_STOP: // "I cannot move any of my pieces so you win"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -128, "I CANNOT MOVE ANY PIECES\x80");
Print_Str_d (MESSAGE_Y-10, -128, " SO YOU WIN!\x80");
Print_Str_d (MESSAGE_Y-40, -120, " PRESS ANY BUTTON\x80");
Print_Str_d (MESSAGE_Y-60, -120, " FOR ANOTHER GAME\x80");
Dim_Board();
if ((buttons_pressed()&15) != 0) STATE = STATE_OTHER_PLAYER_STARTS;
return;
case STATE_I_RESIGN_STOP: // "I resign"
Fadein_text();
Print_Str_d (MESSAGE_Y+0, -120 , " I RESIGN!\x80");
Print_Str_d (MESSAGE_Y-40, -120, " PRESS ANY BUTTON\x80");
Print_Str_d (MESSAGE_Y-60, -120, " FOR ANOTHER GAME\x80");
Dim_Board();
if ((buttons_pressed()&15) != 0) STATE = STATE_OTHER_PLAYER_STARTS;
return;
case STATE_YOU_CANNOT_MOVE_STOP: // "You cannot move any of your pieces so I win"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, "YOU CANNOT MOVE ANY PIECES\x80");
Print_Str_d (MESSAGE_Y-10, -120, " SO I WIN!\x80");
Print_Str_d (MESSAGE_Y-40, -120, " PRESS ANY BUTTON\x80");
Print_Str_d (MESSAGE_Y-60, -120, " FOR ANOTHER GAME\x80");
Dim_Board();
if ((buttons_pressed()&15) != 0) STATE = STATE_OTHER_PLAYER_STARTS;
return;
case STATE_YOU_HAVE_NO_PIECES_STOP: // "You have no pieces left so I win"
Fadein_text();
Print_Str_d (MESSAGE_Y+10, -120, "YOU HAVE NO PIECES LEFT\x80");
Print_Str_d (MESSAGE_Y-10, -120, " SO I WIN!\x80");
Print_Str_d (MESSAGE_Y-40, -120, " PRESS ANY BUTTON\x80");
Print_Str_d (MESSAGE_Y-60, -120, " FOR ANOTHER GAME\x80");
Dim_Board();
if ((buttons_pressed()&15) != 0) STATE = STATE_OTHER_PLAYER_STARTS;
return;