saolsen-poker_agent_folds.web.val.run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { agentHandler } from "https://esm.town/v/saolsen/gameplay_agent";
import { GameKind, JsonObject } from "https://esm.town/v/saolsen/gameplay_games";
import {
PokerActionKind,
PokerAgentResponse,
PokerView,
} from "https://esm.town/v/saolsen/gameplay_poker";
function fold_action(
view: PokerView,
_agent_data?: JsonObject,
): PokerAgentResponse {
if (view.rounds[view.round].bet === 0) {
return { action: { kind: PokerActionKind.Check } };
}
return { action: { kind: PokerActionKind.Fold } };
}
export default agentHandler(
[
{
game: GameKind.Poker,
agentname: "folds",
agent: fold_action,
},
],
);
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
April 28, 2024