chess 0.3.5 → 0.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5ebf213b0cfe5414754b1e1de84f9b27a958980c9da5e52b09301419a0f51a3
4
- data.tar.gz: b8d71f48aac60f4183d19c8d7407ee2c5d90ad591f734aeac8a49ce351989fa2
3
+ metadata.gz: d2ea2f6690d7433bf5c037b3f62bfa5fa84e18900e2e98b52f08a7330c6b5a0d
4
+ data.tar.gz: c79b608ef27aacce3d653cef25e7fa97e2661125e6ac99de3ddb13480b5124b3
5
5
  SHA512:
6
- metadata.gz: eca934b958eaae5a65d1b3cef8890a3093e27fa521ab73d9f0f70c11b18f7b1015fb3a0db9fbc528c5f2bcc101c4fb94db4a0b194020694972fd180e58581ad5
7
- data.tar.gz: d5aeec92185bbc74206839fea269ddb088ed24c8dcad1c0e1dee9f294ef6299bdc355333f9415b47616abd5e87518b7969b314b56fb93d53667e652148c998a6
6
+ metadata.gz: c173bb5fcb5f5192c12a606fd8dd5224abf7aee1441dca39ee3cfd408a78b5d9072cb7730602f8369dabd0419ba69149990c0a20fc9a69881f329dfeeac41116
7
+ data.tar.gz: 134fffef0ed8408c6e847fc3aef1a6fc65369d64671e4578460a1dfad706a509481dedeae1dbef7ae1a8bb5f4acfabb8b34e84bf6d04f5f1f609dd0f974a83bc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chess (0.3.5)
4
+ chess (0.3.6)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
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
- && (from == to - 7 || from == to - 9))
175
- return to - 8;
176
- else if (board->placement[from] == 'p' && to == board->en_passant
177
- && (from == to + 7 || from == to + 9))
178
- return to + 8;
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
@@ -1,5 +1,5 @@
1
1
  # The Chess library module.
2
2
  module Chess
3
3
  # The library version.
4
- VERSION = '0.3.5'.freeze
4
+ VERSION = '0.3.6'.freeze
5
5
  end
@@ -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.5
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-28 00:00:00.000000000 Z
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: