-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
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:
Lines 8 to 15 in 8399216
| 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.
zhithead/src/state/services/bot.service.ts
Lines 17 to 25 in 8399216
| 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.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers