-
Notifications
You must be signed in to change notification settings - Fork 1
/
hyunji_agent.py
executable file
·70 lines (56 loc) · 2.03 KB
/
hyunji_agent.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
from aiwolf import AbstractPlayer, Agent, Content, GameInfo, GameSetting, Role
from bodyguard import HyunjiBodyguard
from medium import HyunjiMedium
from possessed import HyunjiPossessed
from seer import HyunjiSeer
from villager import HyunjiVillager
from werewolf import HyunjiWerewolf
class HyunjiPlayer(AbstractPlayer):
villager: AbstractPlayer
bodyguard: AbstractPlayer
medium: AbstractPlayer
seer: AbstractPlayer
possessed: AbstractPlayer
werewolf: AbstractPlayer
player: AbstractPlayer
def __init__(self) -> None:
self.villager = HyunjiVillager()
self.bodyguard = HyunjiBodyguard()
self.medium = HyunjiMedium()
self.seer = HyunjiSeer()
self.possessed = HyunjiPossessed()
self.werewolf = HyunjiWerewolf()
self.player = self.villager
def attack(self) -> Agent:
return self.player.attack()
def day_start(self) -> None:
self.player.day_start()
def divine(self) -> Agent:
return self.player.divine()
def finish(self) -> None:
self.player.finish()
def guard(self) -> Agent:
return self.player.guard()
def initialize(self, game_info: GameInfo, game_setting: GameSetting) -> None:
role: Role = game_info.my_role
if role == Role.VILLAGER:
self.player = self.villager
elif role == Role.BODYGUARD:
self.player = self.bodyguard
elif role == Role.MEDIUM:
self.player = self.medium
elif role == Role.SEER:
self.player = self.seer
elif role == Role.POSSESSED:
self.player = self.possessed
elif role == Role.WEREWOLF:
self.player = self.werewolf
self.player.initialize(game_info, game_setting)
def talk(self) -> Content:
return self.player.talk()
def update(self, game_info: GameInfo) -> None:
self.player.update(game_info)
def vote(self) -> Agent:
return self.player.vote()
def whisper(self) -> Content:
return self.player.whisper()