forked from HerrMotz/marjapussi-ki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
32 lines (27 loc) · 881 Bytes
/
main.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
from contextlib import contextmanager
from marjapussi.agent import Agent
from marjapussi.agent import test_agents
from marjapussi.game import MarjaPussi
import random
import time
from marjapussi.policy import RandomPolicy
from marjapussi.policy import LittleSmartPolicy
from policy import VerySmartPolicy
from policy2 import AlwaysProvokePolicy
# random.seed(2)
def main():
custom_rules = {
"start_game_value": 115,
"max_game_value": 420,
}
with stop_watch('Testen'):
test_agents(VerySmartPolicy(), VerySmartPolicy(), rounds=1, custom_rules=custom_rules, log_agent=False, log_game='DEBUG')
@contextmanager
def stop_watch(name):
start_time = time.time()
yield
elapsed_time = time.time() - start_time
print('\u231B [{}] finished in {} ms'.format(
name, int(elapsed_time * 1_000)))
if __name__ == '__main__':
main()