Skip to content

Commit 1501421

Browse files
docs: Turtle.LSystem improvement ( Fixes #116 )
Improving parameter docs and inner docs
1 parent 71ad086 commit 1501421

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Types/Turtle/LSystem.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,25 @@ F+F+F+F +JJJJ+ F+F+F+F ++ JJJJ' },
104104
105105
#>
106106
param(
107+
# The axiom, or starting string.
107108
[Alias('Start', 'StartString', 'Initiator')]
108109
[string]
109110
$Axiom,
110111

112+
# The rules for expanding each iteration of the axiom.
111113
[Alias('Rules', 'ProductionRules')]
112114
[Collections.IDictionary]
113115
$Rule = [Ordered]@{},
114116

117+
# The order of magnitude (or number of iterations)
115118
[Alias('Iterations', 'IterationCount', 'N', 'Steps', 'N','StepCount')]
116119
[int]
117120
$Order = 2,
118121

122+
# The ways each variable will be expanded.
119123
[Collections.IDictionary]
120124
$Variable = @{}
125+
121126
)
122127

123128
# First, let us expand our axiom
@@ -172,18 +177,24 @@ $allMatches = @([Regex]::Matches($finalState, $MatchesAny, 'IgnoreCase,IgnorePat
172177
$matchCache = @{}
173178
:nextMatch foreach ($match in $allMatches) {
174179
$m = "$match"
180+
# If we have not mapped the match to a script,
175181
if (-not $matchCache[$m]) {
182+
# find the matching replacement.
176183
foreach ($key in $Variable.Keys) {
177184
if (-not ($match -match $key)) { continue }
178185
$matchCache[$m] = $localReplacement[$key]
179186
break
180187
}
181188
}
182189

190+
# If we have a script to run
183191
if ($matchCache[$m] -is [ScriptBlock]) {
192+
# run it
184193
$null = . $matchCache[$m] $match
194+
# and continue to the next match.
185195
continue nextMatch
186196
}
187197
}
188198

199+
# return this so we can pipe and chain this method.
189200
return $this

0 commit comments

Comments
 (0)