-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhammy_conditions.py
68 lines (43 loc) · 1.44 KB
/
hammy_conditions.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
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
from typing import Tuple
HammyReward = float
HammyHealth = float
MAX_LEVEL = 5.
class HammyCondition(object):
def __init__(self):
self.level = 1.
def skip(self) -> Tuple[HammyReward, HammyHealth]:
self.level -= 0.1
if self.level < 0.:
return -0.1, -0.01
return 0., 0.
def act(self) -> Tuple[HammyReward, HammyHealth]:
self.level += 1.
if self.level > MAX_LEVEL:
return 0., -0.1
return 1., 0.0
def reset(self):
self.level = 1.
def cod_message_act(self) -> str:
raise NotImplementedError
def cod_message_skip(self) -> str:
raise NotImplementedError
class FoodCondition(HammyCondition):
def cod_message_act(self) -> str:
return "Exploded from eating too much food"
def cod_message_skip(self) -> str:
return "Starved to death"
class DrinkCondition(HammyCondition):
def cod_message_act(self) -> str:
return "Turned into a Tsunami"
def cod_message_skip(self) -> str:
return "Died of thirst"
class SleepCondition(HammyCondition):
def cod_message_act(self) -> str:
return "Died in his sleep"
def cod_message_skip(self) -> str:
return "Lack of sleep"
class AttentionCondition(HammyCondition):
def cod_message_act(self) -> str:
return "Turned into a pancake from all the attention"
def cod_message_skip(self) -> str:
return "Lack of love"