The bot currently doesn't play multiple cards at all. There should be a random chance of the bot playing multiple cards when possible.
Things to change:
|
if (visibleHand !== undefined) { |
|
const playable = playableCards(pile); |
|
const choice = visibleHand.filter((card) => |
|
playable.some((playableCard) => getRank(playableCard) === getRank(card)) |
|
); |
|
if (!choice.length) return; |
|
return choice[Math.floor(Math.random() * choice.length)]; |
|
} |
Return an amount of cards when possible at a random chance.
|
if (e.type === "ASK_PICK_CARD") { |
|
id = delayedTimeout(MIN_DELAY, MAX_DELAY, () => |
|
callback({ |
|
type: "CARD_CHOSEN", |
|
card: bot(e.pile, e.player), |
|
n: undefined, |
|
}) |
|
); |
|
} |
Use that value returned by the bot function and pass it to the state machine.
The bot currently doesn't play multiple cards at all. There should be a random chance of the bot playing multiple cards when possible.
Things to change:
zhithead/src/bot.ts
Lines 8 to 15 in 8399216
Return an amount of cards when possible at a random chance.
zhithead/src/state/services/bot.service.ts
Lines 17 to 25 in 8399216
Use that value returned by the bot function and pass it to the state machine.