-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathplayer.py
82 lines (66 loc) · 2.16 KB
/
player.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
class Player:
def __init__(self, name, district, is_male: bool = True):
self.name = name
self.district = district
self.is_male = is_male
self.alive = True
self.kills = 0
self.cause_of_death = ""
def __str__(self):
return self.name
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.name == other.name and self.district == other.district and self.is_male == other.is_male
return False
def __ne__(self, other):
return self.name != other.name or self.district != other.district or self.is_male != other.is_male
def __lt__(self, other):
return (self.district, not self.is_male, self.name) < (other.district, not other.is_male, other.name)
def __le__(self, other):
return (self.district, not self.is_male, self.name) <= (other.district, not other.is_male, other.name)
def __gt__(self, other):
return (self.district, not self.is_male, self.name) > (other.district, not other.is_male, other.name)
def __ge__(self, other):
return (self.district, not self.is_male, self.name) >= (other.district, not other.is_male, other.name)
def __hash__(self):
return hash((self.district, self.is_male, self.name))
@property
def he_she(self):
if self.is_male:
return "he"
return "she"
@property
def he_she_cap(self):
if self.is_male:
return "He"
return "She"
@property
def him_her(self):
if self.is_male:
return "him"
return "her"
@property
def him_her_cap(self):
if self.is_male:
return "Him"
return "Her"
@property
def himself_herself(self):
if self.is_male:
return "himself"
return "herself"
@property
def himself_herself_cap(self):
if self.is_male:
return "Himself"
return "Herself"
@property
def his_her(self):
if self.is_male:
return "his"
return "her"
@property
def his_her_cap(self):
if self.is_male:
return "His"
return "Her"