コード例 #1
0
def main():
    game = userfunctions.start_game()
    while userfunctions.check_winner(game) is False:
        move = userfunctions.get_move()
        if move == 0:
            game = console_pop(game)
        elif move == 1:
            game = console_drop(game)
コード例 #2
0
def main():
    client = online.input_host()
    if client == None:
        print('FATAL ERROR: Failed to connect')
        return
    try:
        online.ics_connect(client)
    except ValueError:
        print('FATAL ERROR: Connection closed')
        return
    game = userfunctions.start_game()
    while userfunctions.check_winner(game) is False:
        try:
            game = user_move(game, client)
            if userfunctions.check_winner(game) is True:
                break
            game = server_move(game, client)
        except ValueError:
            print('FATAL ERROR: Connection closed')
            break

    online.close_client(client)