-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaying_actions.jl
121 lines (118 loc) · 3.05 KB
/
playing_actions.jl
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using Printf
using DataFrames
include("utils.jl")
function aggressive_play(skull, flowers)
"""
they want to play their skull, but not always first because
the top of their stack is going to stump people..
>first turn
-play skull first 10% of time
-play flower 90% of time
-never bet
if possible
>play skull second with 50% chance
if possible
>play skull third with 50% chance
this player bets rarely, and usually only low to egg people on
"""
#skull avail..
if skull == 1
#first turn.
if flowers == 3
odds = rand(1:10)
if odds == 1
return 2
else
return 1
end
elseif flowers == 0
#no flowers to play..
return 2
else
#play skull at 50% odds.
odds = rand(1:2)
if odds == 1
return 2
else
return 1
end
end
else
if flowers == 0
return 4
end
odds = rand(1:20)
if odds == 1
#bet 2 with 5% likelihood
return 4
end
return 1
end
end
function random_play(skull, flowers)
if flowers > 0
if skull > 0
if flowers == 3
#first turn, have to play a card
move = rand(1:2)
else
#both avail, or we can bet...
#choosing 5 arbitrarily.. means that our initial bet will always be 3
move = rand(1:5)
end
return move
else
#skull not available, prob don't wanna bet.
return 1
end
else
if skull > 0
#no flowers, either bet or play skull ;)
card = rand(2:5)
return card
else
return rand(3:5)
end
end
end
function flower_play(skull, flowers)
"""
they want to always play their flower when they can
>first turn
-always play flower
>second turn
- always play flower
>third turn
-50% of time they will bet.
-1/3 of the this time they bet 2, 1/3 bet 3, 1/3 bet 4...
>Last turn
-play their skull 1/25 time, otherwise bet.
"""
if flowers > 0
#have flowers to play
if flowers == 1
#we have two flowers down
odds = rand(1:2)
if odds == 1
#bet 50% of the time
return rand(4:6)
end
end
return 1
elseif skull > 0
#no flowers, either bet or play skull ;)
card = rand(2:6)
if card == 2
#since this is the flower policy and we don't want to play skulls much,
# reducing the event space for laying skulls from 1/5 to 1/25
card = rand(2:6)
end
if card == 3
#we know that we can successfully flip over our own three.
card += 1
end
return card
else
return rand(3:6)
end
end