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/Board.html
CHANGED
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
|
|
95
95
|
<dl>
|
|
96
96
|
<dt>Defined in:</dt>
|
|
97
|
-
<dd>ext/chess.c<span class="defines">,<br />
|
|
98
|
-
ext/chess.c</span>
|
|
97
|
+
<dd>ext/chess/chess.c<span class="defines">,<br />
|
|
98
|
+
ext/chess/chess.c</span>
|
|
99
99
|
</dd>
|
|
100
100
|
</dl>
|
|
101
101
|
|
|
@@ -268,6 +268,30 @@
|
|
|
268
268
|
<p>Returns the fullmove number: the number of the full move.</p>
|
|
269
269
|
</div></span>
|
|
270
270
|
|
|
271
|
+
</li>
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
<li class="public ">
|
|
275
|
+
<span class="summary_signature">
|
|
276
|
+
|
|
277
|
+
<a href="#generate_all_moves-instance_method" title="#generate_all_moves (instance method)">#<strong>generate_all_moves</strong> ⇒ Array<String> </a>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
</span>
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
<span class="summary_desc"><div class='inline'>
|
|
292
|
+
<p>Generate all legal moves for the current board position.</p>
|
|
293
|
+
</div></span>
|
|
294
|
+
|
|
271
295
|
</li>
|
|
272
296
|
|
|
273
297
|
|
|
@@ -524,7 +548,7 @@
|
|
|
524
548
|
|
|
525
549
|
—
|
|
526
550
|
<div class='inline'>
|
|
527
|
-
<p>The square of the <span class='object_link'><a href="" title="Chess::Board (class)">Chess::Board</a></span>. Can be an integer between 0 and 63 or a string like
|
|
551
|
+
<p>The square of the <span class='object_link'><a href="" title="Chess::Board (class)">Chess::Board</a></span>. Can be an integer between 0 and 63 or a string like ‘a2’, ‘c5’…</p>
|
|
528
552
|
</div>
|
|
529
553
|
|
|
530
554
|
</li>
|
|
@@ -543,7 +567,7 @@
|
|
|
543
567
|
|
|
544
568
|
—
|
|
545
569
|
<div class='inline'>
|
|
546
|
-
<p>The symbol that identify the piece <em>(
|
|
570
|
+
<p>The symbol that identify the piece <em>(‘P’, ‘R’, ‘N’, ‘B’, ‘Q’, ‘K’)</em>. Upcase for a white piece, downcase for a black piece.</p>
|
|
547
571
|
</div>
|
|
548
572
|
|
|
549
573
|
</li>
|
|
@@ -577,7 +601,7 @@
|
|
|
577
601
|
461</pre>
|
|
578
602
|
</td>
|
|
579
603
|
<td>
|
|
580
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 446</span>
|
|
604
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 446</span>
|
|
581
605
|
|
|
582
606
|
VALUE
|
|
583
607
|
board_get_piece (VALUE self, VALUE square)
|
|
@@ -662,7 +686,7 @@ board_get_piece (VALUE self, VALUE square)
|
|
|
662
686
|
574</pre>
|
|
663
687
|
</td>
|
|
664
688
|
<td>
|
|
665
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 565</span>
|
|
689
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 565</span>
|
|
666
690
|
|
|
667
691
|
VALUE
|
|
668
692
|
board_active_color (VALUE self)
|
|
@@ -741,7 +765,7 @@ board_active_color (VALUE self)
|
|
|
741
765
|
477</pre>
|
|
742
766
|
</td>
|
|
743
767
|
<td>
|
|
744
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 468</span>
|
|
768
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 468</span>
|
|
745
769
|
|
|
746
770
|
VALUE
|
|
747
771
|
board_king_in_check (VALUE self)
|
|
@@ -820,7 +844,7 @@ board_king_in_check (VALUE self)
|
|
|
820
844
|
493</pre>
|
|
821
845
|
</td>
|
|
822
846
|
<td>
|
|
823
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 484</span>
|
|
847
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 484</span>
|
|
824
848
|
|
|
825
849
|
VALUE
|
|
826
850
|
board_king_in_checkmate (VALUE self)
|
|
@@ -899,7 +923,7 @@ board_king_in_checkmate (VALUE self)
|
|
|
899
923
|
557</pre>
|
|
900
924
|
</td>
|
|
901
925
|
<td>
|
|
902
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 548</span>
|
|
926
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 548</span>
|
|
903
927
|
|
|
904
928
|
VALUE
|
|
905
929
|
board_fifty_move_rule (VALUE self)
|
|
@@ -936,7 +960,7 @@ board_fifty_move_rule (VALUE self)
|
|
|
936
960
|
<div class="docstring">
|
|
937
961
|
<div class="discussion">
|
|
938
962
|
|
|
939
|
-
<p>Returns the fullmove number: the number of the full move. It starts at 1, and * is incremented after black
|
|
963
|
+
<p>Returns the fullmove number: the number of the full move. It starts at 1, and * is incremented after black’s move.</p>
|
|
940
964
|
|
|
941
965
|
|
|
942
966
|
</div>
|
|
@@ -975,7 +999,7 @@ board_fifty_move_rule (VALUE self)
|
|
|
975
999
|
603</pre>
|
|
976
1000
|
</td>
|
|
977
1001
|
<td>
|
|
978
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 597</span>
|
|
1002
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 597</span>
|
|
979
1003
|
|
|
980
1004
|
VALUE
|
|
981
1005
|
board_fullmove_number (VALUE self)
|
|
@@ -987,6 +1011,119 @@ board_fullmove_number (VALUE self)
|
|
|
987
1011
|
</td>
|
|
988
1012
|
</tr>
|
|
989
1013
|
</table>
|
|
1014
|
+
</div>
|
|
1015
|
+
|
|
1016
|
+
<div class="method_details ">
|
|
1017
|
+
<h3 class="signature " id="generate_all_moves-instance_method">
|
|
1018
|
+
|
|
1019
|
+
#<strong>generate_all_moves</strong> ⇒ <tt>Array<String></tt>
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
</h3><div class="docstring">
|
|
1026
|
+
<div class="discussion">
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
</div>
|
|
1030
|
+
</div>
|
|
1031
|
+
<div class="tags">
|
|
1032
|
+
|
|
1033
|
+
<div class="docstring">
|
|
1034
|
+
<div class="discussion">
|
|
1035
|
+
|
|
1036
|
+
<p>Generate all legal moves for the current board position.</p>
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
</div>
|
|
1040
|
+
</div>
|
|
1041
|
+
<div class="tags">
|
|
1042
|
+
|
|
1043
|
+
<div class="examples">
|
|
1044
|
+
<p class="tag_title">Examples:</p>
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
<pre class="example code"><code>:001 > g = Chess::Game.new
|
|
1048
|
+
=> #<Chess::Game:0x007f88a529fa88>
|
|
1049
|
+
:002 > g.board.generate_all_moves
|
|
1050
|
+
=> ["Na3", "Nc3", "Nf3", "Nh3", "a3", "a4", "b3", "b4", "c3", "c4", "d3", "d4", "e3", "e4", "f3", "f4", "g3", "g4", "h3", "h4"]</code></pre>
|
|
1051
|
+
|
|
1052
|
+
</div>
|
|
1053
|
+
|
|
1054
|
+
<p class="tag_title">Returns:</p>
|
|
1055
|
+
<ul class="return">
|
|
1056
|
+
|
|
1057
|
+
<li>
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
—
|
|
1065
|
+
<div class='inline'>
|
|
1066
|
+
<p>Returns all legal moves that can be performed in the current board position. The moves are in short algebraic chess notation format.</p>
|
|
1067
|
+
</div>
|
|
1068
|
+
|
|
1069
|
+
</li>
|
|
1070
|
+
|
|
1071
|
+
</ul>
|
|
1072
|
+
|
|
1073
|
+
</div>
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
</div><table class="source_code">
|
|
1077
|
+
<tr>
|
|
1078
|
+
<td>
|
|
1079
|
+
<pre class="lines">
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
655
|
|
1083
|
+
656
|
|
1084
|
+
657
|
|
1085
|
+
658
|
|
1086
|
+
659
|
|
1087
|
+
660
|
|
1088
|
+
661
|
|
1089
|
+
662
|
|
1090
|
+
663
|
|
1091
|
+
664
|
|
1092
|
+
665
|
|
1093
|
+
666
|
|
1094
|
+
667
|
|
1095
|
+
668
|
|
1096
|
+
669
|
|
1097
|
+
670
|
|
1098
|
+
671
|
|
1099
|
+
672
|
|
1100
|
+
673</pre>
|
|
1101
|
+
</td>
|
|
1102
|
+
<td>
|
|
1103
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 655</span>
|
|
1104
|
+
|
|
1105
|
+
VALUE
|
|
1106
|
+
board_generate_all_moves (VALUE self)
|
|
1107
|
+
{
|
|
1108
|
+
Board *board;
|
|
1109
|
+
Data_Get_Struct (self, Board, board);
|
|
1110
|
+
VALUE moves = rb_ary_new ();
|
|
1111
|
+
Board new_board;
|
|
1112
|
+
char *move_done;
|
|
1113
|
+
char capture;
|
|
1114
|
+
for (int i = 0; i < 64; i++)
|
|
1115
|
+
for (int j = 0; j < 64; j++)
|
|
1116
|
+
if (pseudo_legal_move (board, i, j))
|
|
1117
|
+
{
|
|
1118
|
+
move_done = castling (board, castling_type (board, i, j), &new_board);
|
|
1119
|
+
if (move_done || try_move (board, i, j, 'Q', &new_board, &move_done, &capture))
|
|
1120
|
+
rb_ary_push (moves, rb_str_new2 (move_done));
|
|
1121
|
+
}
|
|
1122
|
+
return moves;
|
|
1123
|
+
}</pre>
|
|
1124
|
+
</td>
|
|
1125
|
+
</tr>
|
|
1126
|
+
</table>
|
|
990
1127
|
</div>
|
|
991
1128
|
|
|
992
1129
|
<div class="method_details ">
|
|
@@ -1040,7 +1177,7 @@ board_fullmove_number (VALUE self)
|
|
|
1040
1177
|
|
|
1041
1178
|
—
|
|
1042
1179
|
<div class='inline'>
|
|
1043
|
-
<p>The square of the <span class='object_link'><a href="" title="Chess::Board (class)">Chess::Board</a></span>. Can be an integer between 0 and 63 or a string like
|
|
1180
|
+
<p>The square of the <span class='object_link'><a href="" title="Chess::Board (class)">Chess::Board</a></span>. Can be an integer between 0 and 63 or a string like ‘a2’, ‘c5’…</p>
|
|
1044
1181
|
</div>
|
|
1045
1182
|
|
|
1046
1183
|
</li>
|
|
@@ -1100,7 +1237,7 @@ board_fullmove_number (VALUE self)
|
|
|
1100
1237
|
641</pre>
|
|
1101
1238
|
</td>
|
|
1102
1239
|
<td>
|
|
1103
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 619</span>
|
|
1240
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 619</span>
|
|
1104
1241
|
|
|
1105
1242
|
VALUE
|
|
1106
1243
|
board_generate_moves (VALUE self, VALUE square)
|
|
@@ -1189,7 +1326,7 @@ board_generate_moves (VALUE self, VALUE square)
|
|
|
1189
1326
|
589</pre>
|
|
1190
1327
|
</td>
|
|
1191
1328
|
<td>
|
|
1192
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 583</span>
|
|
1329
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 583</span>
|
|
1193
1330
|
|
|
1194
1331
|
VALUE
|
|
1195
1332
|
board_halfmove_clock (VALUE self)
|
|
@@ -1265,7 +1402,7 @@ board_halfmove_clock (VALUE self)
|
|
|
1265
1402
|
525</pre>
|
|
1266
1403
|
</td>
|
|
1267
1404
|
<td>
|
|
1268
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 516</span>
|
|
1405
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 516</span>
|
|
1269
1406
|
|
|
1270
1407
|
VALUE
|
|
1271
1408
|
board_insufficient_material (VALUE self)
|
|
@@ -1344,7 +1481,7 @@ board_insufficient_material (VALUE self)
|
|
|
1344
1481
|
541</pre>
|
|
1345
1482
|
</td>
|
|
1346
1483
|
<td>
|
|
1347
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 532</span>
|
|
1484
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 532</span>
|
|
1348
1485
|
|
|
1349
1486
|
VALUE
|
|
1350
1487
|
board_only_kings (VALUE self)
|
|
@@ -1475,7 +1612,7 @@ board_only_kings (VALUE self)
|
|
|
1475
1612
|
421</pre>
|
|
1476
1613
|
</td>
|
|
1477
1614
|
<td>
|
|
1478
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 397</span>
|
|
1615
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 397</span>
|
|
1479
1616
|
|
|
1480
1617
|
VALUE
|
|
1481
1618
|
board_placement (VALUE self)
|
|
@@ -1569,7 +1706,7 @@ board_placement (VALUE self)
|
|
|
1569
1706
|
509</pre>
|
|
1570
1707
|
</td>
|
|
1571
1708
|
<td>
|
|
1572
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 500</span>
|
|
1709
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 500</span>
|
|
1573
1710
|
|
|
1574
1711
|
VALUE
|
|
1575
1712
|
board_stalemate (VALUE self)
|
|
@@ -1636,19 +1773,19 @@ board_stalemate (VALUE self)
|
|
|
1636
1773
|
<pre class="lines">
|
|
1637
1774
|
|
|
1638
1775
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1776
|
+
680
|
|
1777
|
+
681
|
|
1778
|
+
682
|
|
1779
|
+
683
|
|
1780
|
+
684
|
|
1781
|
+
685
|
|
1782
|
+
686
|
|
1783
|
+
687
|
|
1784
|
+
688
|
|
1785
|
+
689</pre>
|
|
1649
1786
|
</td>
|
|
1650
1787
|
<td>
|
|
1651
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line
|
|
1788
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 680</span>
|
|
1652
1789
|
|
|
1653
1790
|
VALUE
|
|
1654
1791
|
board_to_fen (VALUE self)
|
|
@@ -1715,19 +1852,19 @@ board_to_fen (VALUE self)
|
|
|
1715
1852
|
<pre class="lines">
|
|
1716
1853
|
|
|
1717
1854
|
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1855
|
+
696
|
|
1856
|
+
697
|
|
1857
|
+
698
|
|
1858
|
+
699
|
|
1859
|
+
700
|
|
1860
|
+
701
|
|
1861
|
+
702
|
|
1862
|
+
703
|
|
1863
|
+
704
|
|
1864
|
+
705</pre>
|
|
1728
1865
|
</td>
|
|
1729
1866
|
<td>
|
|
1730
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line
|
|
1867
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 696</span>
|
|
1731
1868
|
|
|
1732
1869
|
VALUE
|
|
1733
1870
|
board_to_s (VALUE self)
|
|
@@ -1749,9 +1886,9 @@ board_to_s (VALUE self)
|
|
|
1749
1886
|
</div>
|
|
1750
1887
|
|
|
1751
1888
|
<div id="footer">
|
|
1752
|
-
Generated on
|
|
1753
|
-
<a href="
|
|
1754
|
-
0.9.
|
|
1889
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
|
1890
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1891
|
+
0.9.36 (ruby-3.3.2).
|
|
1755
1892
|
</div>
|
|
1756
1893
|
|
|
1757
1894
|
</div>
|
data/docs/Chess/CGame.html
CHANGED
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
|
|
95
95
|
<dl>
|
|
96
96
|
<dt>Defined in:</dt>
|
|
97
|
-
<dd>ext/chess.c<span class="defines">,<br />
|
|
98
|
-
ext/chess.c</span>
|
|
97
|
+
<dd>ext/chess/chess.c<span class="defines">,<br />
|
|
98
|
+
ext/chess/chess.c</span>
|
|
99
99
|
</dd>
|
|
100
100
|
</dl>
|
|
101
101
|
|
|
@@ -389,7 +389,7 @@
|
|
|
389
389
|
|
|
390
390
|
|
|
391
391
|
<span class="summary_desc"><div class='inline'>
|
|
392
|
-
<p>The game result is set to
|
|
392
|
+
<p>The game result is set to ‘1-0’ if <code>color</code> is <em>black</em>, otherwise is set to ‘0-1’ if color is <em>white</em>.</p>
|
|
393
393
|
</div></span>
|
|
394
394
|
|
|
395
395
|
</li>
|
|
@@ -611,7 +611,7 @@
|
|
|
611
611
|
220</pre>
|
|
612
612
|
</td>
|
|
613
613
|
<td>
|
|
614
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 210</span>
|
|
614
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 210</span>
|
|
615
615
|
|
|
616
616
|
VALUE
|
|
617
617
|
game_boards (VALUE self, VALUE index)
|
|
@@ -691,7 +691,7 @@ game_boards (VALUE self, VALUE index)
|
|
|
691
691
|
267</pre>
|
|
692
692
|
</td>
|
|
693
693
|
<td>
|
|
694
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 258</span>
|
|
694
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 258</span>
|
|
695
695
|
|
|
696
696
|
VALUE
|
|
697
697
|
game_coord_moves (VALUE self)
|
|
@@ -771,7 +771,7 @@ game_coord_moves (VALUE self)
|
|
|
771
771
|
234</pre>
|
|
772
772
|
</td>
|
|
773
773
|
<td>
|
|
774
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 228</span>
|
|
774
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 228</span>
|
|
775
775
|
|
|
776
776
|
VALUE
|
|
777
777
|
game_current_board (VALUE self)
|
|
@@ -845,7 +845,7 @@ game_current_board (VALUE self)
|
|
|
845
845
|
202</pre>
|
|
846
846
|
</td>
|
|
847
847
|
<td>
|
|
848
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 195</span>
|
|
848
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 195</span>
|
|
849
849
|
|
|
850
850
|
VALUE
|
|
851
851
|
game_draw (VALUE self)
|
|
@@ -964,7 +964,7 @@ game_draw (VALUE self)
|
|
|
964
964
|
353</pre>
|
|
965
965
|
</td>
|
|
966
966
|
<td>
|
|
967
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 339</span>
|
|
967
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 339</span>
|
|
968
968
|
|
|
969
969
|
VALUE
|
|
970
970
|
game_each (VALUE self)
|
|
@@ -1032,7 +1032,7 @@ game_each (VALUE self)
|
|
|
1032
1032
|
278</pre>
|
|
1033
1033
|
</td>
|
|
1034
1034
|
<td>
|
|
1035
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 273</span>
|
|
1035
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 273</span>
|
|
1036
1036
|
|
|
1037
1037
|
VALUE
|
|
1038
1038
|
game_full_moves (VALUE self)
|
|
@@ -1093,7 +1093,7 @@ game_full_moves (VALUE self)
|
|
|
1093
1093
|
|
|
1094
1094
|
—
|
|
1095
1095
|
<div class='inline'>
|
|
1096
|
-
<p>The character of the moving piece <em>(
|
|
1096
|
+
<p>The character of the moving piece <em>(‘P’, ‘R’, ‘N’, ‘B’, ‘Q’, ‘K’)</em>.</p>
|
|
1097
1097
|
</div>
|
|
1098
1098
|
|
|
1099
1099
|
</li>
|
|
@@ -1109,13 +1109,13 @@ game_full_moves (VALUE self)
|
|
|
1109
1109
|
|
|
1110
1110
|
—
|
|
1111
1111
|
<div class='inline'>
|
|
1112
|
-
<p>When two (or more) identical pieces can move to the same square, the moving piece is uniquely identified by specifying the piece
|
|
1112
|
+
<p>When two (or more) identical pieces can move to the same square, the moving piece is uniquely identified by specifying the piece’s letter, followed by (in descending order of preference):</p>
|
|
1113
1113
|
<ul><li>
|
|
1114
1114
|
<p>the file of departure (if they differ);</p>
|
|
1115
1115
|
</li><li>
|
|
1116
1116
|
<p>the rank of departure (if the files are the same but the ranks differ);</p>
|
|
1117
1117
|
</li><li>
|
|
1118
|
-
<p>both the rank and file (if neither alone is sufficient to identify the
|
|
1118
|
+
<p>both the rank and file (if neither alone is sufficient to identify the piece—which occurs only in rare cases where one or more pawns have promoted, resulting in a player having three or more identical pieces able to reach the same square). Keep <code>nil</code> if no needed.</p>
|
|
1119
1119
|
</li></ul>
|
|
1120
1120
|
</div>
|
|
1121
1121
|
|
|
@@ -1132,7 +1132,7 @@ game_full_moves (VALUE self)
|
|
|
1132
1132
|
|
|
1133
1133
|
—
|
|
1134
1134
|
<div class='inline'>
|
|
1135
|
-
<p>The square where the moving piece will <em>(
|
|
1135
|
+
<p>The square where the moving piece will <em>(‘a1’, ‘a2’, … , ‘h7’, ‘h8’)</em>.</p>
|
|
1136
1136
|
</div>
|
|
1137
1137
|
|
|
1138
1138
|
</li>
|
|
@@ -1148,7 +1148,7 @@ game_full_moves (VALUE self)
|
|
|
1148
1148
|
|
|
1149
1149
|
—
|
|
1150
1150
|
<div class='inline'>
|
|
1151
|
-
<p>The character of promotion piece <em>(
|
|
1151
|
+
<p>The character of promotion piece <em>(‘R’, ‘N’, ‘B’, ‘Q’)</em>. If not <code>nil</code> and no promotion occured raise an <span class='object_link'><a href="IllegalMoveError.html" title="Chess::IllegalMoveError (class)">IllegalMoveError</a></span>. If <code>nil</code>, <em>‘Q’</em> is the default.</p>
|
|
1152
1152
|
</div>
|
|
1153
1153
|
|
|
1154
1154
|
</li>
|
|
@@ -1217,7 +1217,7 @@ game_full_moves (VALUE self)
|
|
|
1217
1217
|
89</pre>
|
|
1218
1218
|
</td>
|
|
1219
1219
|
<td>
|
|
1220
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 71</span>
|
|
1220
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 71</span>
|
|
1221
1221
|
|
|
1222
1222
|
VALUE
|
|
1223
1223
|
game_move (VALUE self, VALUE rb_piece, VALUE rb_disambiguating, VALUE rb_to_coord, VALUE rb_promote_in)
|
|
@@ -1291,7 +1291,7 @@ game_move (VALUE self, VALUE rb_piece, VALUE rb_disambiguating, VALUE rb_to_coor
|
|
|
1291
1291
|
|
|
1292
1292
|
—
|
|
1293
1293
|
<div class='inline'>
|
|
1294
|
-
<p>The 2 character string representing the starting square of the moving piece <em>(
|
|
1294
|
+
<p>The 2 character string representing the starting square of the moving piece <em>(‘a1’, ‘a2’, … , ‘h7’, ‘h8’)</em>.</p>
|
|
1295
1295
|
</div>
|
|
1296
1296
|
|
|
1297
1297
|
</li>
|
|
@@ -1307,7 +1307,7 @@ game_move (VALUE self, VALUE rb_piece, VALUE rb_disambiguating, VALUE rb_to_coor
|
|
|
1307
1307
|
|
|
1308
1308
|
—
|
|
1309
1309
|
<div class='inline'>
|
|
1310
|
-
<p>The 2 character string representing the ending square of the moving piece <em>(
|
|
1310
|
+
<p>The 2 character string representing the ending square of the moving piece <em>(‘a1’, ‘a2’, … , ‘h7’, ‘h8’)</em>.</p>
|
|
1311
1311
|
</div>
|
|
1312
1312
|
|
|
1313
1313
|
</li>
|
|
@@ -1323,7 +1323,7 @@ game_move (VALUE self, VALUE rb_piece, VALUE rb_disambiguating, VALUE rb_to_coor
|
|
|
1323
1323
|
|
|
1324
1324
|
—
|
|
1325
1325
|
<div class='inline'>
|
|
1326
|
-
<p>The character of promotion piece <em>(
|
|
1326
|
+
<p>The character of promotion piece <em>(‘R’, ‘N’, ‘B’, ‘Q’)</em>. If not <code>nil</code> and no promotion occured raise an <span class='object_link'><a href="IllegalMoveError.html" title="Chess::IllegalMoveError (class)">IllegalMoveError</a></span>. If <code>nil</code>, <em>‘Q’</em> is the default.</p>
|
|
1327
1327
|
</div>
|
|
1328
1328
|
|
|
1329
1329
|
</li>
|
|
@@ -1387,7 +1387,7 @@ game_move (VALUE self, VALUE rb_piece, VALUE rb_disambiguating, VALUE rb_to_coor
|
|
|
1387
1387
|
119</pre>
|
|
1388
1388
|
</td>
|
|
1389
1389
|
<td>
|
|
1390
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 106</span>
|
|
1390
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 106</span>
|
|
1391
1391
|
|
|
1392
1392
|
VALUE
|
|
1393
1393
|
game_move2 (VALUE self, VALUE rb_from, VALUE rb_to, VALUE rb_promote_in)
|
|
@@ -1500,7 +1500,7 @@ game_move2 (VALUE self, VALUE rb_from, VALUE rb_to, VALUE rb_promote_in)
|
|
|
1500
1500
|
|
|
1501
1501
|
—
|
|
1502
1502
|
<div class='inline'>
|
|
1503
|
-
<p>The character of promotion piece <em>(
|
|
1503
|
+
<p>The character of promotion piece <em>(‘R’, ‘N’, ‘B’, ‘Q’)</em>. If not <code>nil</code> and no promotion occured raise an <span class='object_link'><a href="IllegalMoveError.html" title="Chess::IllegalMoveError (class)">IllegalMoveError</a></span>. If <code>nil</code>, <em>‘Q’</em> is the default.</p>
|
|
1504
1504
|
</div>
|
|
1505
1505
|
|
|
1506
1506
|
</li>
|
|
@@ -1564,7 +1564,7 @@ game_move2 (VALUE self, VALUE rb_from, VALUE rb_to, VALUE rb_promote_in)
|
|
|
1564
1564
|
163</pre>
|
|
1565
1565
|
</td>
|
|
1566
1566
|
<td>
|
|
1567
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 150</span>
|
|
1567
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 150</span>
|
|
1568
1568
|
|
|
1569
1569
|
VALUE
|
|
1570
1570
|
game_move3 (VALUE self, VALUE rb_from, VALUE rb_to, VALUE rb_promote_in)
|
|
@@ -1647,7 +1647,7 @@ game_move3 (VALUE self, VALUE rb_from, VALUE rb_to, VALUE rb_promote_in)
|
|
|
1647
1647
|
250</pre>
|
|
1648
1648
|
</td>
|
|
1649
1649
|
<td>
|
|
1650
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 241</span>
|
|
1650
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 241</span>
|
|
1651
1651
|
|
|
1652
1652
|
VALUE
|
|
1653
1653
|
game_moves (VALUE self)
|
|
@@ -1684,7 +1684,7 @@ game_moves (VALUE self)
|
|
|
1684
1684
|
<div class="docstring">
|
|
1685
1685
|
<div class="discussion">
|
|
1686
1686
|
|
|
1687
|
-
<p>The game result is set to
|
|
1687
|
+
<p>The game result is set to ‘1-0’ if <code>color</code> is <em>black</em>, otherwise is set to ‘0-1’ if color is <em>white</em>.</p>
|
|
1688
1688
|
|
|
1689
1689
|
|
|
1690
1690
|
</div>
|
|
@@ -1752,7 +1752,7 @@ game_moves (VALUE self)
|
|
|
1752
1752
|
188</pre>
|
|
1753
1753
|
</td>
|
|
1754
1754
|
<td>
|
|
1755
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 173</span>
|
|
1755
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 173</span>
|
|
1756
1756
|
|
|
1757
1757
|
VALUE
|
|
1758
1758
|
game_resign (VALUE self, VALUE color)
|
|
@@ -1851,7 +1851,7 @@ game_resign (VALUE self, VALUE color)
|
|
|
1851
1851
|
315</pre>
|
|
1852
1852
|
</td>
|
|
1853
1853
|
<td>
|
|
1854
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 306</span>
|
|
1854
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 306</span>
|
|
1855
1855
|
|
|
1856
1856
|
VALUE
|
|
1857
1857
|
game_result (VALUE self)
|
|
@@ -1933,7 +1933,7 @@ game_result (VALUE self)
|
|
|
1933
1933
|
367</pre>
|
|
1934
1934
|
</td>
|
|
1935
1935
|
<td>
|
|
1936
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 360</span>
|
|
1936
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 360</span>
|
|
1937
1937
|
|
|
1938
1938
|
VALUE
|
|
1939
1939
|
game_rollback (VALUE self)
|
|
@@ -2033,7 +2033,7 @@ game_rollback (VALUE self)
|
|
|
2033
2033
|
43</pre>
|
|
2034
2034
|
</td>
|
|
2035
2035
|
<td>
|
|
2036
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 36</span>
|
|
2036
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 36</span>
|
|
2037
2037
|
|
|
2038
2038
|
VALUE
|
|
2039
2039
|
game_set_fen (VALUE self, VALUE fen)
|
|
@@ -2107,7 +2107,7 @@ game_set_fen (VALUE self, VALUE fen)
|
|
|
2107
2107
|
328</pre>
|
|
2108
2108
|
</td>
|
|
2109
2109
|
<td>
|
|
2110
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 322</span>
|
|
2110
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 322</span>
|
|
2111
2111
|
|
|
2112
2112
|
VALUE
|
|
2113
2113
|
game_size (VALUE self)
|
|
@@ -2183,7 +2183,7 @@ game_size (VALUE self)
|
|
|
2183
2183
|
294</pre>
|
|
2184
2184
|
</td>
|
|
2185
2185
|
<td>
|
|
2186
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 285</span>
|
|
2186
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 285</span>
|
|
2187
2187
|
|
|
2188
2188
|
VALUE
|
|
2189
2189
|
game_threefold_repetition (VALUE self)
|
|
@@ -2263,7 +2263,7 @@ game_threefold_repetition (VALUE self)
|
|
|
2263
2263
|
384</pre>
|
|
2264
2264
|
</td>
|
|
2265
2265
|
<td>
|
|
2266
|
-
<pre class="code"><span class="info file"># File 'ext/chess.c', line 374</span>
|
|
2266
|
+
<pre class="code"><span class="info file"># File 'ext/chess/chess.c', line 374</span>
|
|
2267
2267
|
|
|
2268
2268
|
VALUE
|
|
2269
2269
|
game_to_s (VALUE self)
|
|
@@ -2286,9 +2286,9 @@ game_to_s (VALUE self)
|
|
|
2286
2286
|
</div>
|
|
2287
2287
|
|
|
2288
2288
|
<div id="footer">
|
|
2289
|
-
Generated on
|
|
2290
|
-
<a href="
|
|
2291
|
-
0.9.
|
|
2289
|
+
Generated on Fri Aug 30 11:09:51 2024 by
|
|
2290
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
2291
|
+
0.9.36 (ruby-3.3.2).
|
|
2292
2292
|
</div>
|
|
2293
2293
|
|
|
2294
2294
|
</div>
|