chess 0.1.0 → 0.1.1

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +1 -1
  3. data/Rakefile +3 -4
  4. data/chess.gemspec +5 -0
  5. data/doc/Chess.html +112 -0
  6. data/doc/Chess/BadNotationError.html +107 -0
  7. data/doc/Chess/Board.html +703 -0
  8. data/doc/Chess/CGame.html +1005 -0
  9. data/doc/Chess/Game.html +684 -0
  10. data/doc/Chess/Gnuchess.html +215 -0
  11. data/doc/Chess/IllegalMoveError.html +105 -0
  12. data/doc/Chess/InvalidFenFormatError.html +105 -0
  13. data/doc/Chess/InvalidPgnFormatError.html +105 -0
  14. data/doc/Chess/Pgn.html +309 -0
  15. data/doc/Chess/UTF8Notation.html +174 -0
  16. data/doc/README_rdoc.html +143 -0
  17. data/doc/created.rid +15 -15
  18. data/doc/css/fonts.css +167 -0
  19. data/doc/css/rdoc.css +590 -0
  20. data/doc/fonts/Lato-Light.ttf +0 -0
  21. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  22. data/doc/fonts/Lato-Regular.ttf +0 -0
  23. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  24. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  25. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  26. data/doc/images/add.png +0 -0
  27. data/doc/images/arrow_up.png +0 -0
  28. data/doc/images/brick.png +0 -0
  29. data/doc/images/brick_link.png +0 -0
  30. data/doc/images/bug.png +0 -0
  31. data/doc/images/bullet_black.png +0 -0
  32. data/doc/images/bullet_toggle_minus.png +0 -0
  33. data/doc/images/bullet_toggle_plus.png +0 -0
  34. data/doc/images/date.png +0 -0
  35. data/doc/images/delete.png +0 -0
  36. data/doc/images/find.png +0 -0
  37. data/doc/images/loadingAnimation.gif +0 -0
  38. data/doc/images/macFFBgHack.png +0 -0
  39. data/doc/images/package.png +0 -0
  40. data/doc/images/page_green.png +0 -0
  41. data/doc/images/page_white_text.png +0 -0
  42. data/doc/images/page_white_width.png +0 -0
  43. data/doc/images/plugin.png +0 -0
  44. data/doc/images/ruby.png +0 -0
  45. data/doc/images/tag_blue.png +0 -0
  46. data/doc/images/tag_green.png +0 -0
  47. data/doc/images/transparent.png +0 -0
  48. data/doc/images/wrench.png +0 -0
  49. data/doc/images/wrench_orange.png +0 -0
  50. data/doc/images/zoom.png +0 -0
  51. data/doc/index.html +159 -12
  52. data/doc/js/darkfish.js +161 -0
  53. data/doc/js/jquery.js +4 -0
  54. data/doc/js/navigation.js.gz +0 -0
  55. data/doc/js/search.js +109 -0
  56. data/doc/js/search_index.js +1 -1
  57. data/doc/js/search_index.js.gz +0 -0
  58. data/doc/js/searcher.js +1 -0
  59. data/doc/js/searcher.js.gz +0 -0
  60. data/doc/table_of_contents.html +331 -0
  61. data/ext/chess.c +5 -2
  62. data/ext/game.c +1 -1
  63. data/ext/game.h +1 -1
  64. data/lib/chess/game.rb +1 -1
  65. data/lib/chess/pgn.rb +5 -1
  66. data/lib/chess/version.rb +1 -1
  67. metadata +112 -46
  68. data/doc/apple-touch-icon.png +0 -0
  69. data/doc/classes/Chess.html +0 -162
  70. data/doc/classes/Chess/BadNotationError.html +0 -84
  71. data/doc/classes/Chess/Board.html +0 -795
  72. data/doc/classes/Chess/CGame.html +0 -1168
  73. data/doc/classes/Chess/Game.html +0 -775
  74. data/doc/classes/Chess/Gnuchess.html +0 -206
  75. data/doc/classes/Chess/IllegalMoveError.html +0 -82
  76. data/doc/classes/Chess/InvalidFenFormatError.html +0 -82
  77. data/doc/classes/Chess/InvalidPgnFormatError.html +0 -82
  78. data/doc/classes/Chess/Pgn.html +0 -332
  79. data/doc/classes/Chess/UTF8Notation.html +0 -175
  80. data/doc/css/github.css +0 -123
  81. data/doc/css/main.css +0 -323
  82. data/doc/css/panel.css +0 -384
  83. data/doc/css/reset.css +0 -48
  84. data/doc/favicon.ico +0 -0
  85. data/doc/files/README_rdoc.html +0 -122
  86. data/doc/files/ext/bitboard_c.html +0 -68
  87. data/doc/files/ext/board_c.html +0 -68
  88. data/doc/files/ext/chess_c.html +0 -68
  89. data/doc/files/ext/common_c.html +0 -68
  90. data/doc/files/ext/game_c.html +0 -68
  91. data/doc/files/ext/special_c.html +0 -68
  92. data/doc/files/lib/chess/exceptions_rb.html +0 -94
  93. data/doc/files/lib/chess/game_rb.html +0 -84
  94. data/doc/files/lib/chess/gnuchess_rb.html +0 -84
  95. data/doc/files/lib/chess/pgn_rb.html +0 -84
  96. data/doc/files/lib/chess/utf8_notation_rb.html +0 -84
  97. data/doc/files/lib/chess/version_rb.html +0 -85
  98. data/doc/files/lib/chess_rb.html +0 -84
  99. data/doc/i/arrows.png +0 -0
  100. data/doc/i/results_bg.png +0 -0
  101. data/doc/i/tree_bg.png +0 -0
  102. data/doc/js/highlight.pack.js +0 -1
  103. data/doc/js/jquery-1.3.2.min.js +0 -19
  104. data/doc/js/jquery-effect.js +0 -593
  105. data/doc/js/main.js +0 -24
  106. data/doc/js/searchdoc.js +0 -449
  107. data/doc/panel/index.html +0 -73
  108. data/doc/panel/links.html +0 -34
  109. data/doc/panel/tree.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 973c9e62761545d56d62ed051f3fdcda270eed70
