chess 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/chess.c +3 -3
- data/ext/special.c +10 -2
- data/lib/chess/version.rb +1 -1
- data/test/pgn_collection/fifty_move_rule/0001.pgn +1 -1
- data/test/pgn_collection/fifty_move_rule/0002.pgn +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 036423200a559f81a539922ce52bf8f295cbb3be
|
4
|
+
data.tar.gz: c484e257baa4fc021730ed8b843a9660b61ce9f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a3053a0d4a754bf9bb0b6ae1bcc778ae461d1d1801b3952a5ac7c46ad2f341ad633c52e40e0c6835083865dabc9a1fd2f6c13e4b1dddbddffa8540ea3a6b332
|
7
|
+
data.tar.gz: f10709ee4a4d97cd3e6c85ee793512523fb9c489cc65a7f0395b8712af2f842a2606b562ddc50e5b96943201f9f06b0c3950232d4f33cef553239755be2d93b0
|
data/ext/chess.c
CHANGED
@@ -55,7 +55,7 @@ game_set_fen (VALUE self, VALUE fen)
|
|
55
55
|
* 3. 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).
|
56
56
|
* Keep blank if no needed.
|
57
57
|
* +to_coord+:: the square where the moving piece will <em>('a1', 'a2', ... , 'h7', 'h8')</em>.
|
58
|
-
* +promote_in+:: the character of promotion piece <em>('R', 'N', 'B', 'Q')</em>. If no promotion occured, this param will be ignored.
|
58
|
+
* +promote_in+:: the character of promotion piece <em>('R', 'N', 'B', 'Q')</em>. If no promotion occured, this param will be ignored. If no value is passed, 'Q' is the default.
|
59
59
|
* This method returns a string that represents the short algebraic chess notation of the move or raise an IllegalMoveError if the move is illegal.
|
60
60
|
*/
|
61
61
|
VALUE
|
@@ -85,7 +85,7 @@ game_move (VALUE self, VALUE rb_piece, VALUE rb_disambiguating, VALUE rb_to_coor
|
|
85
85
|
* Parameters are:
|
86
86
|
* +from+:: the 2 character string representing the starting square of the moving piece <em>('a1', 'a2', ... , 'h7', 'h8')</em>.
|
87
87
|
* +to+:: the 2 character string representing the ending square of the moving piece <em>('a1', 'a2', ... , 'h7', 'h8')</em>.
|
88
|
-
* +promote_in+:: the character of promotion piece <em>('R', 'N', 'B', 'Q')</em>. If no promotion occured, this param will be ignored.
|
88
|
+
* +promote_in+:: the character of promotion piece <em>('R', 'N', 'B', 'Q')</em>. If no promotion occured, this param will be ignored. If no value is passed, 'Q' is the default.
|
89
89
|
* This method returns a string that represents the short algebraic chess notation of the move or raise an IllegalMoveError if the move is illegal.
|
90
90
|
*/
|
91
91
|
VALUE
|
@@ -122,7 +122,7 @@ game_move2 (VALUE self, VALUE rb_from, VALUE rb_to, VALUE rb_promote_in)
|
|
122
122
|
* Parameters are:
|
123
123
|
* +from+:: the integer representing the starting square of the moving piece.
|
124
124
|
* +to+:: the integer representing the ending square of the moving piece.
|
125
|
-
* +promote_in+:: the character of promotion piece <em>('R', 'N', 'B', 'Q')</em>. If no promotion occured, this param will be ignored.
|
125
|
+
* +promote_in+:: the character of promotion piece <em>('R', 'N', 'B', 'Q')</em>. If no promotion occured, this param will be ignored. If no value is passed, 'Q' is the default.
|
126
126
|
* This method returns a string that represents the short algebraic chess notation of the move or raise an IllegalMoveError if the move is illegal.
|
127
127
|
*/
|
128
128
|
VALUE
|
data/ext/special.c
CHANGED
@@ -179,9 +179,17 @@ bool
|
|
179
179
|
promote (Board *board, int square, char promote_in)
|
180
180
|
{
|
181
181
|
if (board->active_color)
|
182
|
-
|
182
|
+
{
|
183
|
+
promote_in = tolower (promote_in);
|
184
|
+
if (promote_in != 'r' && promote_in != 'n' && promote_in != 'b')
|
185
|
+
promote_in = 'q';
|
186
|
+
}
|
183
187
|
else
|
184
|
-
|
188
|
+
{
|
189
|
+
promote_in = toupper (promote_in);
|
190
|
+
if (promote_in != 'R' && promote_in != 'N' && promote_in != 'B')
|
191
|
+
promote_in = 'Q';
|
192
|
+
}
|
185
193
|
*(get_bitboard (board, square)) ^= 1ULL << square;
|
186
194
|
bboard *bb = get_piece_bitboard (board, promote_in);
|
187
195
|
if (!bb) return FALSE;
|
data/lib/chess/version.rb
CHANGED
@@ -16,7 +16,7 @@ Ke2 Rc2+ 40. Kf3 Rd3+ 41. Kg2 Ra3 42. Re8+ Kd4 43. a8=R Rxa8 44. Rxa8 Re2 45.
|
|
16
16
|
Kf3 Rb2 46. Re8 Rc2 47. Re1 g5 48. hxg5 hxg5 49. Rd1+ Kc5 50. Rb1 d4 51. g4
|
17
17
|
fxg4+ 52. Kxg4 d3 53. f3 Rf2 54. Re1 Re2 55. Rb1 Re5 56. Rb2 Re2 57. Rb1 Re3
|
18
18
|
58. Rb2 Kd4 59. Ra2 Re2 60. Ra4+ Ke3 61. Re4+ Kf2 62. Rc4 d2 63. Rd4 Ke1 64.
|
19
|
-
f4 gxf4 65. Kxf4 d1
|
19
|
+
f4 gxf4 65. Kxf4 d1 66. Rxd1+ Kxd1 67. Kf5 Kd2 68. Kf4 Kd3 69. Kf5 Kd4 70.
|
20
20
|
Kf4 Rf2+ 71. Kg4 Ke5 72. Kg3 Rd2 73. Kf3 Rd1 74. Ke3 Rc1 75. Kd3 Rf1 76. Ke3
|
21
21
|
Rd1 77. Ke2 Rb1 78. Kd3 Rc1 79. Kd2 Rb1 80. Kd3 Ra1 81. Kc4 Ra4+ 82. Kc5 Rd4
|
22
22
|
83. Kb5 Rd1 84. Kc4 Rf1 85. Kd3 Rf2 86. Kc4 Rc2+ 87. Kd3 Rc6 88. Ke3 Rc3+ 89.
|
@@ -17,7 +17,7 @@ Kc4 Be5 47. Ra3 Rf1 48. Rd3 Rc1+ 49. Kb3 Rf1 50. Kc4 Ke8 51. Kb3 Rf2 52. Kc4
|
|
17
17
|
Rc2+ 53. Kb3 Rc1 54. Rf3 Rd1 55. Kc4 Kd7 56. Kb3 Kc6 57. Kc4 b6 58. Ra3 Rd4+
|
18
18
|
59. Kc3 Rxh4+ 60. Kb3 Rh3 61. Rxa6 Rxg3+ 62. Kc2 Rc3+ 63. Kd2 h4 64. Rxb6+ Kd5
|
19
19
|
65. Rb7 h3 66. Rd7+ Kc6 67. Rxe7 h2 68. Rxe6+ Kd5 69. Rxe5+ Kxe5 70. Kxc3 Kd5
|
20
|
-
71. Kd3 g5 72. Ke3 g4 73. Kf4 g3 74. Kxg3
|
20
|
+
71. Kd3 g5 72. Ke3 g4 73. Kf4 g3 74. Kxg3 h1Q 75. b5 Qe1+ 76. Kf4 Qe4+ 77.
|
21
21
|
Kg5 Kxc5 78. b6 Kxb6 79. Kf6 Kc5 80. Kg5 Kd5 81. Kf6 Qe5+ 82. Kg6 Qe3 83. Kf5
|
22
22
|
Qd4 84. Kg5 Ke5 85. Kg6 Qg4+ 86. Kf7 Qe6+ 87. Kf8 Qc4 88. Ke7 Qc7+ 89. Ke8 Qc4
|
23
23
|
90. Ke7 Qd3 91. Kf7 Qd4 92. Kg6 Qc4 93. Kg5 Qf4+ 94. Kh5 Qc4 95. Kg5 Qd3 96.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrico Pilotto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A fast chess library that use bitboards to play chess with Ruby.
|
14
14
|
email:
|