def play_one_round():
    go_first = raw_input('Do you want to go first (y/n)?')
    if go_first.lower() == "y":
        #use -1 for human player
        player1_version = -1
        player2_version = ai_player_version
    else:
        player1_version = ai_player_version
        player2_version = -1

    playMatchesBetweenVersions(env, run_version, player1_version,
                               player2_version, episodes, lg.logger_play_game,
                               0)
Exemple #2
0
def play_one_round():
    global firstRun
    global player1
    global player2
    go_first = input('Do you want to go first (y/n)?')
    isFirst = 0
    if (go_first.lower() == "y"):
        isFirst = 1
    else:
        isFirst = -1
    player1_version = -1
    player2_version = ai_player_version

    if (firstRun):
        firstRun = False
        _, _, _, _, player1, player2 = playMatchesBetweenVersions(
            env, run_version, player1_version, player2_version, episodes,
            lg.logger_play_game, 0, isFirst)
    else:
        playMatches(player1, player2, episodes, lg.logger_play_game, 0, None,
                    isFirst)
            best_NN.model.set_weights(current_NN.model.get_weights())
            best_NN.write(env.name, best_player_version)

    else:
        print('MEMORY SIZE: ' + str(len(memory.ltmemory)))

# The following panels are not involved in the learning process

# Play matches between versions (use -1 for human player)

from game import Game
from funcs import playMatchesBetweenVersions
import loggers as lg

env = Game()
playMatchesBetweenVersions(env, 1, 1, 1, 10, lg.logger_tourney, 0)

# Pass a particular game state through the neural network (setup below for Connect4)

gs = GameState(
    np.array([
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    ]), 1)

preds = current_player.get_preds(gs)

print(preds)

current_player.model.viewLayers()
from game import Game
from funcs import playMatchesBetweenVersions
import loggers as lg

env = Game()
playMatchesBetweenVersions(
    env,
    '',  # the run version number where the computer player is located
    -1,  # the version number of the first player (-1 for human)
    5,  # the version number of the second player (-1 for human)
    10,  # how many games to play
    lg.logger_main,  # where to log the game to
    0,
    1  # which player to go first - 0 for random
)
import clr
clr.AddReference("GameProject")
from ConnectFour import Game
from funcs import playMatchesBetweenVersions
import loggers as lg

env = Game()

playMatchesBetweenVersions(env, 1, 93, 206, 20, lg.logger_tourney, 0, 1)
Exemple #6
0
from game import Game
from funcs import playMatchesBetweenVersions
import loggers as lg

env = Game()
scores, _, points, sp_scores = playMatchesBetweenVersions(
    env, 4, -1, 17, 1, lg.logger_tourney, 0)
print('\nSCORES')
print(scores)
print('\nSTARTING PLAYER / NON-STARTING PLAYER SCORES')
print(sp_scores)
from game import Game
from funcs import playMatchesBetweenVersions
import loggers as lg

env = Game()
playMatchesBetweenVersions(
    env,
    1  # the run version number where the computer player is located
    ,
    6  # the version number of the first player (-1 for human)
    ,
    -1  # the version number of the second player (-1 for human)
    ,
    1  # how many games to play
    ,
    lg.logger_tourney  # where to log the game to
    ,
    1  # which player to go first - 0 for random
)
Exemple #8
0
from game import Game
from funcs import playMatchesBetweenVersions
import loggers as lg

player_1_version = -1
player_2_version = input('version number?')

env = Game()
playMatchesBetweenVersions(env, 2, player_1_version, player_2_version, 10,
                           lg.logger_play, 0)