コード例 #1
0
ファイル: test_cannon.py プロジェクト: ChrisBeaumont/codility
def check(a, b, expect):
    assert fire(a, b) == expect
コード例 #2
0
ファイル: test_cannon.py プロジェクト: ChrisBeaumont/codility
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)
コード例 #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)
コード例 #4
0
def check(a, b, expect):
    assert fire(a, b) == expect
コード例 #5
0
ファイル: manual_control.py プロジェクト: heidtn/LRFC
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)