예제 #1
0
# This file should not be posted on any public server, or made available to any party not
# enrolled in CMPT 317.

# This implementation is provided on an as-is basis, suitable for educational purposes only.

from A4Q4 import Game
import Players
import MinimaxData as Searcher

# create the game, and the initial state
game = Game()
state = game.initial_state()

# set up the players
current_player = Players.VerboseComputer(game, Searcher.MinimaxData(game))
# current_player = Players.HumanMenu(game)

other_player = Players.VerboseComputer(game, Searcher.MinimaxData(game))
# other_player = Players.HumanMenu(game)

# play the game
while not game.is_terminal(state):
    #show the board out of courtesy
    state.display()

    # ask the current player for a move
    choice = current_player.ask_move(state)

    # check the move
    assert choice in game.actions(
예제 #2
0
    state = game.initial_state()
    # game.rebel_direction_constraint(state)
    # game.sith_direction_constraint(state)
    # game.jedi_direction_constraints(state)
    # print(game.actions(state))
    # game.result(state,['REBEL', [2, 5], 'UP', 1, [1, 5]])
    # state.display()

    # game1 = TicTacToe(depthlimit=4)

    # set up the players
    # current_player = Players.VerboseComputer(game, Searcher.MinimaxData(game))
    # current_player = Players.HumanMenu(game)

    current_player = Players.VerboseComputer(game, DL.AlphaBetaDL(game))

    other_player = Players.VerboseComputer(game, DL.AlphaBetaDL(game))
    # other_player = Players.HumanMenu(game)

    # play the game
    while not game.is_terminal(state):
        #show the board out of courtesy
        state.display()

        # ask the current player for a move
        choice = current_player.ask_move(state)

        print(game.actions(state))

        # check the move
예제 #3
0
state = game.initial_state()
# game.rebel_direction_constraint(state)
# game.sith_direction_constraint(state)
# game.jedi_direction_constraints(state)
# print(game.actions(state))
# game.result(state,['REBEL', [2, 5], 'UP', 1, [1, 5]])
# state.display()

# game1 = TicTacToe(depthlimit=4)

# set up the players
# current_player = Players.VerboseComputer(game, Searcher.MinimaxData(game))
# current_player = Players.HumanMenu(game)

current_player = Players.VerboseComputer(game, a4q6.AlphaBetaTR(game))

other_player = Players.VerboseComputer(game, a4q6.AlphaBetaTR(game))
# other_player = Players.HumanMenu(game)

# play the game
while not game.is_terminal(state):
    #show the board out of courtesy
    state.display()

    # ask the current player for a move
    choice = current_player.ask_move(state)

    print(game.actions(state))

    # check the move
예제 #4
0
# create the game, and the initial state
all = []
for i in range(1, 9):
    if i < 7:
        game = Game.Game(5, i)
        game1 = Game.Game(5, i)
    if i == 7:
        game = Game.Game(5, i - 1)
        game1 = Game.Game(5, 2)
    if i == 8:
        game = Game.Game(5, 2)
        game1 = Game.Game(5, 6)
    state = game.initial_state()

    # set up the players
    current_player = Players.VerboseComputer(game, A4Q3.AlphaBeta(game))
    #current_player = Players.HumanMenu(game)

    other_player = Players.VerboseComputer(game, A4Q3.AlphaBeta(game1))
    #other_player = Players.HumanMenu(game)

    # play the game
    while not game.is_terminal(state):
        #show the board out of courtesy
        #state.display()

        # ask the current player for a move
        choice = current_player.ask_move(state)
        # check the move
        if (choice == None):
            state.turn = 40