Skip to content

Commit 7764053

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.Push() ( Fixes #91 )
1 parent 44fa089 commit 7764053

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Turtle.types.ps1xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,20 @@ $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>Push</Name>
812+
<Script>
813+
if (-not $this.'.Stack') {
814+
$this | Add-Member NoteProperty '.Stack' ([Collections.Stack]::new()) -Force
815+
}
816+
817+
$this.'.Stack'.Push(@{
818+
Position = [Ordered]@{X=$this.Position.X;Y=$this.Position.Y}
819+
Heading = $this.Heading
820+
})
807821
return $this
808822
</Script>
809823
</ScriptMethod>

0 commit comments

Comments
 (0)