diff options
Diffstat (limited to 'html/chessboard.mu.html')
-rw-r--r-- | html/chessboard.mu.html | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index ba7e6443..e4c4b112 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -128,12 +128,12 @@ if ('onhashchange' in window) { <span id="L64" class="LineNr"> 64 </span> <span id="L65" class="LineNr"> 65 </span><span class="SalientComment">## Here's how 'chessboard' is implemented.</span> <span id="L66" class="LineNr"> 66 </span> -<span id="L67" class="LineNr"> 67 </span><span class="muData">type</span> board = &:@:&:@:char <span class="Comment"># a 2-D array of arrays of characters</span> +<span id="L67" class="LineNr"> 67 </span><span class="muData">type</span> <a href='chessboard.mu.html#L67'>board</a> = &:@:&:@:char <span class="Comment"># a 2-D array of arrays of characters</span> <span id="L68" class="LineNr"> 68 </span> <span id="L69" class="LineNr"> 69 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L69'>chessboard</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a> [ <span id="L70" class="LineNr"> 70 </span> <span class="Constant">local-scope</span> <span id="L71" class="LineNr"> 71 </span> <span class="Constant">load-ingredients</span> -<span id="L72" class="LineNr"> 72 </span> board:board <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> +<span id="L72" class="LineNr"> 72 </span> <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> <span id="L73" class="LineNr"> 73 </span> <span class="Comment"># hook up stdin</span> <span id="L74" class="LineNr"> 74 </span> stdin-in:&:<a href='075channel.mu.html#L43'>source</a>:char, stdin-out:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> <span id="L75" class="LineNr"> 75 </span> start-running <a href='084console.mu.html#L73'>send-keys-to-channel</a>, <a href='084console.mu.html#L23'>console</a>, stdin-out, <a href='081print.mu.html#L4'>screen</a> @@ -144,7 +144,7 @@ if ('onhashchange' in window) { <span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> print <a href='081print.mu.html#L4'>screen</a>, <span class="Constant">[Stupid text-mode chessboard. White pieces in uppercase; black pieces in lowercase. No checking for legal moves.</span> <span id="L81" class="LineNr"> 81 </span><span class="Constant">]</span> <span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L721'>cursor-to-next-line</a> <a href='081print.mu.html#L4'>screen</a> -<span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>, board +<span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>, <a href='chessboard.mu.html#L67'>board</a> <span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L721'>cursor-to-next-line</a> <a href='081print.mu.html#L4'>screen</a> <span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> print <a href='081print.mu.html#L4'>screen</a>, <span class="Constant">[Type in your <a href='chessboard.mu.html#L229'>move</a> as <from square>-<to square>. For example: 'a2-a4'. Then press <enter>.</span> <span id="L86" class="LineNr"> 86 </span><span class="Constant">]</span> @@ -159,7 +159,7 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> buffered-stdin-in <span class="Special"><-</span> <a href='075channel.mu.html#L161'>clear</a> buffered-stdin-in <span class="Comment"># cleanup after error. todo: test this?</span> <span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">loop-if</span> error <span id="L97" class="LineNr"> 97 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> board <span class="Special"><-</span> <a href='chessboard.mu.html#L537'>make-move</a> board, m +<span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> <a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L537'>make-move</a> <a href='chessboard.mu.html#L67'>board</a>, m <span id="L99" class="LineNr"> 99 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L33'>clear-screen</a> <a href='081print.mu.html#L4'>screen</a> <span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L101" class="LineNr">101 </span> <span class="Delimiter">}</span> @@ -168,7 +168,7 @@ if ('onhashchange' in window) { <span id="L104" class="LineNr">104 </span> <span id="L105" class="LineNr">105 </span><span class="SalientComment">## a board is an array of files, a file is an array of characters (squares)</span> <span id="L106" class="LineNr">106 </span> -<span id="L107" class="LineNr">107 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L107'>new-board</a> <a href='chessboard.mu.html#L180'>initial-position</a>:&:@:char<span class="muRecipe"> -> </span>board:board [ +<span id="L107" class="LineNr">107 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L107'>new-board</a> <a href='chessboard.mu.html#L180'>initial-position</a>:&:@:char<span class="muRecipe"> -> </span><a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> [ <span id="L108" class="LineNr">108 </span> <span class="Constant">local-scope</span> <span id="L109" class="LineNr">109 </span> <span class="Constant">load-ingredients</span> <span id="L110" class="LineNr">110 </span> <span class="Comment"># assert(length(initial-position) == 64)</span> @@ -176,7 +176,7 @@ if ('onhashchange' in window) { <span id="L112" class="LineNr">112 </span> correct-length?:bool <span class="Special"><-</span> equal len,<span class="Constant"> 64</span> <span id="L113" class="LineNr">113 </span> assert correct-length?, <span class="Constant">[chessboard had incorrect size]</span> <span id="L114" class="LineNr">114 </span> <span class="Comment"># board is an array of pointers to files; file is an array of characters</span> -<span id="L115" class="LineNr">115 </span> board <span class="Special"><-</span> new <span class="Delimiter">{</span>(address array character): type<span class="Delimiter">}</span>,<span class="Constant"> 8</span> +<span id="L115" class="LineNr">115 </span> <a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> new <span class="Delimiter">{</span>(address array character): type<span class="Delimiter">}</span>,<span class="Constant"> 8</span> <span id="L116" class="LineNr">116 </span> col:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L117" class="LineNr">117 </span> <span class="Delimiter">{</span> <span id="L118" class="LineNr">118 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> equal col,<span class="Constant"> 8</span> @@ -205,7 +205,7 @@ if ('onhashchange' in window) { <span id="L141" class="LineNr">141 </span> <span class="Delimiter">}</span> <span id="L142" class="LineNr">142 </span>] <span id="L143" class="LineNr">143 </span> -<span id="L144" class="LineNr">144 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, board:board<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L144" class="LineNr">144 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L145" class="LineNr">145 </span> <span class="Constant">local-scope</span> <span id="L146" class="LineNr">146 </span> <span class="Constant">load-ingredients</span> <span id="L147" class="LineNr">147 </span> row:num <span class="Special"><-</span> copy<span class="Constant"> 7</span> <span class="Comment"># start printing from the top of the board</span> @@ -241,7 +241,7 @@ if ('onhashchange' in window) { <span id="L177" class="LineNr">177 </span> <a href='081print.mu.html#L721'>cursor-to-next-line</a> <a href='081print.mu.html#L4'>screen</a> <span id="L178" class="LineNr">178 </span>] <span id="L179" class="LineNr">179 </span> -<span id="L180" class="LineNr">180 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L180'>initial-position</a><span class="muRecipe"> -> </span>board:board [ +<span id="L180" class="LineNr">180 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L180'>initial-position</a><span class="muRecipe"> -> </span><a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> [ <span id="L181" class="LineNr">181 </span> <span class="Constant">local-scope</span> <span id="L182" class="LineNr">182 </span> <span class="Comment"># layout in memory (in raster order):</span> <span id="L183" class="LineNr">183 </span> <span class="Comment"># R P _ _ _ _ p r</span> @@ -261,15 +261,15 @@ if ('onhashchange' in window) { <span id="L197" class="LineNr">197 </span><span class="CommentedCode">#? 66/B, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 98/b,</span> <span id="L198" class="LineNr">198 </span><span class="CommentedCode">#? 78/N, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 110/n,</span> <span id="L199" class="LineNr">199 </span><span class="CommentedCode">#? 82/R, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 114/r</span> -<span id="L200" class="LineNr">200 </span> board <span class="Special"><-</span> <a href='chessboard.mu.html#L107'>new-board</a> <a href='chessboard.mu.html#L180'>initial-position</a> +<span id="L200" class="LineNr">200 </span> <a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L107'>new-board</a> <a href='chessboard.mu.html#L180'>initial-position</a> <span id="L201" class="LineNr">201 </span>] <span id="L202" class="LineNr">202 </span> <span id="L203" class="LineNr">203 </span><span class="muScenario">scenario</span> printing-the-board [ <span id="L204" class="LineNr">204 </span> <span class="Constant">local-scope</span> -<span id="L205" class="LineNr">205 </span> board:board <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> +<span id="L205" class="LineNr">205 </span> <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> <span id="L206" class="LineNr">206 </span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">12/height</span> <span id="L207" class="LineNr">207 </span> run [ -<span id="L208" class="LineNr">208 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, board +<span id="L208" class="LineNr">208 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='chessboard.mu.html#L67'>board</a> <span id="L209" class="LineNr">209 </span> ] <span id="L210" class="LineNr">210 </span> screen-should-contain [ <span id="L211" class="LineNr">211 </span> <span class="Comment"># 012345678901234567890123456789</span> @@ -598,7 +598,7 @@ if ('onhashchange' in window) { <span id="L534" class="LineNr">534 </span> ] <span id="L535" class="LineNr">535 </span>] <span id="L536" class="LineNr">536 </span> -<span id="L537" class="LineNr">537 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L537'>make-move</a> board:board, m:&:<a href='chessboard.mu.html#L229'>move</a><span class="muRecipe"> -> </span>board:board [ +<span id="L537" class="LineNr">537 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L537'>make-move</a> <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a>, m:&:<a href='chessboard.mu.html#L229'>move</a><span class="muRecipe"> -> </span><a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> [ <span id="L538" class="LineNr">538 </span> <span class="Constant">local-scope</span> <span id="L539" class="LineNr">539 </span> <span class="Constant">load-ingredients</span> <span id="L540" class="LineNr">540 </span> from-file:num <span class="Special"><-</span> get *m, <span class="Constant">from-file:offset</span> @@ -615,12 +615,12 @@ if ('onhashchange' in window) { <span id="L551" class="LineNr">551 </span><span class="muScenario">scenario</span> making-a-move [ <span id="L552" class="LineNr">552 </span> <span class="Constant">local-scope</span> <span id="L553" class="LineNr">553 </span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">12/height</span> -<span id="L554" class="LineNr">554 </span> board:board <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> +<span id="L554" class="LineNr">554 </span> <a href='chessboard.mu.html#L67'>board</a>:<a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L180'>initial-position</a> <span id="L555" class="LineNr">555 </span> <a href='chessboard.mu.html#L229'>move</a>:&:<a href='chessboard.mu.html#L229'>move</a> <span class="Special"><-</span> new <span class="Constant"><a href='chessboard.mu.html#L229'>move</a>:type</span> <span id="L556" class="LineNr">556 </span> *move <span class="Special"><-</span> merge <span class="Constant">6/g</span>, <span class="Constant">1/'2'</span>, <span class="Constant">6/g</span>, <span class="Constant">3/'4'</span> <span id="L557" class="LineNr">557 </span> run [ -<span id="L558" class="LineNr">558 </span> <span class="Conceal">¦</span> board <span class="Special"><-</span> <a href='chessboard.mu.html#L537'>make-move</a> board, <a href='chessboard.mu.html#L229'>move</a> -<span id="L559" class="LineNr">559 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, board +<span id="L558" class="LineNr">558 </span> <span class="Conceal">¦</span> <a href='chessboard.mu.html#L67'>board</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L537'>make-move</a> <a href='chessboard.mu.html#L67'>board</a>, <a href='chessboard.mu.html#L229'>move</a> +<span id="L559" class="LineNr">559 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='chessboard.mu.html#L144'>print-board</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='chessboard.mu.html#L67'>board</a> <span id="L560" class="LineNr">560 </span> ] <span id="L561" class="LineNr">561 </span> screen-should-contain [ <span id="L562" class="LineNr">562 </span> <span class="Comment"># 012345678901234567890123456789</span> |