Пример #1
0
def main():
    print("Term Cube: Timer and Simulator")
    if len(sys.argv) <= 1:
        print("Run `termcube --help` to see how to skip these prompts")
        print()
        options = prompt_args()
    else:
        options = parser.parse_args()

    """Regarding the value of options.unofficial:
    if using a random state scramble, options.unofficial is None
    if using a random turn scramble of default length, options.unofficial is -1
    if using a random turn scramble with a specific length, option.unofficial is that length
    """
    if options.behaviour == 'timer':
        timer(options.dimension,
              options.inspection,
              options.using_tags,
              using_random_state = options.unofficial == None,
              scramble_length = options.unofficial if options.unofficial else -1)
    elif options.behaviour == 'simulator':
        simulator.simulate(options.dimension)
    elif options.behaviour == 'demo-kociemba':
        cube.demo_kociemba();
    elif options.behaviour == 'random-turns':
        cube.demo_random_turns(options.dimension)
    else:
        parser.print_help()
Пример #2
0
def main():
    print("Term Cube: Timer and Simulator")
    if len(sys.argv) <= 1:
        print("Run `termcube --help` to see how to skip these prompts")
        print()
        options = prompt_args()
    else:
        options = parser.parse_args()
    """Regarding the value of options.unofficial:
    if using a random state scramble, options.unofficial is None
    if using a random turn scramble of default length, options.unofficial is -1
    if using a random turn scramble with a specific length, option.unofficial is that length
    """
    if options.behaviour == 'timer':
        timer(options.dimension,
              options.inspection,
              options.using_tags,
              using_random_state=options.unofficial == None,
              scramble_length=options.unofficial if options.unofficial else -1)
    elif options.behaviour == 'simulator':
        simulator.simulate(options.dimension)
    elif options.behaviour == 'demo-kociemba':
        cube.demo_kociemba()
    elif options.behaviour == 'random-turns':
        cube.demo_random_turns(options.dimension)
    else:
        parser.print_help()
Пример #3
0
def main():
    print("Term Cube: Timer and Simulator")
    if len(sys.argv) <= 1:
        print("Run `termcube --help` to see how to skip these prompts")
        print()
        options = prompt_args()
    else:
        options = parser.parse_args()

    if options.puzzle.lower() == 'skewb':
        options.puzzle = skewb.Skewb()
    else:
        try:
            options.puzzle = cube.Cube(int(options.puzzle))
        except:
            print("Puzzle type %s not applicable. Exiting." % options.puzzle)
            sys.exit(0)
    
    """Regarding the value of options.unofficial:
    if using a random state scramble, options.unofficial is None
    if using a random turn scramble of default length, options.unofficial is -1
    if using a random turn scramble with a specific length, option.unofficial is that length
    """
    if options.behaviour == 'timer':
        timer(options.puzzle, 
              options.inspection, 
              random = options.unofficial == None,
              length = options.unofficial if options.unofficial else -1,
              nocurses = options.nocurses)
    elif options.behaviour == 'simulator':
        simulator.simulate(options.puzzle, options.nocurses)
    elif options.behaviour == 'demo-kociemba':
        print('Initializing...')
        with ScrambleGenerator(options.puzzle) as scrambler:
            while True:
                options.puzzle.apply(next(scrambler))
                print(options.puzzle)
                for t in TurnSequence(options.puzzle.solution()[0]):
                    options.puzzle.apply(t)
                    print(options.puzzle)
                    time.sleep(.1)
                time.sleep(1)
    elif options.behaviour == 'random-turns':
        while True:
            s = options.puzzle.random_turn()
            options.puzzle.apply(s)
            print(s)
            print(r)
            time.sleep(.5)
            if r.is_solved():
                break
        print('WOAH')
    else:
        parser.print_help()
Пример #4
0
def main():
    print("Term Cube: Timer and Simulator")
    if len(sys.argv) <= 1:
        print("Run `termcube --help` to see how to skip these prompts")
        print()
        options = prompt_args()
    else:
        options = parser.parse_args()

    if options.puzzle.lower() == 'skewb':
        options.puzzle = skewb.Skewb()
    else:
        try:
            options.puzzle = cube.Cube(int(options.puzzle))
        except:
            print("Puzzle type %s not applicable. Exiting." % options.puzzle)
            sys.exit(0)
    """Regarding the value of options.unofficial:
    if using a random state scramble, options.unofficial is None
    if using a random turn scramble of default length, options.unofficial is -1
    if using a random turn scramble with a specific length, option.unofficial is that length
    """
    if options.behaviour == 'timer':
        timer(options.puzzle,
              options.inspection,
              random=options.unofficial == None,
              length=options.unofficial if options.unofficial else -1,
              nocurses=options.nocurses)
    elif options.behaviour == 'simulator':
        simulator.simulate(options.puzzle, options.nocurses)
    elif options.behaviour == 'demo-kociemba':
        print('Initializing...')
        with ScrambleGenerator(options.puzzle) as scrambler:
            while True:
                options.puzzle.apply(next(scrambler))
                print(options.puzzle)
                for t in TurnSequence(options.puzzle.solution()[0]):
                    options.puzzle.apply(t)
                    print(options.puzzle)
                    time.sleep(.1)
                time.sleep(1)
    elif options.behaviour == 'random-turns':
        while True:
            s = options.puzzle.random_turn()
            options.puzzle.apply(s)
            print(s)
            print(r)
            time.sleep(.5)
            if r.is_solved():
                break
        print('WOAH')
    else:
        parser.print_help()