forked from Turing-Games/template-python-poker-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·44 lines (35 loc) · 1.43 KB
/
main.py
File metadata and controls
executable file
·44 lines (35 loc) · 1.43 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
import asyncio
import argparse
from tg.bot import Bot
import time
parser = argparse.ArgumentParser(
prog='Template bot',
description='A Turing Games poker bot that always checks or calls, no matter what the target bet is (it never folds and it never raises)')
parser.add_argument('--port', type=int,
help='The port to connect to the server on')
parser.add_argument('--host', type=str, default='localhost',
help='The host to connect to the server on')
parser.add_argument('--room', type=str, default='my-new-room',
help='The room to connect to')
parser.add_argument('--party', type=str, default='poker',
help='The party to connect to')
parser.add_argument('--key', type=str, default='',
help='The key for authentication')
args = parser.parse_args()
# Always call
class TemplateBot(Bot):
def act(self, state, hand):
print('asked to act')
print('acting', state, hand, self.my_id)
return {'type': 'call'}
def opponent_action(self, action, player):
print('opponent action?', action, player)
def game_over(self, payouts):
print('game over', payouts)
def start_game(self, my_id):
self.my_id = my_id
print('start game', my_id)
if __name__ == "__main__":
bot = TemplateBot(args.host, args.port, args.room, args.party, args.key)
asyncio.run(bot.start())