Skip to content

Commit ee0635d

Browse files
Merge branch 'turtles-in-shape' of https://github.com/PowerShellWeb/Turtle into turtles-in-shape
2 parents de9ff20 + 4b29a2f commit ee0635d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Turtle.types.ps1xml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,22 +473,31 @@ return $this
473473
Draws a flower pattern in turtle graphics.
474474

475475
This pattern consists of a series of polygons and rotations to create a flower-like design.
476+
.EXAMPLE
477+
turtle Flower 42
476478
.EXAMPLE
477-
$turtle = New-Turtle
478-
$turtle.Flower(100, 10, 5, 36)
479-
$turtle.Pattern.Save("$pwd/FlowerPattern.svg")
479+
turtle Flower 42 20 6 18
480480
.EXAMPLE
481-
Move-Turtle Flower |
482-
Save-Turtle ./FlowerSymbol.svg
481+
turtle Flower 42 20 6 18
482+
.EXAMPLE
483+
# We can make Flowers with partial polygons
484+
turtle Flower 42 20 6.6 18
485+
.EXAMPLE
486+
# They are surprisingly beautiful
487+
turtle Flower 42 30 7.7 12
483488
#>
484489
param(
490+
# The size of the base shape
485491
[double]$Size = 100,
492+
# The rotation after each step
486493
[double]$Rotation = 10,
494+
# The number of sides in each shape
487495
[double]$SideCount = 4,
488-
[double]$StepCount = 36
496+
# The number of steps in the flower.
497+
[int]$StepCount = 36
489498
)
490499

491-
$null = foreach ($n in 1..$StepCount) {
500+
$null = foreach ($n in 1..([Math]::Abs($StepCount))) {
492501
$this.Polygon($Size, $SideCount)
493502
$this.Rotate($Rotation)
494503
}

0 commit comments

Comments
 (0)