4
- data.tar.gz: f1cdd754afaf51da28c59eb883b379c14f9e6263
3
+ metadata.gz: ba8b98eeeaf058981ec4d1e12373b95b8d37babc
4
+ data.tar.gz: 592981be2deed30ca9f1d0fee03e22f0e04425de
5
5
  SHA512:
6
- metadata.gz: 2d609c00560340a939f9a9d2a54f3bed16dc12a97c887bae9e932d63084558867f5931348e2996e7ac5471183e0b59ca1c8553c0ddb5fb9b7c191884c4935b76
7
- data.tar.gz: 7cde74aca5fc145faec8230cc54b8cb8384db7147f33e458512fd5a2f3ced969a18739894e2f8712de857e6e2faebbbeceffc3b7598a40d3bbf52339d7957eda
6
+ metadata.gz: c43dd4b27bf44c9eb9c319abb130c93adfa7faa58303cf6b7275830d7d2cb164bef9a7da82adc10cb29bebafa14065acff55a74fc9f5bea712dd4d932e339b1e
7
+ data.tar.gz: d6ef9971478bbd5a0fa9c19cfe15923dc5a62f76fc1e82eaf06fdaf39d9b7e14d7fad5473a1703ff3f75f7f3d28ac3173c151d91b9844285cc028e6642a106b6
@@ -40,5 +40,5 @@ or fork the project and send a pull request.
40
40
 
41
41
  == Copyright
42
42
 
