chess 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
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 +2 -2
  5. data/.rubocop.yml +9 -144
  6. data/Gemfile.lock +70 -0
  7. data/README.md +26 -22
  8. data/Rakefile +1 -0
  9. data/chess.gemspec +8 -5
  10. data/docs/Chess.html +157 -0
  11. data/docs/Chess/BadNotationError.html +237 -0
  12. data/docs/Chess/Board.html +1759 -0
  13. data/docs/Chess/CGame.html +2296 -0
  14. data/docs/Chess/Game.html +1277 -0
  15. data/docs/Chess/Gnuchess.html +366 -0
  16. data/docs/Chess/IllegalMoveError.html +137 -0
  17. data/docs/Chess/InvalidFenFormatError.html +237 -0
  18. data/docs/Chess/InvalidPgnFormatError.html +217 -0
  19. data/docs/Chess/Pgn.html +1477 -0
  20. data/docs/Chess/UTF8Notation.html +270 -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 +53 -67
  39. data/lib/chess/gnuchess.rb +49 -53
  40. data/lib/chess/pgn.rb +10 -12
  41. data/lib/chess/utf8_notation.rb +3 -0
  42. data/lib/chess/version.rb +1 -1
  43. data/test/test_big_pgn_collection.rb +1 -1
  44. data/test/test_checkmate.rb +4 -4
  45. data/test/test_errors.rb +22 -0
  46. data/test/test_fifty_rule_move.rb +2 -2
  47. data/test/test_game.rb +82 -0
  48. data/test/test_helper.rb +15 -0
  49. data/test/test_insufficient_material.rb +4 -4
  50. data/test/test_move_generator.rb +3 -2
  51. data/test/test_pgn.rb +35 -0
  52. data/test/test_pgn_collection.rb +2 -2
  53. data/test/test_stalemate.rb +1 -1
  54. data/test/test_threefold_repetition.rb +1 -1
  55. metadata +112 -10
