4 /* Move queues; in fact, they are more like move lists, used to accumulate
5 * equally good move candidates, then choosing from them randomly. */
15 /* Add a move to the queue. */
16 static void mq_add(struct move_queue
*q
, coord_t c
);
18 /* Cat two queues together. */
19 static void mq_append(struct move_queue
*qd
, struct move_queue
*qs
);
21 /* Check if the last move in queue is not a dupe, and remove it
23 static void mq_nodup(struct move_queue
*q
);
27 mq_nodup(struct move_queue
*q
)
29 if ((q
->moves
> 1 && q
->move
[q
->moves
- 2] == q
->move
[q
->moves
- 1])
30 || (q
->moves
> 2 && q
->move
[q
->moves
- 3] == q
->move
[q
->moves
- 1])
31 || (q
->moves
> 3 && q
->move
[q
->moves
- 4] == q
->move
[q
->moves
- 1]))
36 mq_append(struct move_queue
*qd
, struct move_queue
*qs
)
38 assert(qd
->moves
+ qs
->moves
< MQL
);
39 memcpy(&qd
->move
[qd
->moves
], qs
->move
, qs
->moves
* sizeof(*qs
->move
));
40 qd
->moves
+= qs
->moves
;
44 mq_add(struct move_queue
*q
, coord_t c
)
46 assert(q
->moves
< MQL
);
47 q
->move
[q
->moves
++] = c
;