diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-06 19:15:57 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-06 19:15:57 -0700 |
commit | eaeb955212eb3b133fd98d98457f17bfea8891d1 (patch) | |
tree | 4dbf20c0a79c460ea0ed129594670c58818a2dd4 /html/064random.cc.html | |
parent | 5d1699c2c75adc9670bf14404466c8056910b709 (diff) | |
download | mu-eaeb955212eb3b133fd98d98457f17bfea8891d1.tar.gz |
1949
Diffstat (limited to 'html/064random.cc.html')
-rw-r--r-- | html/064random.cc.html | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/html/064random.cc.html b/html/064random.cc.html index 5cfdf676..393ea7f8 100644 --- a/html/064random.cc.html +++ b/html/064random.cc.html @@ -17,6 +17,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } .Constant { color: #00a0a0; } .cSpecial { color: #008000; } .PreProc { color: #c000c0; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .Comment { color: #9090ff; } .Delimiter { color: #a04060; } .Special { color: #ff6060; } @@ -37,7 +38,7 @@ RANDOM<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_ordinal[<span class="Constant">"random"</span>] = RANDOM<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -case RANDOM: <span class="Delimiter">{</span> +<span class="Normal">case</span> RANDOM: <span class="Delimiter">{</span> <span class="Comment">// todo: limited range of numbers, might be imperfectly random</span> <span class="Comment">// todo: thread state in extra ingredients and products</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> @@ -50,7 +51,7 @@ MAKE_RANDOM_NONDETERMINISTIC<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_ordinal[<span class="Constant">"make-random-nondeterministic"</span>] = MAKE_RANDOM_NONDETERMINISTIC<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -case MAKE_RANDOM_NONDETERMINISTIC: <span class="Delimiter">{</span> +<span class="Normal">case</span> MAKE_RANDOM_NONDETERMINISTIC: <span class="Delimiter">{</span> srand<span class="Delimiter">(</span>time<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">));</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -60,12 +61,12 @@ ROUND<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_ordinal[<span class="Constant">"round"</span>] = ROUND<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -case ROUND: <span class="Delimiter">{</span> - if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">case</span> ROUND: <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'round' requires exactly one ingredient, but got "</span> << current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>!scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": first ingredient of 'round' should be a number, but got "</span> << current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> |