chess 0.3.0 → 0.3.3

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +12 -0
  3. data/.github/workflows/ruby.yml +58 -0
  4. data/.gitignore +3 -2
  5. data/.rubocop.yml +10 -142
  6. data/Gemfile.lock +74 -0
  7. data/README.md +26 -22
  8. data/Rakefile +2 -1
  9. data/chess.gemspec +11 -7
  10. data/docs/Chess/BadNotationError.html +237 -0
  11. data/docs/Chess/Board.html +1759 -0
  12. data/docs/Chess/CGame.html +2296 -0
  13. data/docs/Chess/Game.html +1277 -0
  14. data/docs/Chess/Gnuchess.html +366 -0
  15. data/docs/Chess/IllegalMoveError.html +137 -0
  16. data/docs/Chess/InvalidFenFormatError.html +237 -0
  17. data/docs/Chess/InvalidPgnFormatError.html +217 -0
  18. data/docs/Chess/Pgn.html +1477 -0
  19. data/docs/Chess/UTF8Notation.html +270 -0
  20. data/docs/Chess.html +157 -0
  21. data/docs/_index.html +217 -0
  22. data/docs/class_list.html +51 -0
  23. data/docs/css/common.css +1 -0
  24. data/docs/css/full_list.css +58 -0
  25. data/docs/css/style.css +497 -0
  26. data/docs/file.README.html +116 -0
  27. data/docs/file_list.html +56 -0
  28. data/docs/frames.html +17 -0
  29. data/docs/index.html +116 -0
  30. data/docs/js/app.js +314 -0
  31. data/docs/js/full_list.js +216 -0
  32. data/docs/js/jquery.js +4 -0
  33. data/docs/method_list.html +531 -0
  34. data/docs/top-level-namespace.html +110 -0
  35. data/ext/chess.c +1 -1
  36. data/ext/common.h +7 -3
  37. data/ext/extconf.rb +1 -1
  38. data/lib/chess/game.rb +68 -66
  39. data/lib/chess/gnuchess.rb +49 -53
  40. data/lib/chess/pgn.rb +13 -15
  41. data/lib/chess/version.rb +1 -1
  42. data/test/test_big_pgn_collection.rb +1 -1
  43. data/test/test_checkmate.rb +4 -4
  44. data/test/test_errors.rb +22 -0
  45. data/test/test_fifty_rule_move.rb +2 -2
  46. data/test/test_game.rb +82 -0
  47. data/test/test_helper.rb +15 -0
  48. data/test/test_insufficient_material.rb +4 -4
  49. data/test/test_move_generator.rb +3 -2
  50. data/test/test_pgn.rb +35 -0
  51. data/test/test_pgn_collection.rb +2 -2
  52. data/test/test_stalemate.rb +1 -1
  53. data/test/test_threefold_repetition.rb +1 -1
  54. data/test/test_uci_castling.rb +34 -0
  55. metadata +118 -1236
@@ -7,7 +7,7 @@ class ChessTest < Minitest::Test
7
7
  pgn = Chess::Pgn.new(file)
8
8
  game = Chess::Game.new(pgn.moves)
9
9
  assert(game.board.stalemate?)
10
- assert_equal(game.result, '1/2-1/2')
10
+ assert_equal('1/2-1/2', game.result)
11
11
  end
12
12
  end
13
13
  end
@@ -6,7 +6,7 @@ class ChessTest < Minitest::Test
6
6
  define_method "test_threefold_repetition_#{name}" do
7
7
  pgn = Chess::Pgn.new(file)
8
8
  game = Chess::Game.new(pgn.moves)
9
- assert(game.threefold_repetition?)
9
+ assert game.threefold_repetition?
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,34 @@
1
+ require 'test_helper'
2
+
3
+ class UCICastrlingTest < Minitest::Test
4
+ def test_uci_white_short_castling
5
+ game = Chess::Game.new
6
+ game.moves = %w[e4 c5 c3 d5 exd5 Qxd5 d4 Nf6 Nf3 e6 Be2 Be7 e1h1 Nc6]
7
+ assert_equal '*', game.result
8
+ end
9
+
10
+ def test_uci_white_long_castling
11
+ game = Chess::Game.new
12
+ game.moves = %w[e4 c5 Nf3 Nc6 d4 cxd4 Nxd4 Nf6 Nc3 d6 Bg5 Qb6 Nb3 e6 Qd2 Be7 e1a1]
13
+ assert_equal '*', game.result
14
+ end
15
+
16
+ def test_uci_black_short_castling
17
+ game = Chess::Game.new
18
+ game.moves = %w[d4 d5 c4 dxc4 e4 e5 Nf3 Bb4+ Nc3 exd4 Nxd4 Ne7 Bf4 Bxc3+ bxc3 Ng6 Bg3 Qe7 Bxc4 Qxe4+ Qe2 Qxe2+ Bxe2 Na6 Rb1 e8h8]
19
+ assert_equal '*', game.result
20
+ end
21
+
22
+ def test_uci_black_long_castling
23
+ game = Chess::Game.new
24
+ game.moves = %w[e4 c5 Nf3 d6 d4 cxd4 Qxd4 Nc6 Bb5 Bd7 Bxc6 Bxc6 Bg5 Nf6 Bxf6 gxf6 Nc3 e6 e1c1 Be7 Rhe1 Rg8 Qe3 Rxg2 Rg1 Rg6 Nd4 Qb6 h4 e8a8]
25
+ assert_equal '*', game.result
26
+ end
27
+
28
+ def test_uci_invalid_white_long_castling
29
+ game = Chess::Game.new
30
+ assert_raises(Chess::IllegalMoveError) do
31
+ game.moves = %w[e4 c5 Nf3 Nc6 d4 cxd4 Nxd4 Nf6 Nc3 d6 Bg5 Qb6 Nb3 e6 Qd2 Be7 e8a8]
32
+ end
33
+ end
34
+ end