Esempio n. 1
0
from basic.basic import *
from basic.advanced import *

# Symmetric NE
# 0.360945, 0.165931, 0.473124
# Low, Medium, High

# basic setting

max_game = 30000
n_player = 4
n_coin = 5
n_test = 100
lr = 5e-4
filename = "FF_prob_" + str(max_game) + "_" + str(lr) + "_uni"
bank_set_value("n_player", n_player)
bank_set_value("n_coin", n_coin)
bank_set_value("max_game", max_game)
chessboard = A2F_Chessboard([10, 5, 3, 5, 10])
chessboard_value = chessboard.get_value()
winning_rate = np.zeros((n_player, max_game))
player_list = [
    A2FP_Learner, A2FP_Random_Prob, A2FP_Random_Prob, A2FP_Random_Prob
]
PARA_SYM_NE = [[0.360945, 0.165931, 0.473124], [0.360945, 0.473124, 0.165931],
               [0.165931, 0.473124, 0.360945], [0.473124, 0.165931, 0.360945]]

PARA_LIST = [[0.360945, 0.165931, 0.473124], [0.360945, 0.473124, 0.165931],
             [0.165931, 0.473124, 0.360945], [0.473124, 0.165931, 0.360945]]

PARA_UNI = [[1 / 3, 1 / 3, 1 / 3], [1 / 3, 1 / 3, 1 / 3],
Esempio n. 2
0
#!/usr/bin/python
# -*- coding: UTF-8 -*-

from bank.bank import bank_set_value
from basic.basic import *

bank_set_value("n_player", 4)
bank_set_value("n_coin", 5)
bank_set_value("n_max_game", 5)

# test basic setting
chessboard_0 = A2F_Chessboard([2, 3, 5, 3, 2])
player_0 = A2F_Player([0, 0, 1, 0])
coin_0 = A2F_Coin([0, 0, 0, 0])
policy_0 = [0, 0, 1, 0, 0]
policy_1 = [1, 0, 0, 0, 0]
policy_2 = [0, 0, 1, 0, 0]
policy_3 = [0, 0, 0, 1, 0]
action_0 = A2F_Action([policy_0, policy_1, policy_2, policy_3])
round_0 = A2F_Round(chessboard=chessboard_0,
                    action=action_0)
coin_1 = round_0.run()
print(coin_0.get_value() + coin_1.get_value())

# test history
game_0 = A2F_Game()
game_0.add_round(round_0)
coin_11 = game_0.get_round(0).run()
print(coin_0.get_value() + coin_11.get_value())

#!/usr/bin/python
# -*- coding: UTF-8 -*-

from bank.bank import bank_set_value
from basic.basic import *
from policy.pure_policy import *

# basic setting
n_player = 4
n_coin = 5
n_max_game = 5

bank_set_value("n_player", n_player)
bank_set_value("n_coin", n_coin)
bank_set_value("n_max_game", n_max_game)

chessboard = A2F_Chessboard([2, 3, 5, 3, 2])
player_0 = A2F_Player([1, 0, 0, 0])
player_1 = A2F_Player([0, 1, 0, 0])
player_2 = A2F_Player([0, 0, 1, 0])
player_3 = A2F_Player([0, 0, 0, 1])
player_list = [player_0, player_1, player_2, player_3]

coin_0 = A2F_Coin([0, 0, 0, 0])
game = A2F_Game()
coin_list = []

for idx_round in range(n_max_game):
    action_list = []

    # n-1 random player