MCPcopy
hub / github.com/yenchenlin/DeepLearningFlappyBird / getRandomPipe

Function getRandomPipe

game/wrapped_flappy_bird.py:147–160  ·  view source on GitHub ↗

returns a randomly generated pipe

()

Source from the content-addressed store, hash-verified

145 return image_data, reward, terminal
146
147def getRandomPipe():
148 """returns a randomly generated pipe"""
149 # y of gap between upper and lower pipe
150 gapYs = [20, 30, 40, 50, 60, 70, 80, 90]
151 index = random.randint(0, len(gapYs)-1)
152 gapY = gapYs[index]
153
154 gapY += int(BASEY * 0.2)
155 pipeX = SCREENWIDTH + 10
156
157 return [
158 {'x': pipeX, 'y': gapY - PIPE_HEIGHT}, # upper pipe
159 {'x': pipeX, 'y': gapY + PIPEGAPSIZE}, # lower pipe
160 ]
161
162
163def showScore(score):

Callers 2

__init__Method · 0.85
frame_stepMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected