File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 9
9
# Draws a T shape by pushing and popping
10
10
turtle rotate -90 forward 42 push rotate 90 forward 21 pop rotate -90 forward 21 show
11
11
#>
12
- if ($this .' .Stack' -isnot [Collections.Stack ]) { return }
13
-
14
- if ($this .' .Stack' .Count -eq 0 ) { return }
12
+ param ()
15
13
14
+ # If the stack is not a stack, return ourself
15
+ if ($this .' .Stack' -isnot [Collections.Stack ]) { return $this }
16
+ # If the stack is empty, return ourself
17
+ if ($this .' .Stack' .Count -eq 0 ) { return $this }
18
+ # Pop the stack
16
19
$popped = $this .' .Stack' .Pop()
17
- $null = $this.PenUp ().Goto($popped.Position.X , $popped.Position.Y ).PenDown()
18
- $this.Heading = $popped.Heading
19
- return $this
20
+
21
+ $this . # Rotate by the differene in heading,
22
+ Rotate($popped.Heading - $this.Heading ).
23
+ # then teleport to the popped location
24
+ Teleport($popped.Position.X , $popped.Position.Y )
You can’t perform that action at this time.
0 commit comments