chess 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/ext/chess/special.c +6 -6
- data/lib/chess/version.rb +1 -1
- data/test/test_move_generator.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2ea2f6690d7433bf5c037b3f62bfa5fa84e18900e2e98b52f08a7330c6b5a0d
|
4
|
+
data.tar.gz: c79b608ef27aacce3d653cef25e7fa97e2661125e6ac99de3ddb13480b5124b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c173bb5fcb5f5192c12a606fd8dd5224abf7aee1441dca39ee3cfd408a78b5d9072cb7730602f8369dabd0419ba69149990c0a20fc9a69881f329dfeeac41116
|
7
|
+
data.tar.gz: 134fffef0ed8408c6e847fc3aef1a6fc65369d64671e4578460a1dfad706a509481dedeae1dbef7ae1a8bb5f4acfabb8b34e84bf6d04f5f1f609dd0f974a83bc
|
data/Gemfile.lock
CHANGED
data/ext/chess/special.c
CHANGED
@@ -170,12 +170,12 @@ update_en_passant (Board *board, int from, int to)
|
|
170
170
|
int
|
171
171
|
have_en_passant (Board *board, int from, int to)
|
172
172
|
{
|
173
|
-
if (board->placement[from] == 'P' && to == board->en_passant
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
173
|
+
if (board->placement[from] == 'P' && to == board->en_passant) {
|
174
|
+
return xray_attack_white_pawn(from) & (1ULL << to) ? to - 8 : 0;
|
175
|
+
}
|
176
|
+
if (board->placement[from] == 'p' && to == board->en_passant) {
|
177
|
+
return xray_attack_black_pawn(from) & (1ULL << to) ? to + 8 : 0;
|
178
|
+
}
|
179
179
|
return 0;
|
180
180
|
}
|
181
181
|
|
data/lib/chess/version.rb
CHANGED
data/test/test_move_generator.rb
CHANGED
@@ -26,4 +26,12 @@ class ChessTest < Minitest::Test
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
def test_github_issue32
|
31
|
+
game = Chess::Game.new
|
32
|
+
game.moves = %w[f2f4 d7d6 d2d3 h7h5 b1d2 e7e5 f4f5 a7a5 c2c3 d8f6 d2c4 b7b6 c4d2 a8a6 d2f3 a6a7 f3e5 b6b5 h2h4]
|
33
|
+
generated_moves = game.board.generate_moves('a5')
|
34
|
+
|
35
|
+
assert_equal %w[a4], generated_moves
|
36
|
+
end
|
29
37
|
end
|
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.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrico Pilotto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-29 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:
|