|
6 | 6 | <atom:link href="http://raganwald.com/rss.xml" rel="self" type="application/rss+xml" /> |
7 | 7 | <description>Your Website</description> |
8 | 8 | <language>en-us</language> |
9 | | - <pubDate>Sun, 24 Mar 2013 20:04:54 -0400</pubDate> |
10 | | - <lastBuildDate>Sun, 24 Mar 2013 20:04:54 -0400</lastBuildDate> |
| 9 | + <pubDate>Sun, 24 Mar 2013 22:13:18 -0400</pubDate> |
| 10 | + <lastBuildDate>Sun, 24 Mar 2013 22:13:18 -0400</lastBuildDate> |
11 | 11 |
|
12 | 12 |
|
13 | 13 |
|
|
112 | 112 | ○○<br /> |
113 | 113 | ●●● </p> |
114 | 114 |
|
115 | | -<p>White still has a winning strategy: Take a single stone from the right of any row. It turns out that provided the game consists of one or more rows, where each row consist only of pebbles of the same colour, if one player has more pebbles than the other, that player always has a winning strategy.</p> |
| 115 | +<p>White still has a winning strategy: Take a single stone from the right of any row.</p> |
116 | 116 |
|
117 | | -<hr /> |
| 117 | +<p>Provided the game consists of one or more rows, where each row consist only of pebbles of the same colour, if one player has more pebbles than the other, that player always has a winning strategy.</p> |
118 | 118 |
|
119 | | -<p><strong>WARNING: THIS ESSAY IS A WORK IN PROGRESS</strong></p> |
| 119 | +<h3 id="maudes-simple-evaluator">maude’s simple evaluator</h3> |
| 120 | + |
| 121 | +<p>Maude started with the following notes:</p> |
| 122 | + |
| 123 | +<pre><code>{isArray, any} = require 'underscore' |
| 124 | + |
| 125 | +white = {} |
| 126 | +black = {} |
| 127 | + |
| 128 | +class HackenstringGame |
| 129 | + validRow = (row) -&gt; |
| 130 | + isArray(row) and every(row, (stone) -&gt; stone is white or stone is black) |
| 131 | + constructor: (@rows) -&gt; |
| 132 | + throw 'invalid' unless every(@rows, validRow) |
| 133 | + |
| 134 | +describe "HackenstringGame", -&gt; |
| 135 | + |
| 136 | + it "shouldn't throw an error for no rows", -&gt; |
| 137 | + expect( -&gt; new HackenStringGame([]) ).not.toThrow new Error('invalid') |
| 138 | +</code></pre> |
120 | 139 |
|
121 | 140 | <hr /> |
122 | 141 |
|
| 142 | +<p><strong>WARNING: THIS ESSAY IS A WORK IN PROGRESS</strong></p> |
| 143 | + |
123 | 144 | <p>notes:</p> |
124 | 145 | <div class="footnotes"> |
125 | 146 | <ol> |
|
0 commit comments