Exemple #1
0
# AI Lab 2: Games and ConnectFour

from game_api import ConnectFourBoard
from toytree import *

# ------- PART I: CONNECTFOUR BOARDS
# Note: The tester uses some of these boards, so if you change them, tests may
# break.  However, feel free to copy these to make new boards of your own.

BOARD_UHOH = ConnectFourBoard(board_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, 2, 0, 0, 0),
    (0, 0, 2, 1, 0, 1, 1),
),
                              players=['Callie', 'English'],
                              whose_turn='Callie')

# NO-WIN GAME COMPLETELY FULL
BOARD_FULL_TIED = ConnectFourBoard(board_array=(
    (2, 2, 1, 2, 1, 1, 1),
    (1, 2, 1, 1, 2, 2, 2),
    (2, 1, 2, 1, 2, 1, 1),
    (2, 1, 1, 1, 2, 2, 2),
    (1, 2, 1, 2, 1, 2, 2),
    (1, 1, 2, 1, 2, 1, 2),
),
                                   players=['Weiss', 'Schwarz'],
                                   whose_turn='Schwarz')
Exemple #2
0
def decode_C4B(board_array, players, whose_turn, prev_move_string):
    board = ConnectFourBoard(board_array, players, whose_turn)
    board.prev_move_string = prev_move_string
    return board
Exemple #3
0
def decode_C4B(board_array, players, whose_turn, prev_move_string):
    board = ConnectFourBoard(board_array, players, whose_turn)
    board.prev_move_string = prev_move_string
    return board