Ejemplo n.º 1
0
def check(a, b, expect):
    assert fire(a, b) == expect
Ejemplo n.º 2
0
def test_big():
    land_heights = [randint(0, 1000000) for _ in range(30000)]
    fire_heights = [randint(0, 1000000) for _ in range(30000)]
    fire(land_heights, fire_heights)
Ejemplo n.º 3
0
def test_big():
    land_heights = [randint(0, 1000000) for _ in range(30000)]
    fire_heights = [randint(0, 1000000) for _ in range(30000)]
    fire(land_heights, fire_heights)
Ejemplo n.º 4
0
def check(a, b, expect):
    assert fire(a, b) == expect
Ejemplo n.º 5
0
done = False
while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            done = True
        if event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
            state = 0
            if event.type == pygame.KEYDOWN: state = 1

            if event.key == pygame.K_UP:
                tilt_spd = state
            if event.key == pygame.K_DOWN:
                tilt_spd = -state
            if event.key == pygame.K_LEFT:
                pan_spd = -state
            if event.key == pygame.K_RIGHT:
                pan_spd = state
            if event.key == pygame.K_SPACE and state:
                cannon.fire()

            if event.key ==  pygame.K_ESCAPE:
                pygame.quit()
                done = True

    pan_angle += pan_spd
    tilt_angle += tilt_spd
    cannon.set_pan_tilt(pan_angle, tilt_angle)
    time.sleep(0.1)