コード例 #1
0
def initGame(b_size, starter):
    #clearOutput()
    h = HexBoard(b_size)
    if starter == h.RED:
        h.maximizer = h.BLUE
        h.minimizer = h.RED
    else:
        h.maximizer = h.RED
        h.minimizer = h.BLUE
    return h
コード例 #2
0
def initGame():
    clearOutput()
    b_size = int(input("Enter the board size you want to play: "))
    h = HexBoard(b_size)
    ans = str(
        input("In order to start the game, please choose a side 'R' or 'B': ")
    ).lower()
    if ans == 'b':
        h.maximizer = h.RED
        h.minimizer = h.BLUE
    elif ans == 'r':
        h.maximizer = h.BLUE
        h.minimizer = h.RED
    else:
        print("You pressed a wrong key. Please type 'R' or 'B'.")
        print("Game is restarting!!!")
        time.sleep(2)
        h = initGame()
    return h