chess 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +7 -12
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/docs/Chess/BadNotationError.html +3 -3
- data/docs/Chess/Board.html +180 -43
- data/docs/Chess/CGame.html +33 -33
- data/docs/Chess/Game.html +44 -44
- data/docs/Chess/Gnuchess.html +3 -3
- data/docs/Chess/IllegalMoveError.html +5 -5
- data/docs/Chess/InvalidFenFormatError.html +3 -3
- data/docs/Chess/InvalidPgnFormatError.html +3 -3
- data/docs/Chess/Pgn.html +8 -8
- data/docs/Chess/UTF8Notation.html +7 -7
- data/docs/Chess.html +5 -5
- data/docs/_index.html +3 -3
- data/docs/file.README.html +5 -5
- data/docs/frames.html +9 -4
- data/docs/index.html +5 -5
- data/docs/method_list.html +61 -53
- data/docs/top-level-namespace.html +3 -3
- data/ext/chess/chess.c +33 -0
- data/ext/chess/chess.h +1 -0
- data/ext/chess/extconf.rb +1 -26
- data/ext/chess/special.c +6 -6
- data/lib/chess/version.rb +1 -1
- data/test/test_move_generator.rb +15 -0
- metadata +2 -2
data/docs/Chess/Pgn.html
CHANGED
@@ -1179,7 +1179,7 @@
|
|
1179
1179
|
<pre class="code"><span class="info file"># File 'lib/chess/pgn.rb', line 51</span>
|
1180
1180
|
|
1181
1181
|
<span class='kw'>def</span> <span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='label'>check_moves:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1182
|
-
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier
|
1182
|
+
<span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
1183
1183
|
<span class='id identifier rubyid_load_from_string'>load_from_string</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='label'>check_moves:</span> <span class='id identifier rubyid_check_moves'>check_moves</span><span class='rparen'>)</span>
|
1184
1184
|
<span class='kw'>end</span></pre>
|
1185
1185
|
</td>
|
@@ -1316,7 +1316,7 @@
|
|
1316
1316
|
<span class='kw'>def</span> <span class='id identifier rubyid_load_from_string'>load_from_string</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='label'>check_moves:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1317
1317
|
<span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\{.*?\}</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'># remove comments
|
1318
1318
|
</span> <span class='const'><span class='object_link'><a href="#TAGS-constant" title="Chess::Pgn::TAGS (constant)">TAGS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
|
1319
|
-
<span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='
|
1319
|
+
<span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='symbol'>:"@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_t'>t</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span><span class='embexpr_end'>}</span><span class='tstring_content'> ".*"\]\s?$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='lbracket'>[</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>+</span> <span class='int'>3</span><span class='op'>..</span><span class='op'>-</span><span class='int'>3</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1320
1320
|
<span class='kw'>end</span>
|
1321
1321
|
<span class='ivar'>@result</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1/2-1/2</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='ivar'>@result</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1/2</span><span class='tstring_end'>'</span></span>
|
1322
1322
|
<span class='id identifier rubyid_game_index'>game_index</span> <span class='op'>=</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^1\.</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
@@ -1384,13 +1384,13 @@
|
|
1384
1384
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
1385
1385
|
<span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
1386
1386
|
<span class='const'><span class='object_link'><a href="#TAGS-constant" title="Chess::Pgn::TAGS (constant)">TAGS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
|
1387
|
-
<span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variable_defined?'>instance_variable_defined?</span><span class='lparen'>(</span><span class='
|
1387
|
+
<span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_variable_defined?'>instance_variable_defined?</span><span class='lparen'>(</span><span class='symbol'>:"@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_t'>t</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='symbol'>:"@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_t'>t</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
1388
1388
|
<span class='id identifier rubyid_s'>s</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span><span class='embexpr_end'>}</span><span class='tstring_content'> \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tag'>tag</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"]\n</span><span class='tstring_end'>"</span></span>
|
1389
1389
|
<span class='kw'>end</span>
|
1390
1390
|
<span class='id identifier rubyid_s'>s</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
1391
1391
|
<span class='id identifier rubyid_m'>m</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
1392
1392
|
<span class='ivar'>@moves</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_move'>move</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
1393
|
-
<span class='id identifier rubyid_m'>m</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span> <span class='op'>/</span> <span class='int'>2</span> <span class='op'>+</span> <span class='int'>1</span><span class='embexpr_end'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_even?'>even?</span>
|
1393
|
+
<span class='id identifier rubyid_m'>m</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span> <span class='op'>/</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span><span class='embexpr_end'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_even?'>even?</span>
|
1394
1394
|
<span class='id identifier rubyid_m'>m</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_move'>move</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span>
|
1395
1395
|
<span class='kw'>end</span>
|
1396
1396
|
<span class='id identifier rubyid_m'>m</span> <span class='op'><<</span> <span class='ivar'>@result</span> <span class='kw'>unless</span> <span class='ivar'>@result</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -1455,7 +1455,7 @@
|
|
1455
1455
|
<pre class="code"><span class="info file"># File 'lib/chess/pgn.rb', line 100</span>
|
1456
1456
|
|
1457
1457
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
1458
|
-
<span class='const'>File</span><span class='period'>.</span><span class='id identifier
|
1458
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
|
1459
1459
|
<span class='kw'>end</span></pre>
|
1460
1460
|
</td>
|
1461
1461
|
</tr>
|
@@ -1467,9 +1467,9 @@
|
|
1467
1467
|
</div>
|
1468
1468
|
|
1469
1469
|
<div id="footer">
|
1470
|
-
Generated on
|
1471
|
-
<a href="
|
1472
|
-
0.9.
|
1470
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
1471
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1472
|
+
0.9.36 (ruby-3.3.2).
|
1473
1473
|
</div>
|
1474
1474
|
|
1475
1475
|
</div>
|
@@ -240,12 +240,12 @@
|
|
240
240
|
<pre class="lines">
|
241
241
|
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
|
243
|
+
33
|
244
|
+
34
|
245
|
+
35</pre>
|
246
246
|
</td>
|
247
247
|
<td>
|
248
|
-
<pre class="code"><span class="info file"># File 'lib/chess/utf8_notation.rb', line
|
248
|
+
<pre class="code"><span class="info file"># File 'lib/chess/utf8_notation.rb', line 33</span>
|
249
249
|
|
250
250
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_utf8'>to_utf8</span>
|
251
251
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[PRNBQKprnbqk]</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#UTF8_MAP-constant" title="Chess::UTF8Notation::UTF8_MAP (constant)">UTF8_MAP</a></span></span><span class='rparen'>)</span>
|
@@ -260,9 +260,9 @@
|
|
260
260
|
</div>
|
261
261
|
|
262
262
|
<div id="footer">
|
263
|
-
Generated on
|
264
|
-
<a href="
|
265
|
-
0.9.
|
263
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
264
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
265
|
+
0.9.36 (ruby-3.3.2).
|
266
266
|
</div>
|
267
267
|
|
268
268
|
</div>
|
data/docs/Chess.html
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
<dl>
|
80
80
|
<dt>Defined in:</dt>
|
81
81
|
<dd>lib/chess/version.rb<span class="defines">,<br />
|
82
|
-
lib/chess/pgn.rb,<br /> lib/chess/game.rb,<br /> lib/chess/gnuchess.rb,<br /> lib/chess/exceptions.rb,<br /> lib/chess/utf8_notation.rb,<br /> ext/chess.c</span>
|
82
|
+
lib/chess/pgn.rb,<br /> lib/chess/game.rb,<br /> lib/chess/gnuchess.rb,<br /> lib/chess/exceptions.rb,<br /> lib/chess/utf8_notation.rb,<br /> ext/chess/chess.c</span>
|
83
83
|
</dd>
|
84
84
|
</dl>
|
85
85
|
|
@@ -131,7 +131,7 @@
|
|
131
131
|
|
132
132
|
</div>
|
133
133
|
</dt>
|
134
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.3.
|
134
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.3.6</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
135
135
|
|
136
136
|
</dl>
|
137
137
|
|
@@ -147,9 +147,9 @@
|
|
147
147
|
</div>
|
148
148
|
|
149
149
|
<div id="footer">
|
150
|
-
Generated on
|
151
|
-
<a href="
|
152
|
-
0.9.
|
150
|
+
Generated on Fri Aug 30 11:09:50 2024 by
|
151
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
152
|
+
0.9.36 (ruby-3.3.2).
|
153
153
|
</div>
|
154
154
|
|
155
155
|
</div>
|
data/docs/_index.html
CHANGED
@@ -207,9 +207,9 @@
|
|
207
207
|
</div>
|
208
208
|
|
209
209
|
<div id="footer">
|
210
|
-
Generated on
|
211
|
-
<a href="
|
212
|
-
0.9.
|
210
|
+
Generated on Fri Aug 30 11:09:50 2024 by
|
211
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
212
|
+
0.9.36 (ruby-3.3.2).
|
213
213
|
</div>
|
214
214
|
|
215
215
|
</div>
|
data/docs/file.README.html
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_g'>g</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span>
|
95
95
|
</code></pre>
|
96
96
|
|
97
|
-
<p
|
97
|
+
<p>📚 <strong>Documentation</strong> is available <a href="https://pioz.github.io/chess">here</a>.</p>
|
98
98
|
|
99
99
|
<h2 id="label-Questions+or+problems-3F">Questions or problems?</h2>
|
100
100
|
|
@@ -102,13 +102,13 @@
|
|
102
102
|
|
103
103
|
<h2 id="label-Copyright">Copyright</h2>
|
104
104
|
|
105
|
-
<p>Copyright ©
|
105
|
+
<p>Copyright © 2024 <a href="https://github.com/pioz">Enrico Pilotto (@pioz)</a>. See <a href="https://github.com/pioz/chess/blob/master/LICENSE">LICENSE</a> for details.</p>
|
106
106
|
</div></div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
110
|
-
<a href="
|
111
|
-
0.9.
|
109
|
+
Generated on Fri Aug 30 11:09:50 2024 by
|
110
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
+
0.9.36 (ruby-3.3.2).
|
112
112
|
</div>
|
113
113
|
|
114
114
|
</div>
|
data/docs/frames.html
CHANGED
@@ -5,10 +5,15 @@
|
|
5
5
|
<title>Chess</title>
|
6
6
|
</head>
|
7
7
|
<script type="text/javascript">
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
var mainUrl = 'index.html';
|
9
|
+
try {
|
10
|
+
var match = decodeURIComponent(window.location.hash).match(/^#!(.+)/);
|
11
|
+
var name = match ? match[1] : mainUrl;
|
12
|
+
var url = new URL(name, location.href);
|
13
|
+
window.top.location.replace(url.origin === location.origin ? name : mainUrl);
|
14
|
+
} catch (e) {
|
15
|
+
window.top.location.replace(mainUrl);
|
16
|
+
}
|
12
17
|
</script>
|
13
18
|
<noscript>
|
14
19
|
<h1>Oops!</h1>
|
data/docs/index.html
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_g'>g</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span>
|
95
95
|
</code></pre>
|
96
96
|
|
97
|
-
<p
|
97
|
+
<p>📚 <strong>Documentation</strong> is available <a href="https://pioz.github.io/chess">here</a>.</p>
|
98
98
|
|
99
99
|
<h2 id="label-Questions+or+problems-3F">Questions or problems?</h2>
|
100
100
|
|
@@ -102,13 +102,13 @@
|
|
102
102
|
|
103
103
|
<h2 id="label-Copyright">Copyright</h2>
|
104
104
|
|
105
|
-
<p>Copyright ©
|
105
|
+
<p>Copyright © 2024 <a href="https://github.com/pioz">Enrico Pilotto (@pioz)</a>. See <a href="https://github.com/pioz/chess/blob/master/LICENSE">LICENSE</a> for details.</p>
|
106
106
|
</div></div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
110
|
-
<a href="
|
111
|
-
0.9.
|
109
|
+
Generated on Fri Aug 30 11:09:50 2024 by
|
110
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
+
0.9.36 (ruby-3.3.2).
|
112
112
|
</div>
|
113
113
|
|
114
114
|
</div>
|