Ejemplo n.º 1
0
def commands(gamestate: mechanics.GameState):

    while True:
        matched = gamestate.check_matches()
        display(gamestate)
        if matched:
            #display(gamestate)
            gamestate.update_gameboard()
            #display(gamestate)
            continue

        game_over = gamestate.check_game_over()
        if game_over:
            print('GAME OVER')
            break

        command = input()

        #try:
        if not command:
            faller.get_colors()
            gamestate.pass_time()
            gamestate.update_faller(faller)
            game_over = gamestate.check_game_over()
        elif command[0] == 'F':
            command = command.split()
            faller = mechanics.Faller()
            faller.new_faller(int(command[1]), command[2:])
            gamestate.update_faller(faller)
        elif command[0] == 'R':
            faller.rotate()
            gamestate.update_faller(faller)
        elif command[0] == '<':
            faller.move_left()
            gamestate.move_faller(faller)
            gamestate.update_faller(faller)
        elif command[0] == '>':
            faller.move_right()
            gamestate.move_faller(faller)
            gamestate.update_faller(faller)
        elif command[0] == 'Q':
            break
        else:
            print("OOP, SOMETHING AIN'T RIGHT")