-
Notifications
You must be signed in to change notification settings - Fork 2
/
Argument.py
40 lines (29 loc) · 1.32 KB
/
Argument.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
class Argument:
def __init__(self, name, initial_weight, strength=None, attackers=None, supporters=None):
self.name = name
self.initial_weight = initial_weight
self.strength = strength
self.attackers = attackers
self.supporters = supporters
if type(initial_weight) != int and type(initial_weight) != float:
raise TypeError("initial_weight must be of type integer or float")
if strength is None:
self.strength = initial_weight
if attackers is None:
self.attackers = []
if supporters is None:
self.supporters = []
def get_name(self):
return self.name
def add_attacker(self, attacker):
self.attackers.append(attacker)
def add_supporter(self, supporter):
self.supporters.append(supporter)
def get_initial_weight(self):
return self.initial_weight
def reset_initial_weight(self, weight):
self.initial_weight = weight
def __repr__(self) -> str:
return f"Argument {self.name}: initial weight {self.initial_weight}, strength {self.strength}, attackers {self.attackers}, supporters {self.supporters}"
def __str__(self) -> str:
return f"Argument(name={self.name}, weight={self.initial_weight}, strength={self.strength})"