chess 0.3.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +13 -15
- data/.gitignore +1 -1
- data/.rubocop.yml +2 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +108 -45
- data/README.md +3 -3
- data/chess.gemspec +1 -1
- 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/board.c +2 -2
- data/ext/chess/chess.c +33 -0
- data/ext/chess/chess.h +1 -0
- data/ext/chess/extconf.rb +1 -26
- data/ext/chess/game.c +10 -3
- data/lib/chess/game.rb +3 -3
- data/lib/chess/pgn.rb +9 -8
- data/lib/chess/version.rb +1 -1
- data/mise.toml +2 -0
- data/test/test_helper.rb +2 -4
- data/test/test_load_fen.rb +36 -0
- data/test/test_move_generator.rb +7 -0
- metadata +5 -7
data/docs/Chess/Game.html
CHANGED
|
@@ -467,13 +467,13 @@
|
|
|
467
467
|
<pre class="lines">
|
|
468
468
|
|
|
469
469
|
|
|
470
|
+
7
|
|
471
|
+
8
|
|
470
472
|
9
|
|
471
|
-
10
|
|
472
|
-
11
|
|
473
|
-
12</pre>
|
|
473
|
+
10</pre>
|
|
474
474
|
</td>
|
|
475
475
|
<td>
|
|
476
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
476
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 7</span>
|
|
477
477
|
|
|
478
478
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_moves'>moves</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
479
479
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
@@ -571,16 +571,16 @@
|
|
|
571
571
|
<pre class="lines">
|
|
572
572
|
|
|
573
573
|
|
|
574
|
+
40
|
|
575
|
+
41
|
|
574
576
|
42
|
|
575
577
|
43
|
|
576
578
|
44
|
|
577
579
|
45
|
|
578
|
-
46
|
|
579
|
-
47
|
|
580
|
-
48</pre>
|
|
580
|
+
46</pre>
|
|
581
581
|
</td>
|
|
582
582
|
<td>
|
|
583
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
583
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 40</span>
|
|
584
584
|
|
|
585
585
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_fen'>load_fen</span><span class='lparen'>(</span><span class='id identifier rubyid_fen'>fen</span><span class='rparen'>)</span>
|
|
586
586
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidFenFormatError.html" title="Chess::InvalidFenFormatError (class)">InvalidFenFormatError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="InvalidFenFormatError.html#initialize-instance_method" title="Chess::InvalidFenFormatError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_fen'>fen</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^((?:[PRNBQKprnbqk1-8]{1,8}\/){7}[RNBQKPrnbqkp1-8]{1,8})\s(w|b)\s(K?Q?k?q?|-)\s([a-h][1-8]|-)\s(\d+)\s(\d+)$</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_fen'>fen</span><span class='rparen'>)</span>
|
|
@@ -684,6 +684,8 @@
|
|
|
684
684
|
<pre class="lines">
|
|
685
685
|
|
|
686
686
|
|
|
687
|
+
18
|
|
688
|
+
19
|
|
687
689
|
20
|
|
688
690
|
21
|
|
689
691
|
22
|
|
@@ -697,12 +699,10 @@
|
|
|
697
699
|
30
|
|
698
700
|
31
|
|
699
701
|
32
|
|
700
|
-
33
|
|
701
|
-
34
|
|
702
|
-
35</pre>
|
|
702
|
+
33</pre>
|
|
703
703
|
</td>
|
|
704
704
|
<td>
|
|
705
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
705
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 18</span>
|
|
706
706
|
|
|
707
707
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_pgn'>load_pgn</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
|
|
708
708
|
<span class='id identifier rubyid_pgn'>pgn</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Chess.html" title="Chess (module)">Chess</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Pgn.html" title="Chess::Pgn (class)">Pgn</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pgn.html#initialize-instance_method" title="Chess::Pgn#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
|
|
@@ -770,12 +770,12 @@
|
|
|
770
770
|
<pre class="lines">
|
|
771
771
|
|
|
772
772
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
773
|
+
83
|
|
774
|
+
84
|
|
775
|
+
85</pre>
|
|
776
776
|
</td>
|
|
777
777
|
<td>
|
|
778
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
778
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 83</span>
|
|
779
779
|
|
|
780
780
|
<span class='kw'>def</span> <span class='id identifier rubyid_active_player'>active_player</span>
|
|
781
781
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board'>board</span><span class='period'>.</span><span class='id identifier rubyid_active_color'>active_color</span> <span class='op'>?</span> <span class='symbol'>:black</span> <span class='op'>:</span> <span class='symbol'>:white</span>
|
|
@@ -824,12 +824,12 @@
|
|
|
824
824
|
<pre class="lines">
|
|
825
825
|
|
|
826
826
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
827
|
+
90
|
|
828
|
+
91
|
|
829
|
+
92</pre>
|
|
830
830
|
</td>
|
|
831
831
|
<td>
|
|
832
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
832
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 90</span>
|
|
833
833
|
|
|
834
834
|
<span class='kw'>def</span> <span class='id identifier rubyid_inactive_player'>inactive_player</span>
|
|
835
835
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board'>board</span><span class='period'>.</span><span class='id identifier rubyid_active_color'>active_color</span> <span class='op'>?</span> <span class='symbol'>:white</span> <span class='op'>:</span> <span class='symbol'>:black</span>
|
|
@@ -883,7 +883,7 @@
|
|
|
883
883
|
|
|
884
884
|
—
|
|
885
885
|
<div class='inline'>
|
|
886
|
-
<p>Represents the short algebraic chess notation string of the move. <code>notation</code> can be also <em>from_square</em> plus <em>to_square</em> <em>(
|
|
886
|
+
<p>Represents the short algebraic chess notation string of the move. <code>notation</code> can be also <em>from_square</em> plus <em>to_square</em> <em>(‘e2e4’, …, ‘b1c3’)</em> (coordinate chess notation).</p>
|
|
887
887
|
</div>
|
|
888
888
|
|
|
889
889
|
</li>
|
|
@@ -947,6 +947,8 @@
|
|
|
947
947
|
<pre class="lines">
|
|
948
948
|
|
|
949
949
|
|
|
950
|
+
59
|
|
951
|
+
60
|
|
950
952
|
61
|
|
951
953
|
62
|
|
952
954
|
63
|
|
@@ -956,12 +958,10 @@
|
|
|
956
958
|
67
|
|
957
959
|
68
|
|
958
960
|
69
|
|
959
|
-
70
|
|
960
|
-
71
|
|
961
|
-
72</pre>
|
|
961
|
+
70</pre>
|
|
962
962
|
</td>
|
|
963
963
|
<td>
|
|
964
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
964
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 59</span>
|
|
965
965
|
|
|
966
966
|
<span class='kw'>def</span> <span class='id identifier rubyid_move'>move</span><span class='lparen'>(</span><span class='id identifier rubyid_notation'>notation</span><span class='rparen'>)</span>
|
|
967
967
|
<span class='id identifier rubyid_expand'>expand</span> <span class='op'>=</span> <span class='id identifier rubyid_expand_move'>expand_move</span><span class='lparen'>(</span><span class='id identifier rubyid_notation'>notation</span><span class='rparen'>)</span>
|
|
@@ -1026,12 +1026,12 @@
|
|
|
1026
1026
|
<pre class="lines">
|
|
1027
1027
|
|
|
1028
1028
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1029
|
+
76
|
|
1030
|
+
77
|
|
1031
|
+
78</pre>
|
|
1032
1032
|
</td>
|
|
1033
1033
|
<td>
|
|
1034
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
1034
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 76</span>
|
|
1035
1035
|
|
|
1036
1036
|
<span class='kw'>def</span> <span class='id identifier rubyid_moves='>moves=</span><span class='lparen'>(</span><span class='id identifier rubyid_moves'>moves</span><span class='rparen'>)</span>
|
|
1037
1037
|
<span class='id identifier rubyid_moves'>moves</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span> <span class='id identifier rubyid_move'>move</span><span class='lparen'>(</span><span class='id identifier rubyid_m'>m</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
@@ -1080,12 +1080,12 @@
|
|
|
1080
1080
|
<pre class="lines">
|
|
1081
1081
|
|
|
1082
1082
|
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1083
|
+
129
|
|
1084
|
+
130
|
|
1085
|
+
131</pre>
|
|
1086
1086
|
</td>
|
|
1087
1087
|
<td>
|
|
1088
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
1088
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 129</span>
|
|
1089
1089
|
|
|
1090
1090
|
<span class='kw'>def</span> <span class='id identifier rubyid_over?'>over?</span>
|
|
1091
1091
|
<span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>*</span><span class='tstring_end'>'</span></span>
|
|
@@ -1134,15 +1134,15 @@
|
|
|
1134
1134
|
<pre class="lines">
|
|
1135
1135
|
|
|
1136
1136
|
|
|
1137
|
+
135
|
|
1138
|
+
136
|
|
1137
1139
|
137
|
|
1138
1140
|
138
|
|
1139
1141
|
139
|
|
1140
|
-
140
|
|
1141
|
-
141
|
|
1142
|
-
142</pre>
|
|
1142
|
+
140</pre>
|
|
1143
1143
|
</td>
|
|
1144
1144
|
<td>
|
|
1145
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
1145
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 135</span>
|
|
1146
1146
|
|
|
1147
1147
|
<span class='kw'>def</span> <span class='id identifier rubyid_pgn'>pgn</span>
|
|
1148
1148
|
<span class='id identifier rubyid_pgn'>pgn</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Chess.html" title="Chess (module)">Chess</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Pgn.html" title="Chess::Pgn (class)">Pgn</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pgn.html#initialize-instance_method" title="Chess::Pgn#initialize (method)">new</a></span></span>
|
|
@@ -1213,6 +1213,8 @@
|
|
|
1213
1213
|
<pre class="lines">
|
|
1214
1214
|
|
|
1215
1215
|
|
|
1216
|
+
107
|
|
1217
|
+
108
|
|
1216
1218
|
109
|
|
1217
1219
|
110
|
|
1218
1220
|
111
|
|
@@ -1230,12 +1232,10 @@
|
|
|
1230
1232
|
123
|
|
1231
1233
|
124
|
|
1232
1234
|
125
|
|
1233
|
-
126
|
|
1234
|
-
127
|
|
1235
|
-
128</pre>
|
|
1235
|
+
126</pre>
|
|
1236
1236
|
</td>
|
|
1237
1237
|
<td>
|
|
1238
|
-
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line
|
|
1238
|
+
<pre class="code"><span class="info file"># File 'lib/chess/game.rb', line 107</span>
|
|
1239
1239
|
|
|
1240
1240
|
<span class='kw'>def</span> <span class='id identifier rubyid_status'>status</span>
|
|
1241
1241
|
<span class='kw'>case</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_result'>result</span>
|
|
@@ -1267,9 +1267,9 @@
|
|
|
1267
1267
|
</div>
|
|
1268
1268
|
|
|
1269
1269
|
<div id="footer">
|
|
1270
|
-
Generated on
|
|
1271
|
-
<a href="
|
|
1272
|
-
0.9.
|
|
1270
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
|
1271
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1272
|
+
0.9.36 (ruby-3.3.2).
|
|
1273
1273
|
</div>
|
|
1274
1274
|
|
|
1275
1275
|
</div>
|
data/docs/Chess/Gnuchess.html
CHANGED
|
@@ -356,9 +356,9 @@
|
|
|
356
356
|
</div>
|
|
357
357
|
|
|
358
358
|
<div id="footer">
|
|
359
|
-
Generated on
|
|
360
|
-
<a href="
|
|
361
|
-
0.9.
|
|
359
|
+
Generated on Fri Aug 30 11:09:50 2024 by
|
|
360
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
361
|
+
0.9.36 (ruby-3.3.2).
|
|
362
362
|
</div>
|
|
363
363
|
|
|
364
364
|
</div>
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
|
|
97
97
|
<dl>
|
|
98
98
|
<dt>Defined in:</dt>
|
|
99
|
-
<dd>ext/chess.c<span class="defines">,<br />
|
|
100
|
-
ext/chess.c</span>
|
|
99
|
+
<dd>ext/chess/chess.c<span class="defines">,<br />
|
|
100
|
+
ext/chess/chess.c</span>
|
|
101
101
|
</dd>
|
|
102
102
|
</dl>
|
|
103
103
|
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
</div>
|
|
128
128
|
|
|
129
129
|
<div id="footer">
|
|
130
|
-
Generated on
|
|
131
|
-
<a href="
|
|
132
|
-
0.9.
|
|
130
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
|
131
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
132
|
+
0.9.36 (ruby-3.3.2).
|
|
133
133
|
</div>
|
|
134
134
|
|
|
135
135
|
</div>
|
|
@@ -227,9 +227,9 @@
|
|
|
227
227
|
</div>
|
|
228
228
|
|
|
229
229
|
<div id="footer">
|
|
230
|
-
Generated on
|
|
231
|
-
<a href="
|
|
232
|
-
0.9.
|
|
230
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
|
231
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
232
|
+
0.9.36 (ruby-3.3.2).
|
|
233
233
|
</div>
|
|
234
234
|
|
|
235
235
|
</div>
|
|
@@ -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:51 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/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>
|