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
4040
4141$stepNumber = 1
4242$majorStepCount = 0
43+ $totalTurn = 0
4344do {
4445 $null = for ($stepNumber = 1 ; $stepNumber -le [Math ]::Abs($StepCount ); $stepNumber ++ ) {
4546 $null = $this.Forward ($side * $stepNumber )
4647 if ($LeftTurnSteps ) {
4748 if ($LeftTurnSteps -contains $stepNumber ) {
49+ $totalTurn -= $angle
4850 $this.Left ($angle )
4951 } else {
52+ $totalTurn += $angle
5053 $this.Right ($angle )
5154 }
5255 } else {
56+ $totalTurn += $angle
5357 $this.Right ($angle )
5458 }
5559 }
5660 $majorStepCount ++
5761} 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 )
6064)
6165
6266return $this
You can’t perform that action at this time.
0 commit comments