43
- Copyright (c) 2015 {Enrico Pilotto (@pioz)}[https://github.com/pioz].
43
+ Copyright (c) 2017 {Enrico Pilotto (@pioz)}[https://github.com/pioz].
44
44
  See {LICENSE}[https://github.com/pioz/chess/blob/master/LICENSE] for details.
data/Rakefile CHANGED
@@ -1,19 +1,18 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
3
  require 'rdoc/task'
4
- require 'sdoc'
5
4
  Rake::RDocTask.new do |rd|
6
5
  rd.title = 'Chess'
7
6
  rd.main = 'README.rdoc'
8
7
  rd.rdoc_dir = 'doc'
9
8
  rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb', 'ext/*.c')
10
- rd.options << '-f' << 'sdoc'
9
+ rd.generator = 'darkfish'
11
10
  end
12
11
 
13
12
  require 'rake/testtask'
14
- task :default => :test
13
+ task default: :test
15
14
  Rake::TestTask.new do |test|
16
15
  test.libs << 'test'
17
- test.warning = false
16
+ test.warning = true
18
17
  test.test_files = FileList["test/test_#{ENV['T'] || '*'}.rb"]
19
18
  end
@@ -19,4 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.extensions = ['ext/extconf.rb']
21
21
  s.require_paths = ['lib']
22
+
23
+ s.add_development_dependency 'bundler', '~> 1.14'
24
+ s.add_development_dependency 'rake', '~> 12.0'
25
+ s.add_development_dependency 'minitest', '~> 5.10'
26
+ s.add_development_dependency 'rdoc', '~> 5.1'
22
27
  end
@@ -0,0 +1,112 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module Chess - Chess</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="module">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="./index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="./table_of_contents.html#pages">Pages</a>
32
+ <a href="./table_of_contents.html#classes">Classes</a>
33
+ <a href="./table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+
59
+
60
+
61
+
62
+ </div>
63
+ </nav>
64
+
65
+ <main role="main" aria-labelledby="module-Chess">
66
+ <h1 id="module-Chess" class="module">
67
+ module Chess
68
+ </h1>
69
+
70
+ <section class="description">
71
+
72
+ <p>The <a href="Chess.html">Chess</a> library module.</p>
73
+
74
+ </section>
75
+
76
+
77
+
78
+
79
+ <section id="5Buntitled-5D" class="documentation-section">
80
+
81
+
82
+
83
+
84
+
85
+ <section class="constants-list">
86
+ <header>
87
+ <h3>Constants</h3>
88
+ </header>
89
+ <dl>
90
+
91
+ <dt id="VERSION">VERSION
92
+
93
+ <dd><p>The library version.</p>
94
+
95
+
96
+ </dl>
97
+ </section>
98
+
99
+
100
+
101
+
102
+
103
+ </section>
104
+ </main>
105
+
106
+
107
+ <footer id="validator-badges" role="contentinfo">
108
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
109
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
110
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
111
+ </footer>
112
+
@@ -0,0 +1,107 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Chess::BadNotationError - Chess</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="class">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+ <div id="parent-class-section" class="nav-section">
59
+ <h3>Parent</h3>
60
+
61
+
62
+ <p class="link">StandardError
63
+
64
+ </div>
65
+
66
+
67
+
68
+
69
+ </div>
70
+ </nav>
71
+
72
+ <main role="main" aria-labelledby="class-Chess::BadNotationError">
73
+ <h1 id="class-Chess::BadNotationError" class="class">
74
+ class Chess::BadNotationError
75
+ </h1>
76
+
77
+ <section class="description">
78
+
79
+ <p>This exception will be raised when an invalid short algebraic chess
80
+ notation string is passed to the <a
81
+ href="Game.html#method-i-move">Chess::Game#move</a> function.</p>
82
+
83
+ </section>
84
+
85
+
86
+
87
+
88
+ <section id="5Buntitled-5D" class="documentation-section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ </section>
99
+ </main>
100
+
101
+
102
+ <footer id="validator-badges" role="contentinfo">
103
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
104
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
105
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
106
+ </footer>
107
+
@@ -0,0 +1,703 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Chess::Board - Chess</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="class">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+ <div id="parent-class-section" class="nav-section">
59
+ <h3>Parent</h3>
60
+
61
+
62
+ <p class="link">Object
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <!-- Method Quickref -->
69
+ <div id="method-list-section" class="nav-section">
70
+ <h3>Methods</h3>
71
+
72
+ <ul class="link-list" role="directory">
73
+
74
+ <li ><a href="#method-i-5B-5D">#[]</a>
75
+
76
+ <li ><a href="#method-i-active_color">#active_color</a>
77
+
78
+ <li ><a href="#method-i-check-3F">#check?</a>
79
+
80
+ <li ><a href="#method-i-checkmate-3F">#checkmate?</a>
81
+
82
+ <li ><a href="#method-i-fifty_rule_move-3F">#fifty_rule_move?</a>
83
+
84
+ <li ><a href="#method-i-fullmove_number">#fullmove_number</a>
85
+
86
+ <li ><a href="#method-i-halfmove_clock">#halfmove_clock</a>
87
+
88
+ <li ><a href="#method-i-insufficient_material-3F">#insufficient_material?</a>
89
+
90
+ <li ><a href="#method-i-placement">#placement</a>
91
+
92
+ <li ><a href="#method-i-stalemate-3F">#stalemate?</a>
93
+
94
+ <li ><a href="#method-i-to_fen">#to_fen</a>
95
+
96
+ <li ><a href="#method-i-to_s">#to_s</a>
97
+
98
+ </ul>
99
+ </div>
100
+
101
+ </div>
102
+ </nav>
103
+
104
+ <main role="main" aria-labelledby="class-Chess::Board">
105
+ <h1 id="class-Chess::Board" class="class">
106
+ class Chess::Board
107
+ </h1>
108
+
109
+ <section class="description">
110
+
111
+ <p>This class rappresents a chess board. The rappresentation of the board use
112
+ <em>bitboards</em> where each bit represents a game position or state,
113
+ designed for optimization of speed and/or memory or disk use in mass
114
+ calculations. This ensures a fast library.</p>
115
+
116
+ </section>
117
+
118
+
119
+
120
+
121
+ <section id="5Buntitled-5D" class="documentation-section">
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
132
+ <header>
133
+ <h3>Public Instance Methods</h3>
134
+ </header>
135
+
136
+
137
+ <div id="method-i-5B-5D" class="method-detail ">
138
+
139
+
140
+ <div class="method-heading">
141
+ <span class="method-callseq">
142
+ [square]
143
+ </span>
144
+
145
+ <span class="method-click-advice">click to toggle source</span>
146
+
147
+ </div>
148
+
149
+
150
+
151
+ <div class="method-description">
152
+
153
+ <p>Returns the piece on the <code>square</code> of the chessboard. If there is
154
+ no piece or the square is not valid return the blank string.</p>
155
+
156
+ <p>Each square on the chessboard is represented by an integer according to the
157
+ following scheme:</p>
158
+
159
+ <pre>8 | 56 57 58 59 60 61 62 63
160
+ 7 | 48 49 50 51 52 53 54 55
161
+ 6 | 40 41 42 43 44 45 46 47
162
+ 5 | 32 33 34 35 36 37 38 39
163
+ 4 | 24 25 26 27 28 29 30 31
164
+ 3 | 16 17 18 19 20 21 22 23
165
+ 2 | 8 9 10 11 12 13 14 15
166
+ 1 | 0 1 2 3 4 5 6 7
167
+ +-------------------------
168
+ a b c d e f g h</pre>
169
+
170
+ <p>Parameters are:</p>
171
+ <dl class="rdoc-list note-list"><dt><code>square</code>
172
+ <dd>
173
+ <p>the square of the board. Can be a fixnum between 0 and 63 or a</p>
174
+ </dd></dl>
175
+
176
+ <p>string like &#39;a2&#39;, &#39;c5&#39;… The string must be downcase.</p>
177
+
178
+
179
+
180
+
181
+ <div class="method-source-code" id="5B-5D-source">
182
+ <pre>VALUE
183
+ board_get_piece (VALUE self, VALUE square)
184
+ {
185
+ Board *board;
186
+ Data_Get_Struct (self, Board, board);
187
+ int i;
188
+ char piece[2];
189
+ piece[1] = &#39;\0&#39;;
190
+ if (TYPE (square) == T_STRING)
191
+ i = coord_to_square (StringValuePtr (square));
192
+ else
193
+ i = FIX2INT (square);
194
+ piece[0] = board-&gt;placement[i];
195
+ return rb_str_new2 (piece);
196
+ }</pre>
197
+ </div>
198
+
199
+ </div>
200
+
201
+
202
+
203
+
204
+ </div>
205
+
206
+
207
+ <div id="method-i-active_color" class="method-detail ">
208
+
209
+
210
+ <div class="method-heading">
211
+ <span class="method-callseq">
212
+ active_color
213
+ </span>
214
+
215
+ <span class="method-click-advice">click to toggle source</span>
216
+
217
+ </div>
218
+
219
+
220
+
221
+ <div class="method-description">
222
+
223
+ <p>Returns the active color: <code>false</code> means white turn,
224
+ <code>true</code> means black turn.</p>
225
+
226
+
227
+
228
+
229
+ <div class="method-source-code" id="active_color-source">
230
+ <pre>VALUE
231
+ board_active_color (VALUE self)
232
+ {
233
+ Board *board;
234
+ Data_Get_Struct (self, Board, board);
235
+ if (board-&gt;active_color)
236
+ return Qtrue;
237
+ else
238
+ return Qfalse;
239
+ }</pre>
240
+ </div>
241
+
242
+ </div>
243
+
244
+
245
+
246
+
247
+ </div>
248
+
249
+
250
+ <div id="method-i-check-3F" class="method-detail ">
251
+
252
+
253
+ <div class="method-heading">
254
+ <span class="method-callseq">
255
+ check?
256
+ </span>
257
+
258
+ <span class="method-click-advice">click to toggle source</span>
259
+
260
+ </div>
261
+
262
+
263
+
264
+ <div class="method-description">
265
+
266
+ <p>Returns <code>true</code> if the king of the color that has the turn is in
267
+ check, <code>false</code> otherwise.</p>
268
+
269
+
270
+
271
+
272
+ <div class="method-source-code" id="check-3F-source">
273
+ <pre>VALUE
274
+ board_king_in_check (VALUE self)
275
+ {
276
+ Board *board;
277
+ Data_Get_Struct (self, Board, board);
278
+ if (king_in_check (board, board-&gt;active_color))
279
+ return Qtrue;
280
+ else
281
+ return Qfalse;
282
+ }</pre>
283
+ </div>
284
+
285
+ </div>
286
+
287
+
288
+
289
+
290
+ </div>
291
+
292
+
293
+ <div id="method-i-checkmate-3F" class="method-detail ">
294
+
295
+
296
+ <div class="method-heading">
297
+ <span class="method-callseq">
298
+ checkmate?
299
+ </span>
300
+
301
+ <span class="method-click-advice">click to toggle source</span>
302
+
303
+ </div>
304
+
305
+
306
+
307
+ <div class="method-description">
308
+
309
+ <p>Returns <code>true</code> if the king of the color that has the turn is in
310
+ checkmate, <code>false</code> otherwise.</p>
311
+
312
+
313
+
314
+
315
+ <div class="method-source-code" id="checkmate-3F-source">
316
+ <pre>VALUE
317
+ board_king_in_checkmate (VALUE self)
318
+ {
319
+ Board *board;
320
+ Data_Get_Struct (self, Board, board);
321
+ if (king_in_checkmate (board, board-&gt;active_color))
322
+ return Qtrue;
323
+ else
324
+ return Qfalse;
325
+ }</pre>
326
+ </div>
327
+
328
+ </div>
329
+
330
+
331
+
332
+
333
+ </div>
334
+
335
+
336
+ <div id="method-i-fifty_rule_move-3F" class="method-detail ">
337
+
338
+
339
+ <div class="method-heading">
340
+ <span class="method-callseq">
341
+ fifty_move_rule?
342
+ </span>
343
+
344
+ <span class="method-click-advice">click to toggle source</span>
345
+
346
+ </div>
347
+
348
+
349
+
350
+ <div class="method-description">
351
+
352
+ <p>Returns <code>true</code> if a player can claim draw by the fifty-move
353
+ rule, <code>false</code> otherwise.</p>
354
+
355
+
356
+
357
+
358
+ <div class="method-source-code" id="fifty_rule_move-3F-source">
359
+ <pre>VALUE
360
+ board_fifty_move_rule (VALUE self)
361
+ {
362
+ Board *board;
363
+ Data_Get_Struct (self, Board, board);
364
+ if (fifty_move_rule (board))
365
+ return Qtrue;
366
+ else
367
+ return Qfalse;
368
+ }</pre>
369
+ </div>
370
+
371
+ </div>
372
+
373
+
374
+
375
+
376
+ </div>
377
+
378
+
379
+ <div id="method-i-fullmove_number" class="method-detail ">
380
+
381
+
382
+ <div class="method-heading">
383
+ <span class="method-callseq">
384
+ fullmove_number
385
+ </span>
386
+
387
+ <span class="method-click-advice">click to toggle source</span>
388
+
389
+ </div>
390
+
391
+
392
+
393
+ <div class="method-description">
394
+
395
+ <p>Returns the fullmove number: the number of the full move. It starts at 1,
396
+ and is incremented after black&#39;s move.</p>
397
+
398
+
399
+
400
+
401
+ <div class="method-source-code" id="fullmove_number-source">
402
+ <pre>VALUE
403
+ board_fullmove_number (VALUE self)
404
+ {
405
+ Board *board;
406
+ Data_Get_Struct (self, Board, board);
407
+ return INT2FIX (board-&gt;fullmove_number);
408
+ }</pre>
409
+ </div>
410
+
411
+ </div>
412
+
413
+
414
+
415
+
416
+ </div>
417
+
418
+
419
+ <div id="method-i-halfmove_clock" class="method-detail ">
420
+
421
+
422
+ <div class="method-heading">
423
+ <span class="method-callseq">
424
+ halfmove_clock
425
+ </span>
426
+
427
+ <span class="method-click-advice">click to toggle source</span>
428
+
429
+ </div>
430
+
431
+
432
+
433
+ <div class="method-description">
434
+
435
+ <p>Returns the halfmove clock that is the number of halfmoves since the last
436
+ pawn advance or capture. This is used to determine if a draw can be claimed
437
+ under the fifty-move rule.</p>
438
+
439
+
440
+
441
+
442
+ <div class="method-source-code" id="halfmove_clock-source">
443
+ <pre>VALUE
444
+ board_halfmove_clock (VALUE self)
445
+ {
446
+ Board *board;
447
+ Data_Get_Struct (self, Board, board);
448
+ return INT2FIX (board-&gt;halfmove_clock);
449
+ }</pre>
450
+ </div>
451
+
452
+ </div>
453
+
454
+
455
+
456
+
457
+ </div>
458
+
459
+
460
+ <div id="method-i-insufficient_material-3F" class="method-detail ">
461
+
462
+
463
+ <div class="method-heading">
464
+ <span class="method-callseq">
465
+ insufficient_material?
466
+ </span>
467
+
468
+ <span class="method-click-advice">click to toggle source</span>
469
+
470
+ </div>
471
+
472
+
473
+
474
+ <div class="method-description">
475
+
476
+ <p>Returns <code>true</code> if the board has insufficient material to
477
+ checkmate, <code>false</code> otherwise.</p>
478
+
479
+
480
+
481
+
482
+ <div class="method-source-code" id="insufficient_material-3F-source">
483
+ <pre>VALUE
484
+ board_insufficient_material (VALUE self)
485
+ {
486
+ Board *board;
487
+ Data_Get_Struct (self, Board, board);
488
+ if (insufficient_material (board))
489
+ return Qtrue;
490
+ else
491
+ return Qfalse;
492
+ }</pre>
493
+ </div>
494
+
495
+ </div>
496
+
497
+
498
+
499
+
500
+ </div>
501
+
502
+
503
+ <div id="method-i-placement" class="method-detail ">
504
+
505
+
506
+ <div class="method-heading">
507
+ <span class="method-callseq">
508
+ placement { |piece, index| block }
509
+ </span>
510
+
511
+ <span class="method-click-advice">click to toggle source</span>
512
+
513
+ </div>
514
+
515
+
516
+
517
+ <div class="method-description">
518
+
519
+ <p>Calls <code>block</code> once for each square in the board, passing the
520
+ <code>piece</code> in the square and the <code>index</code> as parameters.
521
+ Return self. If no block is given, the array of pieces is returned instead.</p>
522
+
523
+
524
+
525
+
526
+ <div class="method-source-code" id="placement-source">
527
+ <pre>VALUE
528
+ board_placement (VALUE self)
529
+ {
530
+ Board *board;
531
+ Data_Get_Struct (self, Board, board);
532
+ int i;
533
+ char piece[2];
534
+ piece[1] = &#39;\0&#39;;
535
+ if (!rb_block_given_p ())
536
+ {
537
+ VALUE placement = rb_ary_new ();
538
+ for (i = 0; i &lt; 64; i++)
539
+ {
540
+ piece[0] = board-&gt;placement[i];
541
+ rb_ary_push (placement, rb_str_new2 (piece));
542
+ }
543
+ return placement;
544
+ }
545
+ else
546
+ {
547
+ for (i = 0; i &lt; 64; i++)
548
+ {
549
+ piece[0] = board-&gt;placement[i];
550
+ rb_yield_values (2, rb_str_new2 (piece), INT2FIX (i));
551
+ }
552
+ return self;
553
+ }
554
+ }</pre>
555
+ </div>
556
+
557
+ </div>
558
+
559
+
560
+
561
+
562
+ </div>
563
+
564
+
565
+ <div id="method-i-stalemate-3F" class="method-detail ">
566
+
567
+
568
+ <div class="method-heading">
569
+ <span class="method-callseq">
570
+ stalemate?
571
+ </span>
572
+
573
+ <span class="method-click-advice">click to toggle source</span>
574
+
575
+ </div>
576
+
577
+
578
+
579
+ <div class="method-description">
580
+
581
+ <p>Returns <code>true</code> if the pieces of the color that has the turn are
582
+ in stalemate, <code>false</code> otherwise.</p>
583
+
584
+
585
+
586
+
587
+ <div class="method-source-code" id="stalemate-3F-source">
588
+ <pre>VALUE
589
+ board_stalemate (VALUE self)
590
+ {
591
+ Board *board;
592
+ Data_Get_Struct (self, Board, board);
593
+ if (stalemate (board, board-&gt;active_color))
594
+ return Qtrue;
595
+ else
596
+ return Qfalse;
597
+ }</pre>
598
+ </div>
599
+
600
+ </div>
601
+
602
+
603
+
604
+
605
+ </div>
606
+
607
+
608
+ <div id="method-i-to_fen" class="method-detail ">
609
+
610
+
611
+ <div class="method-heading">
612
+ <span class="method-callseq">
613
+ to_fen
614
+ </span>
615
+
616
+ <span class="method-click-advice">click to toggle source</span>
617
+
618
+ </div>
619
+
620
+
621
+
622
+ <div class="method-description">
623
+
624
+ <p>Return the FEN string of the board.</p>
625
+
626
+
627
+
628
+
629
+ <div class="method-source-code" id="to_fen-source">
630
+ <pre>VALUE
631
+ board_to_fen (VALUE self)
632
+ {
633
+ Board *board;
634
+ Data_Get_Struct (self, Board, board);
635
+ char *fen = to_fen (board);
636
+ VALUE rb_fen = rb_str_new2 (fen);
637
+ free (fen);
638
+ return rb_fen;
639
+ }</pre>
640
+ </div>
641
+
642
+ </div>
643
+
644
+
645
+
646
+
647
+ </div>
648
+
649
+
650
+ <div id="method-i-to_s" class="method-detail ">
651
+
652
+
653
+ <div class="method-heading">
654
+ <span class="method-callseq">
655
+ to_s
656
+ </span>
657
+
658
+ <span class="method-click-advice">click to toggle source</span>
659
+
660
+ </div>
661
+
662
+
663
+
664
+ <div class="method-description">
665
+
666
+ <p><a href="Board.html">Board</a> to string.</p>
667
+
668
+
669
+
670
+
671
+ <div class="method-source-code" id="to_s-source">
672
+ <pre>VALUE
673
+ board_to_s (VALUE self)
674
+ {
675
+ Board *board;
676
+ Data_Get_Struct (self, Board, board);
677
+ char *s = print_board (board);
678
+ VALUE rb_s = rb_str_new2 (s);
679
+ free (s);
680
+ return rb_s;
681
+ }</pre>
682
+ </div>
683
+
684
+ </div>
685
+
686
+
687
+
688
+
689
+ </div>
690
+
691
+
692
+ </section>
693
+
694
+ </section>
695
+ </main>
696
+
697
+
698
+ <footer id="validator-badges" role="contentinfo">
699
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
700
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
701
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
702
+ </footer>
703
+