-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (24 loc) · 928 Bytes
/
main.py
File metadata and controls
27 lines (24 loc) · 928 Bytes
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
import random
import pyspiel
import numpy as np
game = pyspiel.load_game("kuhn_poker")
state = game.new_initial_state()
while not state.is_terminal():
legal_actions = state.legal_actions()
if state.is_chance_node():
# Sample a chance event outcome.
outcomes_with_probs = state.chance_outcomes()
action_list, prob_list = zip(*outcomes_with_probs)
action = np.random.choice(action_list, p=prob_list)
state.apply_action(action)
else:
# The algorithm can pick an action based on an observation (fully observable
# games) or an information state (information available for that player)
# We arbitrarily select the first available action as an example.
action = legal_actions[0]
state.apply_action(action)
print("Selected action: {}\n".format(game.action_to_string(state.current_player(), action)))
print("Returns: {}".format(state.returns()))
import os
#print arch
print(os.uname())