Skip to content

Commit a331987

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Lucky turtle and random defaults ( Fixes #363, Fixes #366 )
Randomizing sierpinski triangle, square, and star
1 parent 0998aa0 commit a331987

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Turtle.types.ps1xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,7 +2453,7 @@ return $this
24532453

24542454
$shapes = @(
24552455
"flower", "starflower", "goldenflower", 'triflower',
2456-
"arcygon", "polygon",
2456+
"arcygon", "polygon", 'star',
24572457
"square", "circle", "rectangle", 'righttriangle',
24582458
"sierpinskitriangle","sierpinskiarrowheadcurve",
24592459
"sierpinskicurve","sierpinskisquarecurve",
@@ -4115,8 +4115,8 @@ return $this.LSystem('X', [Ordered]@{
41154115
$turtle.Pattern.Save("$pwd/SierpinskiTriangle2.svg")
41164116
#>
41174117
param(
4118-
[double]$Size = 200,
4119-
[int]$Order = 2,
4118+
[double]$Size = (Get-Random -Min 42 -Max 84),
4119+
[int]$Order = $(Get-Random -Min 3 -Max 5),
41204120
[double]$Angle = 120
41214121
)
41224122
return $this.LSystem('F-G-G', [Ordered]@{
@@ -4593,7 +4593,17 @@ return $this
45934593
<ScriptMethod>
45944594
<Name>Square</Name>
45954595
<Script>
4596-
param([double]$Size = 50)
4596+
&lt;#
4597+
.SYNOPSIS
4598+
Draws a square
4599+
.DESCRIPTION
4600+
Draws a square using Turtle graphics
4601+
.EXAMPLE
4602+
turtle square 42
4603+
#&gt;
4604+
param(
4605+
[double]$Size = $(Get-Random -Min 21 -Max 42)
4606+
)
45974607
$null = foreach ($n in 1..4) {
45984608
$this.Forward($Size)
45994609
$this.Rotate(90)
@@ -4626,9 +4636,9 @@ return $this
46264636
#&gt;
46274637
param(
46284638
# The approximate size of the star
4629-
[double]$Size = 50,
4639+
[double]$Size = $(Get-Random -Min 21 -Max 42),
46304640
# The number of points in the star
4631-
[int]$Points = 6
4641+
[int]$Points = $(Get-Random -Min 5 -Max 7)
46324642
)
46334643

46344644
# To determine the angle, divide 360 by the number of points

0 commit comments

Comments
 (0)