-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (26 loc) · 1.06 KB
/
main.py
File metadata and controls
39 lines (26 loc) · 1.06 KB
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
"""
Runs a complete Evolution game with the given number of Silly players.
"""
from argparse import ArgumentParser
from evolution.dealer.dealer import Dealer
from evolution.player.dummy_player import DummyPlayer
PLAYERS_MIN = 3
PLAYERS_MAX = 8
def main(n):
""" Runs a complete Evolution game with the given number of players
:param n: number of players in the game
"""
assert n in range(PLAYERS_MIN, PLAYERS_MAX + 1), "invalid number of players"
players = [DummyPlayer(idx + 1) for idx in range(0, n)]
dealer = Dealer()
dealer.add_external_players(players)
dealer.run_game()
print("Results:")
for place, (idx, bag) in enumerate(dealer.ranking()):
print("{} player id: {} score: {}".format(place + 1, idx, bag))
if __name__ == "__main__":
parser = ArgumentParser(description="Simulates a complete Evolution game")
parser.add_argument("n", type=int,
help="number of players in the game, in range [{}, {}]".format(PLAYERS_MIN, PLAYERS_MAX))
args = parser.parse_args()
main(args.n)