forked from thainv0212/my_game_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_game.py
24 lines (21 loc) · 911 Bytes
/
test_game.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
import sys
from test_ai import TestAI, MyAI
from machete import Machete
from display_info import DisplayInfo
from py4j.java_gateway import JavaGateway, GatewayParameters, CallbackServerParameters, get_field
for i in range(2000):
gateway = JavaGateway(gateway_parameters=GatewayParameters(port=4242), callback_server_parameters=CallbackServerParameters())
manager = gateway.entry_point
manager.registerAI('TestAI', MyAI(gateway, train=True))
manager.registerAI('Machete', Machete(gateway))
# manager.registerAI('DisplayInfo', DisplayInfo(gateway))
print('Start game')
# game = manager.createGame('ZEN', 'ZEN', 'Machete', 'TestAI', 3)
game = manager.createGame('ZEN', 'ZEN', 'MctsAi', 'TestAI', 1000)
manager.runGame(game)
print('After game')
sys.stdout.flush()
print('End of games')
gateway.close_callback_server()
gateway.close()
gateway.shutdown()