File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -40,23 +40,27 @@ $LeftTurnSteps
40
40
41
41
$stepNumber = 1
42
42
$majorStepCount = 0
43
+ $totalTurn = 0
43
44
do {
44
45
$null = for ($stepNumber = 1 ; $stepNumber -le [Math ]::Abs($StepCount ); $stepNumber ++ ) {
45
46
$null = $this.Forward ($side * $stepNumber )
46
47
if ($LeftTurnSteps ) {
47
48
if ($LeftTurnSteps -contains $stepNumber ) {
49
+ $totalTurn -= $angle
48
50
$this.Left ($angle )
49
51
} else {
52
+ $totalTurn += $angle
50
53
$this.Right ($angle )
51
54
}
52
55
} else {
56
+ $totalTurn += $angle
53
57
$this.Right ($angle )
54
58
}
55
59
}
56
60
$majorStepCount ++
57
61
} until (
58
- (-not ([Math ]::Round($this .Heading , 5 ) % 360 )) -or
59
- $majorStepCount -gt $StepCount
62
+ (-not ([Math ]::Round($totalTurn , 5 ) % 360 )) -and
63
+ $majorStepCount -le [ Math ]::Abs( $StepCount )
60
64
)
61
65
62
66
return $this
You can’t perform that action at this time.
0 commit comments