-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathplayer_x_win.py
39 lines (30 loc) · 1.25 KB
/
player_x_win.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
from src.blockchain_utils.credentials import get_client, get_account_credentials
from src.services.game_engine_service import GameEngineService
client = get_client()
acc_pk, acc_address, _ = get_account_credentials(account_id=3)
player_x_pk, player_x_address, _ = get_account_credentials(account_id=1)
player_o_pk, player_o_address, _ = get_account_credentials(account_id=2)
game_engine = GameEngineService(app_creator_pk=acc_pk,
app_creator_address=acc_address,
player_x_pk=player_x_pk,
player_x_address=player_x_address,
player_o_pk=player_o_pk,
player_o_address=player_o_address)
game_engine.deploy_application(client=client)
game_engine.start_game(client=client)
game_actions = [
("X", 0),
("O", 1),
("X", 2),
("O", 5),
("X", 4),
("O", 8),
("X", 6),
]
for player_id, action_position in game_actions:
game_engine.play_action(client=client,
player_id=player_id,
action_position=action_position)
game_engine.fund_escrow(client=client)
game_engine.win_money_refund(client=client,
player_id="X")