Exemplo n.º 1
0
def run_game(player_1, player_2, max_num_moves, board_size=5):
    board = Board(size=board_size)
    game = Game(board, player_1, player_2)
    moves = 0
    while (moves < max_num_moves):
        moves += 1
        if game.step() == 1:
            print("Game Over, {} Lost".format(game.loser))
            return "Loser: {}".format(game.loser)
        board_matrix, turn = board.get_board_config()
        print(board_matrix)
        print(" ")
Exemplo n.º 2
0
 def expander(board: Board) -> Iterable[Move]:
     return board.get_moves()
Exemplo n.º 3
0
 def detector(board: Board) -> bool:
     return board.solved()
Exemplo n.º 4
0
#!/usr/bin/env python
'''
    File name: Assign2.py
    Author: Siddhant Kumar
    Email: [email protected]
    Date created: 1 Oct 2017
    Date last modified: 1 Oct 2017
    Python Version: 3.0
'''

from framework import Board,Game,Player
import numpy as np
from MyPlayer import MyPlayer
from OtherPlayer import OtherPlayer
np.set_printoptions(suppress=True)


if __name__=='__main__':
    board = Board(size=5)
    player_1 = OtherPlayer() # Random player
    player_2 = MyPlayer() # MyPlayer

    game = Game(board,player_1,player_2)

    while (game.step()==0):
        board_matrix,turn = board.get_board_config()
        print(board_matrix)
        print(" ")

Exemplo n.º 5
0
'''
    File name: Assign2.py
    Author: Siddhant Kumar
    Email: [email protected]
    Date created: 1 Oct 2017
    Date last modified: 1 Oct 2017
    Python Version: 3.0
'''

from framework import Board, Game, Player
import numpy as np
from MyPlayer import MyPlayer
from OtherPlayer import OtherPlayer
import time
np.set_printoptions(suppress=True)

if __name__ == '__main__':

    board = Board(size=5)  #Board object
    # Random player
    player_1 = OtherPlayer()
    player_2 = MyPlayer()  # MyPlayer

    game = Game(board, player_1, player_2)

    while (game.step() == 0):

        board_matrix, turn = board.get_board_config()
        print(board_matrix)
        print(" ")