From 02085e2b34bcf2592b9dd139aa0cb2f276918e31 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Tue, 4 May 2010 01:52:34 +0200 Subject: [PATCH] board_play_random(): Simplify a bit --- board.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/board.c b/board.c index 2905482..84e917c 100644 --- a/board.c +++ b/board.c @@ -1347,13 +1347,8 @@ board_play_random(struct board *b, enum stone color, coord_t *coord, ppr_permit if (unlikely(b->flen == 0)) goto pass; - int base = fast_random(b->flen); - *coord = b->f[base]; - if (likely(board_try_random_move(b, color, coord, base, permit, permit_data))) - return; - - int f; - for (f = base + 1; f < b->flen; f++) + int base = fast_random(b->flen), f; + for (f = base; f < b->flen; f++) if (board_try_random_move(b, color, coord, f, permit, permit_data)) return; for (f = 0; f < base; f++) -- 2.11.4.GIT