MCPcopy Index your code
hub / github.com/python/cpython / step

Method step

Lib/turtledemo/planet_and_moon.py:57–63  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

55 a += (G*planet.m/abs(v)**3)*v
56 return a
57 def step(self):
58 dt = self.gravSys.dt
59 self.setpos(self.pos() + dt*self.v)
60 if self.gravSys.planets.index(self) != 0:
61 self.setheading(self.towards(self.gravSys.planets[0]))
62 self.a = self.acc()
63 self.v = self.v + dt*self.a
64
65## create compound yellow/blue turtleshape for planets
66

Callers 1

startMethod · 0.45

Calls 6

accMethod · 0.95
setheadingMethod · 0.80
towardsMethod · 0.80
setposMethod · 0.45
posMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected