-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandomplayer.py
37 lines (28 loc) · 930 Bytes
/
randomplayer.py
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
#
# Random Player
#
# Example bot which randomly chooses which dice to reroll
# 50:50 per die
#
import random
from dicepoker import *
class RandomPlayer(Player):
def name(self) -> str:
return 'RandomPlayer'
def accept_raise_stakes(self,
current_stakes: int,
available_money: int,
my_hand: Hand,
opponent_hand: Hand,
raise_amount: int) -> bool:
return bool(random.randint(0, 1))
def choose_dice_to_reroll(self,
current_stakes: int,
available_money: int,
my_hand: Hand,
opponent_hand: Hand) -> List[int]:
rv = []
for die in my_hand:
if random.randint(0, 1):
rv.append(die)
return rv