returns a randomly generated pipe
()
| 145 | return image_data, reward, terminal |
| 146 | |
| 147 | def 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 | |
| 163 | def showScore(score): |
no outgoing calls
no test coverage detected