static void
loa_game_new_game (loa_game_t *game)
{
- loa_board_init (&game->board);
+ loa_board_reset (&game->board);
}
static loa_bool_t
loudgame_broadcastf (&game->lg, "%s wins", peer);
}
+static void
+loa_game_handle_history (loa_game_t *game,
+ const char *peer)
+{
+ int i;
+
+ for (i = 0; i < game->board.num_moves; i++)
+ loudgame_sendf (&game->lg, peer, "%s",
+ loa_move_to_string (&game->board.moves[i]));
+}
+
static void
loa_game_handle_pass (loa_game_t *game, const char *peer)
{
"\tmove aNbN\tMove a piece, (eg. 'move b1d3')\n"
"\tpass \t\tSkip a turn (only legal if no moves are possible)\n"
"\tnew \t\tBegin a new game\n"
+ "\thistory \t\tShow the move history of the game\n"
"\thelp \t\tThis help message\n"
"\trules \t\tA description of the Lines of Action rules\n"
"\n"
loa_game_handle_pass (game, peer);
else if (strcmp (message, "new") == 0)
loa_game_handle_new (game, peer);
+ else if (strcmp (message, "history") == 0)
+ loa_game_handle_history (game, peer);
else if (strcmp (message, "help") == 0)
loa_game_handle_help (game, peer);
else if (strcmp (message, "rules") == 0)
if (err)
return err;
+ loa_board_init (&game->board);
+
loa_game_new_game (game);
return 0;