From a836849e41e33e696f8d5f4cef65efa4a6097bc5 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 1 Oct 2009 19:26:01 +0200 Subject: [PATCH] Board: Maintain second-to-last move as last_move2 too --- board.c | 5 ++++- board.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/board.c b/board.c index 9d6ee7c..aa8f6b2 100644 --- a/board.c +++ b/board.c @@ -29,7 +29,7 @@ board_setup(struct board *b) memset(b, 0, sizeof(*b)); struct move m = { pass, S_NONE }; - b->last_move = b->ko = m; + b->last_move = b->last_move2 = b->ko = m; } struct board * @@ -710,6 +710,7 @@ board_play_outside(struct board *board, struct move *m, int f) group = new_group(board, coord); board_at(board, coord) = color; + board->last_move2 = board->last_move; board->last_move = *m; board->moves++; board_hash_update(board, coord, color); @@ -791,6 +792,7 @@ board_play_in_eye(struct board *board, struct move *m, int f) board_at(board, coord) = color; + board->last_move2 = board->last_move; board->last_move = *m; board->moves++; board_hash_update(board, coord, color); @@ -826,6 +828,7 @@ int board_play(struct board *board, struct move *m) { if (unlikely(is_pass(m->coord) || is_resign(m->coord))) { + board->last_move2 = board->last_move; board->last_move = *m; return 0; } diff --git a/board.h b/board.h index b708d24..b7db908 100644 --- a/board.h +++ b/board.h @@ -83,6 +83,7 @@ struct board { int moves; struct move last_move; + struct move last_move2; /* second-to-last move */ /* Whether we tried to add a hash twice; board_play*() can * set this, but it will still carry out the move as well! */ bool superko_violation; -- 2.11.4.GIT