Commit abf726bc authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Do not select the double keep that many times

If someone bids a straight keep, there is a 1/2 chance that the next
player would bid a double keep.  This is not acceptable.  This patch
reverts this.
parent acb741e8
......@@ -204,19 +204,23 @@ random_move (const TarotGame * game)
TarotCard *additional;
if (tarot_game_get_hint_bid (game, &next, &mini_bid) == TAROT_GAME_OK)
{
TarotBid acceptable[5] = { TAROT_PASS };
size_t n_acceptable = 1;
TarotBid consider;
TarotBid bids[] = {
TAROT_PASS, TAROT_TAKE, TAROT_PUSH, TAROT_STRAIGHT_KEEP,
TAROT_DOUBLE_KEEP
};
size_t position;
uint8_t position_data[sizeof (position)];
for (consider = mini_bid; consider <= TAROT_DOUBLE_KEEP; consider++)
{
acceptable[n_acceptable++] = consider;
}
yarrow256_random (&generator, sizeof (position_data), position_data);
memcpy (&position, position_data, sizeof (position));
position %= n_acceptable;
return tarot_game_event_alloc_bid (acceptable[position]);
position %= (sizeof (bids) / sizeof (bids[0]));
if (bids[position] >= mini_bid)
{
return tarot_game_event_alloc_bid (bids[position]);
}
else
{
return tarot_game_event_alloc_bid (TAROT_PASS);
}
}
else if (tarot_game_get_hint_decl (game, &next, &decl_allowed) ==
TAROT_GAME_OK)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment