Thought Email List: space rocket design and manufacture From: rocket engineer 2 To: rocket engineer, rocket engineer 3 Subject: Re: running into an issue
i'm having trouble getting the rocket to launch, i don't know what i'm doing wrong here are my plans
I'll run it through the simulator and diagnose the problem. Thanks for the thorough repro case.
I patched some major issues and I think you'll like the result although it's not perfect. I might redesign the position tracking myself. --- rocket-2023-06-23.py 2023-06-23 13:17:54.401183017 -0400 +++ rocket-2023-06-23.2.py 2023-06-23 13:27:55.790239811 -0400 @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # space venture 2 -import sys +import sys, time import blessings class RocketShip: @@ -16,6 +16,7 @@ return self def launch(self): for pos in range(0, self.space): + time.sleep(0.3) self.position(pos) self.nose() self.body() @@ -25,13 +26,13 @@ def space(self): return self.material.height def position(self, altitude): - coords = self.material.move(self.space - altitude + self.head_room, 0) + coords = self.material.move(max(0,self.space - altitude - self.head_room), 0) self.material.stream.write(coords) self._altitude = altitude def _build_launch(self, plan): - if self._altitude > -self.head_room: + if self._altitude > -self.head_room and self._altitude <= self.space - self.head_room: self.material.stream.write(f'{plan}\n') - self._altitude -= 1 + self._altitude -= 1 def nose(self): self._build_launch(r''' ^ ''') self._build_launch(r''' / \ ''')