Exemplo n.º 1
0
        elif o == '-g':
            ghosts = a.split(',')
        elif o == '-a':
            ais = True
        elif o == '-c':
            shape = a
        elif o == '--filter':
            density = 0.01
            sigma = 1.
            threshold = 5.
        else:
            assert False, 'unhandled option'

    race = Race(n, shape, length, width)
    for name in ghosts:
        race.add_ghost(name)
    if ais:
        add_ai(race)
    if density:
        race.circuit.add_obstacles(density)
    if threshold or sigma:
        race.circuit.filter_obstacles(threshold, sigma) # , True)
    race.run()
    ask(race)

def ask(race):
    while 1:
        tmp = raw_input('R for replay, '+
                        'M for one more (just one..), '+
                        'Q to quit, '+
                        'S to save circuit ')