Exemple #1
0
def validateScenario6():
    board = core.create_empty_board(3)
    board = core.add_move_to_board(board, core.Cell(row_id=1, col_id=1))
    board = core.add_move_to_board(board, core.Cell(row_id=0, col_id=0))
    board = core.add_move_to_board(board, core.Cell(row_id=1, col_id=0))
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=1, col_id=2))
Exemple #2
0
def validateScenario2():
    board = core.create_empty_board(3)
    board = core.add_move_to_board(board, core.Cell(0, 0))
    board = core.add_move_to_board(board, core.Cell(0, 1))
    board = core.add_move_to_board(board, core.Cell(1, 0))
    board = core.add_move_to_board(board, core.Cell(1, 1))
    board = core.add_move_to_board(board, core.Cell(1, 2))
    board = core.add_move_to_board(board, core.Cell(2, 0))
    board = core.add_move_to_board(board, core.Cell(2, 1))
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=0, col_id=2))
Exemple #3
0
def validateScenario9():
    board = core.create_empty_board(3)
    board = core.add_move_to_board(board, core.Cell(row_id=0, col_id=0))
    board = core.add_move_to_board(board, core.Cell(row_id=1, col_id=1))
    board = core.add_move_to_board(board, core.Cell(row_id=2, col_id=2))
    # 0--
    # -X-
    # --0
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=0, col_id=1))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # -X-
    # --0
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=2, col_id=1))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # -X-
    # -00
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=2, col_id=0))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # -X-
    # X00
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=0, col_id=2))
    board = core.add_move_to_board(board, ret)

    # 0X0
    # -X-
    # X00
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=1, col_id=2))
    board = core.add_move_to_board(board, ret)

    # 0X0
    # -XX
    # X00
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=1, col_id=0))
Exemple #4
0
def validateScenario10():
    board = core.create_empty_board(3)
    board = core.add_move_to_board(board, core.Cell(row_id=1, col_id=1))
    # ---
    # -X-
    # ---
    # Expected: Row = 0 & Col = 1
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=0, col_id=0))
    board = core.add_move_to_board(board, ret)

    # 0--
    # -X-
    # ---
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=0, col_id=1))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # -X-
    # ---
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=2, col_id=1))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # -X-
    # -0-
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=1, col_id=2))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # -XX
    # -0-
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=1, col_id=0))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # 0XX
    # -0-
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=2, col_id=0))
    board = core.add_move_to_board(board, ret)

    # 0X-
    # 0XX
    # X0-
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=0, col_id=2))
    board = core.add_move_to_board(board, ret)

    # 0X0
    # 0XX
    # X0-
    core.print_board(board)
    ret = testStrategy(board)
    validateCell(inspect.stack()[0][3], ret, core.Cell(row_id=2, col_id=2))
Exemple #5
0
def strategy(board):
    row = raw_input("Row? ")
    column = raw_input("Column? ")
    return core.Cell(row_id=int(row) - 1, col_id=int(column) - 1)