@@ -0,0 +1,270 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Chess::UTF8Notation
8
+
9
+ &mdash; Chess
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Chess::UTF8Notation";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (U)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Chess.html" title="Chess (module)">Chess</a></span></span>
41
+ &raquo;
42
+ <span class="title">UTF8Notation</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Chess::UTF8Notation
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/chess/utf8_notation.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <div class="note notetag">
90
+ <strong>Note:</strong>
91
+ <div class='inline'>
92
+ <p>To use this utility explicit require is needed: <code>require &#39;chess/utf8_notation&#39;</code></p>
93
+ </div>
94
+ </div>
95
+
96
+
97
+ <p>With this module is possible call the method <span class='object_link'><a href="#to_utf8-instance_method" title="Chess::UTF8Notation#to_utf8 (method)">#to_utf8</a></span> on a string. This method convert the chess piece identifier character into UTF8 chess character.</p>
98
+
99
+
100
+ </div>
101
+ </div>
102
+ <div class="tags">
103
+
104
+ <div class="examples">
105
+ <p class="tag_title">Examples:</p>
106
+
107
+
108
+ <pre class="example code"><code>:001 &gt; require &#39;chess/utf8_notation&#39;
109
+ =&gt; true
110
+ :002 &gt; &#39;Qf7#&#39;.to_utf8
111
+ =&gt; &#39;♕f7#&#39;</code></pre>
112
+
113
+ </div>
114
+
115
+
116
+ </div>
117
+
118
+ <h2>
119
+ Constant Summary
120
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
121
+ </h2>
122
+
123
+ <dl class="constants">
124
+
125
+ <dt id="UTF8_MAP-constant" class="">UTF8_MAP =
126
+ <div class="docstring">
127
+ <div class="discussion">
128
+
129
+ <p>Map a piece identifier character with the corresponding UTF8 chess character</p>
130
+
131
+
132
+ </div>
133
+ </div>
134
+ <div class="tags">
135
+
136
+
137
+ </div>
138
+ </dt>
139
+ <dd><pre class="code"><span class='lbrace'>{</span>
140
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>P</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♙</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
141
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>R</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♖</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
142
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>N</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♘</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
143
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>B</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♗</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
144
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Q</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♕</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
145
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>K</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♔</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
146
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>p</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♟</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
147
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>r</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♜</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
148
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>n</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♞</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
149
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>b</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♝</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
150
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>q</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♛</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
151
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>k</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>♚</span><span class='tstring_end'>&#39;</span></span>
152
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
153
+
154
+ </dl>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ <h2>
165
+ Instance Method Summary
166
+ <small><a href="#" class="summary_toggle">collapse</a></small>
167
+ </h2>
168
+
169
+ <ul class="summary">
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#to_utf8-instance_method" title="#to_utf8 (instance method)">#<strong>to_utf8</strong> &#x21d2; String </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+ <span class="summary_desc"><div class='inline'>
189
+ <p>Replace the piece identifier characters with UTF8 chess characters.</p>
190
+ </div></span>
191
+
192
+ </li>
193
+
194
+
195
+ </ul>
196
+
197
+
198
+
199
+
200
+ <div id="instance_method_details" class="method_details_list">
201
+ <h2>Instance Method Details</h2>
202
+
203
+
204
+ <div class="method_details first">
205
+ <h3 class="signature first" id="to_utf8-instance_method">
206
+
207
+ #<strong>to_utf8</strong> &#x21d2; <tt>String</tt>
208
+
209
+
210
+
211
+
212
+
213
+ </h3><div class="docstring">
214
+ <div class="discussion">
215
+
216
+ <p>Replace the piece identifier characters with UTF8 chess characters.</p>
217
+
218
+
219
+ </div>
220
+ </div>
221
+ <div class="tags">
222
+
223
+ <p class="tag_title">Returns:</p>
224
+ <ul class="return">
225
+
226
+ <li>
227
+
228
+
229
+ <span class='type'>(<tt>String</tt>)</span>
230
+
231
+
232
+
233
+ </li>
234
+
235
+ </ul>
236
+
237
+ </div><table class="source_code">
238
+ <tr>
239
+ <td>
240
+ <pre class="lines">
241
+
242
+
243
+ 35
244
+ 36
245
+ 37</pre>
246
+ </td>
247
+ <td>
248
+ <pre class="code"><span class="info file"># File 'lib/chess/utf8_notation.rb', line 35</span>
249
+
250
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_utf8'>to_utf8</span>
251
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[PRNBQKprnbqk]</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#UTF8_MAP-constant" title="Chess::UTF8Notation::UTF8_MAP (constant)">UTF8_MAP</a></span></span><span class='rparen'>)</span>
252
+ <span class='kw'>end</span></pre>
253
+ </td>
254
+ </tr>
255
+ </table>
256
+ </div>
257
+
258
+ </div>
259
+
260
+ </div>
261
+
262
+ <div id="footer">
263
+ Generated on Thu Jan 28 17:31:40 2021 by
264
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
265
+ 0.9.26 (ruby-2.6.1).
266
+ </div>
267
+
268
+ </div>
269
+ </body>
270
+ </html>
@@ -0,0 +1,217 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Chess
8
+
9
+ </title>
10
+
11
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
12
+
13
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
14
+
15
+ <script type="text/javascript">
16
+ pathId = null;
17
+ relpath = '';
18
+ </script>
19
+
20
+
21
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
24
+
25
+
26
+ </head>
27
+ <body>
28
+ <div class="nav_wrap">
29
+ <iframe id="nav" src="class_list.html?1"></iframe>
30
+ <div id="resizer"></div>
31
+ </div>
32
+
33
+ <div id="main" tabindex="-1">
34
+ <div id="header">
35
+ <div id="menu">
36
+
37
+ </div>
38
+
39
+ <div id="search">
40
+
41
+ <a class="full_list_link" id="class_list_link"
42
+ href="class_list.html">
43
+
44
+ <svg width="24" height="24">
45
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
46
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
47
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
48
+ </svg>
49
+ </a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <div id="content"><h1 class="noborder title">Chess</h1>
56
+ <div id="listing">
57
+ <h1 class="alphaindex">Alphabetic Index</h1>
58
+
59
+ <h2>File Listing</h2>
60
+ <ul id="files" class="index_inline_list">
61
+
62
+
63
+ <li class="r1"><a href="index.html" title="README">README</a></li>
64
+
65
+
66
+ </ul>
67
+
68
+ <div class="clear"></div>
69
+ <h2>Namespace Listing A-Z</h2>
70
+
71
+
72
+
73
+
74
+ <table>
75
+ <tr>
76
+ <td valign='top' width="33%">
77
+
78
+
79
+ <ul id="alpha_B" class="alpha">
80
+ <li class="letter">B</li>
81
+ <ul>
82
+
83
+ <li>
84
+ <span class='object_link'><a href="Chess/BadNotationError.html" title="Chess::BadNotationError (class)">BadNotationError</a></span>
85
+
86
+ <small>(Chess)</small>
87
+
88
+ </li>
89
+
90
+ <li>
91
+ <span class='object_link'><a href="Chess/Board.html" title="Chess::Board (class)">Board</a></span>
92
+
93
+ <small>(Chess)</small>
94
+
95
+ </li>
96
+
97
+ </ul>
98
+ </ul>
99
+
100
+
101
+ <ul id="alpha_C" class="alpha">
102
+ <li class="letter">C</li>
103
+ <ul>
104
+
105
+ <li>
106
+ <span class='object_link'><a href="Chess/CGame.html" title="Chess::CGame (class)">CGame</a></span>
107
+
108
+ <small>(Chess)</small>
109
+
110
+ </li>
111
+
112
+ <li>
113
+ <span class='object_link'><a href="Chess.html" title="Chess (module)">Chess</a></span>
114
+
115
+ </li>
116
+
117
+ </ul>
118
+ </ul>
119
+
120
+
121
+ <ul id="alpha_G" class="alpha">
122
+ <li class="letter">G</li>
123
+ <ul>
124
+
125
+ <li>
126
+ <span class='object_link'><a href="Chess/Game.html" title="Chess::Game (class)">Game</a></span>
127
+
128
+ <small>(Chess)</small>
129
+
130
+ </li>
131
+
132
+ <li>
133
+ <span class='object_link'><a href="Chess/Gnuchess.html" title="Chess::Gnuchess (module)">Gnuchess</a></span>
134
+
135
+ <small>(Chess)</small>
136
+
137
+ </li>
138
+
139
+ </ul>
140
+ </ul>
141
+
142
+
143
+ <ul id="alpha_I" class="alpha">
144
+ <li class="letter">I</li>
145
+ <ul>
146
+
147
+ <li>
148
+ <span class='object_link'><a href="Chess/IllegalMoveError.html" title="Chess::IllegalMoveError (class)">IllegalMoveError</a></span>
149
+
150
+ <small>(Chess)</small>
151
+
152
+ </li>
153
+
154
+ <li>
155
+ <span class='object_link'><a href="Chess/InvalidFenFormatError.html" title="Chess::InvalidFenFormatError (class)">InvalidFenFormatError</a></span>
156
+
157
+ <small>(Chess)</small>
158
+
159
+ </li>
160
+
161
+ <li>
162
+ <span class='object_link'><a href="Chess/InvalidPgnFormatError.html" title="Chess::InvalidPgnFormatError (class)">InvalidPgnFormatError</a></span>
163
+
164
+ <small>(Chess)</small>
165
+
166
+ </li>
167
+
168
+ </ul>
169
+ </ul>
170
+
171
+
172
+ <ul id="alpha_P" class="alpha">
173
+ <li class="letter">P</li>
174
+ <ul>
175
+
176
+ <li>
177
+ <span class='object_link'><a href="Chess/Pgn.html" title="Chess::Pgn (class)">Pgn</a></span>
178
+
179
+ <small>(Chess)</small>
180
+
181
+ </li>
182
+
183
+ </ul>
184
+ </ul>
185
+
186
+
187
+ <ul id="alpha_U" class="alpha">
188
+ <li class="letter">U</li>
189
+ <ul>
190
+
191
+ <li>
192
+ <span class='object_link'><a href="Chess/UTF8Notation.html" title="Chess::UTF8Notation (module)">UTF8Notation</a></span>
193
+
194
+ <small>(Chess)</small>
195
+
196
+ </li>
197
+
198
+ </ul>
199
+ </ul>
200
+
201
+ </td>
202
+ </tr>
203
+ </table>
204
+
205
+ </div>
206
+
207
+ </div>
208
+
209
+ <div id="footer">
210
+ Generated on Thu Jan 28 17:31:40 2021 by
211
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
212
+ 0.9.26 (ruby-2.6.1).
213
+ </div>
214
+
215
+ </div>
216
+ </body>
217
+ </html>