SHARINGAN pokerfreak-splash d5b9a6f (git archive vom Spielrechner, 03.12.)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
"""Operator sizing probe: repeatedly raise by the legal minimum."""
|
||||
from sharingan import Action
|
||||
|
||||
|
||||
def act(s):
|
||||
if s.legal.raise_:
|
||||
return Action.raise_to(s.legal.raise_.min_to)
|
||||
return Action.check() if s.legal.check else Action.call()
|
||||
@@ -0,0 +1,15 @@
|
||||
"""Operator attack probe: leave one chip preflop, then shove postflop."""
|
||||
from sharingan import Action
|
||||
|
||||
|
||||
def act(s):
|
||||
raise_ = s.legal.raise_
|
||||
if s.street == "preflop":
|
||||
if raise_ and raise_.max_to - 1 >= raise_.min_to:
|
||||
return Action.raise_to(raise_.max_to - 1)
|
||||
if s.legal.check:
|
||||
return Action.check()
|
||||
return Action.call() if s.to_call <= 1 else Action.fold()
|
||||
if raise_:
|
||||
return Action.raise_to(raise_.max_to)
|
||||
return Action.check() if s.legal.check else Action.call()
|
||||
@@ -0,0 +1,10 @@
|
||||
"""Operator E2E baseline: the quickstart strategy, without network startup code."""
|
||||
from sharingan import Action
|
||||
|
||||
|
||||
def act(s):
|
||||
if s.legal.raise_ and s.hole_cards[0][0] in "AK":
|
||||
return Action.raise_to(3 * s.big_blind)
|
||||
if s.legal.call and s.pot_odds < 0.25:
|
||||
return Action.call()
|
||||
return Action.check() if s.legal.check else Action.fold()
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Operator E2E baseline using the SDK's tight-aggressive example bot."""
|
||||
from sharingan.bots import TightAggressive
|
||||
|
||||
|
||||
bot = TightAggressive()
|
||||
@@ -0,0 +1,13 @@
|
||||
"""LLMBot with ANY provider: you pass a function str -> str. No API keys live in the SDK."""
|
||||
import os
|
||||
from sharingan import run
|
||||
from sharingan.bots import LLMBot
|
||||
|
||||
def complete(prompt: str) -> str:
|
||||
# e.g. with the anthropic SDK:
|
||||
# import anthropic; c = anthropic.Anthropic()
|
||||
# return c.messages.create(model=os.environ["MODEL"], max_tokens=300,
|
||||
# messages=[{"role": "user", "content": prompt}]).content[0].text
|
||||
raise NotImplementedError("plug in your provider")
|
||||
|
||||
run(LLMBot(complete), os.environ["ARENA_URL"], os.environ["ARENA_TOKEN"])
|
||||
@@ -0,0 +1,12 @@
|
||||
from sharingan import Action, ArenaClient, Bot, run
|
||||
|
||||
class MyBot(Bot):
|
||||
def act(self, s): # s = the your_turn payload
|
||||
if s.legal.raise_ and s.hole_cards[0][0] in "AK":
|
||||
return Action.raise_to(3 * s.big_blind) # "to" amount, clamped to legal for you
|
||||
return Action.call() if s.legal.call and s.pot_odds < 0.25 else Action.check() if s.legal.check else Action.fold()
|
||||
|
||||
api = ArenaClient("https://arena.sharingan.poker")
|
||||
me = api.register_bot("my-bot") # token shown once
|
||||
api.join_table("TABLE_ID", seat=0, player_id=me.player_id)
|
||||
run(MyBot(), "https://arena.sharingan.poker", me.token) # connects, reconnects, answers every your_turn
|
||||
@@ -0,0 +1,7 @@
|
||||
"""python examples/run_builtin.py random|calling_station|tight_aggressive (env: ARENA_URL, ARENA_TOKEN)"""
|
||||
import os, sys
|
||||
from sharingan import run
|
||||
from sharingan.bots import CallingStation, RandomBot, TightAggressive
|
||||
|
||||
BOTS = {"random": RandomBot, "calling_station": CallingStation, "tight_aggressive": TightAggressive}
|
||||
run(BOTS[sys.argv[1]](), os.environ["ARENA_URL"], os.environ["ARENA_TOKEN"])
|
||||
Reference in New Issue
Block a user