Skip to content

Commit d47d10b

Browse files
fix: Fractal Plant improvement ( Fixes #271 )
2 parents 34743fc + 8a3ab57 commit d47d10b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Turtle.types.ps1xml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,14 +2528,20 @@ return $this.Rotate((360 / $SideCount) * $remainder).Forward($remainder * $Size)
25282528
# Draws a T shape by pushing and popping
25292529
turtle rotate -90 forward 42 push rotate 90 forward 21 pop rotate -90 forward 21 show
25302530
#>
2531-
if ($this.'.Stack' -isnot [Collections.Stack]) { return }
2532-
2533-
if ($this.'.Stack'.Count -eq 0) { return }
2531+
param()
25342532

2533+
# If the stack is not a stack, return ourself
2534+
if ($this.'.Stack' -isnot [Collections.Stack]) { return $this }
2535+
# If the stack is empty, return ourself
2536+
if ($this.'.Stack'.Count -eq 0) { return $this }
2537+
# Pop the stack
25352538
$popped = $this.'.Stack'.Pop()
2536-
$null = $this.PenUp().Goto($popped.Position.X, $popped.Position.Y).PenDown()
2537-
$this.Heading = $popped.Heading
2538-
return $this
2539+
2540+
$this. # Rotate by the differene in heading,
2541+
Rotate($popped.Heading - $this.Heading).
2542+
# then teleport to the popped location
2543+
Teleport($popped.Position.X, $popped.Position.Y)
2544+
25392545
</Script>
25402546
</ScriptMethod>
25412547
<ScriptMethod>

0 commit comments

Comments
 (0)