Skip to content

Commit 95d5890

Browse files
feat: Turtle.StepCurve ( Fixes #329 )
Always taking a step. Allowing negative random values
1 parent 8789238 commit 95d5890

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Types/Turtle/StepCurve.ps1

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@
88
#>
99
param(
1010
# The DeltaX
11-
[double]$DeltaX = $(Get-Random -Min 0 -Max 100.0),
11+
[double]$DeltaX = $(Get-Random -Min -100.0 -Max 100.0),
1212
# The DeltaY
13-
[double]$DeltaY = $(Get-Random -Min 0 -Max 100.0)
13+
[double]$DeltaY = $(Get-Random -Min -100.0 -Max 100.0)
1414
)
1515

16-
# If both coordinates are empty, there is no step
17-
if ($DeltaX -or $DeltaY) {
18-
19-
$this.Position = $DeltaX, $DeltaY
20-
if ($This.IsPenDown) {
21-
$this.Steps.Add(" t $deltaX $deltaY")
22-
} else {
23-
$this.Steps.Add(" m $DeltaX $DeltaY")
24-
}
16+
# If both coordinates are empty, we aren't going anywhere.
17+
# But we _might_ want a point to exist.
18+
$this.Position = $DeltaX, $DeltaY
19+
if ($This.IsPenDown) {
20+
$this.Steps.Add(" t $deltaX $deltaY")
21+
} else {
22+
$this.Steps.Add(" m $DeltaX $DeltaY")
2523
}
2624

2725
return $this

0 commit comments

Comments
 (0)