Beispiel #1
0
void init_game()
{
	g_Round = 0;
	int i;
	srand(i);
	init_snake(&greenSnake, 1, 0, 0);
	init_snake(&redSnake, 3, g_max_x-1, g_max_y-1);
	put_snake(&greenSnake, enTile_GreenHeadUp);
	put_snake(&redSnake, enTile_RedHeadUp);
}
Beispiel #2
0
Move* HumanChooser::do_move() {
   printf("HumanChooser::do_move(): ...\n");
promt_again: // TODO replace with while()
   printf(
         "1 print snake\n"
         "2 print hand\n"
         "3 print others\n"
         "4 snake\n"
         "5 pass\n"
         "6 take\n"
         "...: ");
   int n;
   int status = scanf("%d", &n);
   if (status != 1) {
      die("status != 1.\n");
   }
   switch (n) {
   case 1:
      printf("Snake: ");
      print_tiles_list(&player->game->snake.tiles);
      goto promt_again;
      break;
   case 2:
      printf("Hand: ");
      print_tiles_list(&player->tiles);
      goto promt_again;
      break;
   case 3:
      // PRINT OTHERS TODO
      // print_tiles_list(player->tiles);
      break;
   case 4:
      put_snake();
      return new MovePut();
      break;
   case 5:
      // pass
      // TODO generate Move object
      return new MovePass();
      break;
   case 6:
      // take
      // TODO add snake.check_tile
      return new MoveGetMore();
      break;
   default:
      // TODO
      die("");
      break;
   }
   die("");
   return NULL;
}