Skip to content

Commit 6049cb4

Browse files
author
James Brundage
committed
fix: Fixing Turtle method chaining ( Fixes #22 )
Avoiding multiple returns
1 parent 330c5df commit 6049cb4

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Types/Turtle/HilbertCurve.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ param(
33
[int]$Order = 5,
44
[double]$Angle = 90
55
)
6-
$this.L('A', @{
6+
7+
8+
return $this.L('A', @{
79
A = '+BF-AFA-FB+'
810
B = '-AF+BFB+FA-'
911
}, $Order, @{
1012
'F' = { $this.Forward($Size) }
1113
'\+' = { $this.Rotate($Angle) }
1214
'\-' = { $this.Rotate($Angle * -1) }
1315
})
14-
return $this

Types/Turtle/L.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ foreach ($iteration in 1..$n) {
3232
}
3333

3434
$finalState = $currentState
35-
foreach ($character in $finalState.ToCharArray()) {
35+
$null = foreach ($character in $finalState.ToCharArray()) {
3636
foreach ($key in $Variable.Keys) {
3737
if ($character -match $key) {
3838
$action = $Variable[$key]

Types/Turtle/SierpinskiTriangle.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ param(
33
[int]$Order = 2,
44
[double]$Angle = 120
55
)
6-
$this.L('F-G-G', [Ordered]@{
6+
return $this.L('F-G-G', [Ordered]@{
77
F = 'F-G+F+G-F'
88
G = 'GG'
99
}, $Order, [Ordered]@{
1010
'\+' = { $this.Rotate($Angle) }
1111
'-' = { $this.Rotate($Angle * -1) }
1212
'[FG]' = { $this.Forward($Size) }
1313
})
14-
return $this

Types/Turtle/Square.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
param([double]$Size = 50)
2-
foreach ($n in 1..4) {
2+
$null = foreach ($n in 1..4) {
33
$this.Forward($Size)
44
$this.Rotate(90)
55
}

0 commit comments

Comments
 (0)