Skip to content

Commit 1f8492e

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.Pop() ( Fixes #92 )
1 parent a05d068 commit 1f8492e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Turtle.types.ps1xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,23 @@ $null = foreach ($n in 1..$SideCount) {
804804
$this.Forward($Size)
805805
$this.Rotate(360 / $SideCount)
806806
}
807+
return $this
808+
</Script>
809+
</ScriptMethod>
810+
<ScriptMethod>
811+
<Name>Pop</Name>
812+
<Script>
813+
if ($this.'.Stack' -isnot [Collections.Stack]) {
814+
return
815+
}
816+
817+
if ($this.'.Stack'.Count -eq 0) {
818+
return
819+
}
820+
821+
$popped = $this.'.Stack'.Pop()
822+
$this.PenUp().Goto($popped.Position.X, $popped.Position.Y).PenDown()
823+
$this.Heading = $popped.Heading
807824
return $this
808825
</Script>
809826
</ScriptMethod>

0 commit comments

Comments
 (0)