chess 0.0.9 → 0.1.0

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/Rakefile +1 -0
  4. data/doc/apple-touch-icon.png +0 -0
  5. data/doc/classes/Chess.html +162 -0
  6. data/doc/classes/Chess/BadNotationError.html +84 -0
  7. data/doc/classes/Chess/Board.html +795 -0
  8. data/doc/classes/Chess/CGame.html +1168 -0
  9. data/doc/classes/Chess/Game.html +775 -0
  10. data/doc/classes/Chess/Gnuchess.html +206 -0
  11. data/doc/classes/Chess/IllegalMoveError.html +82 -0
  12. data/doc/classes/Chess/InvalidFenFormatError.html +82 -0
  13. data/doc/classes/Chess/InvalidPgnFormatError.html +82 -0
  14. data/doc/classes/Chess/Pgn.html +332 -0
  15. data/doc/classes/Chess/UTF8Notation.html +175 -0
  16. data/doc/created.rid +15 -0
  17. data/doc/css/github.css +123 -0
  18. data/doc/css/main.css +323 -0
  19. data/doc/css/panel.css +384 -0
  20. data/doc/css/reset.css +48 -0
  21. data/doc/favicon.ico +0 -0
  22. data/doc/files/README_rdoc.html +122 -0
  23. data/doc/files/ext/bitboard_c.html +68 -0
  24. data/doc/files/ext/board_c.html +68 -0
  25. data/doc/files/ext/chess_c.html +68 -0
  26. data/doc/files/ext/common_c.html +68 -0
  27. data/doc/files/ext/game_c.html +68 -0
  28. data/doc/files/ext/special_c.html +68 -0
  29. data/doc/files/lib/chess/exceptions_rb.html +94 -0
  30. data/doc/files/lib/chess/game_rb.html +84 -0
  31. data/doc/files/lib/chess/gnuchess_rb.html +84 -0
  32. data/doc/files/lib/chess/pgn_rb.html +84 -0
  33. data/doc/files/lib/chess/utf8_notation_rb.html +84 -0
  34. data/doc/files/lib/chess/version_rb.html +85 -0
  35. data/doc/files/lib/chess_rb.html +84 -0
  36. data/doc/i/arrows.png +0 -0
  37. data/doc/i/results_bg.png +0 -0
  38. data/doc/i/tree_bg.png +0 -0
  39. data/doc/index.html +13 -0
  40. data/doc/js/highlight.pack.js +1 -0
  41. data/doc/js/jquery-1.3.2.min.js +19 -0
  42. data/doc/js/jquery-effect.js +593 -0
  43. data/doc/js/main.js +24 -0
  44. data/doc/js/navigation.js +142 -0
  45. data/doc/js/search_index.js +1 -0
  46. data/doc/js/searchdoc.js +449 -0
  47. data/doc/js/searcher.js +228 -0
  48. data/doc/panel/index.html +73 -0
  49. data/doc/panel/links.html +34 -0
  50. data/doc/panel/tree.js +1 -0
  51. data/ext/chess.c +82 -33
  52. data/ext/chess.h +1 -1
  53. data/ext/common.c +1 -1
  54. data/ext/common.h +1 -1
  55. data/ext/game.c +7 -6
  56. data/ext/game.h +1 -1
  57. data/lib/chess/exceptions.rb +2 -1
  58. data/lib/chess/game.rb +18 -5
  59. data/lib/chess/gnuchess.rb +1 -1
  60. data/lib/chess/utf8_notation.rb +1 -0
  61. data/lib/chess/version.rb +1 -1
  62. metadata +50 -3
@@ -0,0 +1,206 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title>Chess::Gnuchess</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8
+ <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
+ <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
11
+ <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
15
+
16
+ </head>
17
+
18
+ <body>
19
+ <div class="banner">
20
+
21
+ <h1>
22
+ <span class="type">Module</span>
23
+ Chess::Gnuchess
24
+
25
+ </h1>
26
+ <ul class="files">
27
+
28
+ <li><a href="../../files/lib/chess/gnuchess_rb.html">lib/chess/gnuchess.rb</a></li>
29
+
30
+ </ul>
31
+ </div>
32
+ <div id="bodyContent">
33
+ <div id="content">
34
+
35
+ <div class="description">
36
+
37
+ <p>Use <a href="Gnuchess.html">Gnuchess</a> to I.A. <em>(Only a draft)</em> To
38
+ use this module, extend a game object with <a
39
+ href="Gnuchess.html">Chess::Gnuchess</a>. <a
40
+ href="Gnuchess.html">Gnuchess</a> binary have to be installed.</p>
41
+
42
+ <pre><code>g = Chess::Game.new
43
+ g.extend Chess::Gnuchess
44
+ g.gnuchess_move!
45
+ puts g
46
+ </code></pre>
47
+
48
+ </div>
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method ref -->
64
+ <div class="sectiontitle">Methods</div>
65
+ <dl class="methods">
66
+
67
+ <dt>G</dt>
68
+ <dd>
69
+ <ul>
70
+
71
+
72
+ <li>
73
+ <a href="#method-i-gnuchess_move">gnuchess_move</a>,
74
+ </li>
75
+
76
+
77
+ <li>
78
+ <a href="#method-i-gnuchess_move-21">gnuchess_move!</a>
79
+ </li>
80
+
81
+ </ul>
82
+ </dd>
83
+
84
+ </dl>
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <!-- Methods -->
104
+
105
+ <div class="sectiontitle">Instance Public methods</div>
106
+
107
+ <div class="method">
108
+ <div class="title method-title" id="method-i-gnuchess_move">
109
+
110
+ <b>gnuchess_move</b>()
111
+
112
+ <a href="../../classes/Chess/Gnuchess.html#method-i-gnuchess_move" name="method-i-gnuchess_move" class="permalink">Link</a>
113
+ </div>
114
+
115
+
116
+ <div class="description">
117
+ <p>Return the next move calculated by <a href="Gnuchess.html">Gnuchess</a>. <a
118
+ href="Gnuchess.html">Gnuchess</a> must be installed!</p>
119
+ </div>
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <div class="sourcecode">
129
+
130
+ <p class="source-link">
131
+ Source:
132
+ <a href="javascript:toggleSource('method-i-gnuchess_move_source')" id="l_method-i-gnuchess_move_source">show</a>
133
+
134
+ </p>
135
+ <div id="method-i-gnuchess_move_source" class="dyn-source">
136
+ <pre><span class="ruby-comment"># File lib/chess/gnuchess.rb, line 15</span>
137
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">gnuchess_move</span>
138
+ <span class="ruby-identifier">pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">popen</span>(<span class="ruby-string">&#39;gnuchess -x&#39;</span>, <span class="ruby-string">&#39;r+&#39;</span>)
139
+ <span class="ruby-keyword">begin</span>
140
+ <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-string">&#39;depth 1&#39;</span>)
141
+ <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-string">&#39;manual&#39;</span>)
142
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">coord_moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
143
+ <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">m</span>)
144
+ <span class="ruby-keyword">end</span>
145
+ <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-string">&#39;go&#39;</span>)
146
+ <span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">gets</span>
147
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">IllegalMoveError</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&#39;Invalid move&#39;</span>)
148
+ <span class="ruby-identifier">match</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/My move is : ([a-h][1-8][a-h][1-8][rkbq]?)/</span>)
149
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">match</span>[<span class="ruby-number">1</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>
150
+ <span class="ruby-keyword">end</span>
151
+ <span class="ruby-keyword">ensure</span>
152
+ <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-string">&#39;quit&#39;</span>)
153
+ <span class="ruby-identifier">pipe</span>.<span class="ruby-identifier">close</span>
154
+ <span class="ruby-keyword">end</span>
155
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">moves</span>
156
+ <span class="ruby-keyword">end</span></pre>
157
+ </div>
158
+ </div>
159
+
160
+ </div>
161
+
162
+ <div class="method">
163
+ <div class="title method-title" id="method-i-gnuchess_move-21">
164
+
165
+ <b>gnuchess_move!</b>()
166
+
167
+ <a href="../../classes/Chess/Gnuchess.html#method-i-gnuchess_move-21" name="method-i-gnuchess_move-21" class="permalink">Link</a>
168
+ </div>
169
+
170
+
171
+ <div class="description">
172
+ <p>Make a move using <a href="Gnuchess.html">Gnuchess</a> engine. This add a
173
+ new <a href="Board.html">Board</a> in the <a href="Game.html">Game</a>.
174
+ Return the next move calculated by <a href="Gnuchess.html">Gnuchess</a>. <a
175
+ href="Gnuchess.html">Gnuchess</a> must be installed!</p>
176
+ </div>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ <div class="sourcecode">
186
+
187
+ <p class="source-link">
188
+ Source:
189
+ <a href="javascript:toggleSource('method-i-gnuchess_move-21_source')" id="l_method-i-gnuchess_move-21_source">show</a>
190
+
191
+ </p>
192
+ <div id="method-i-gnuchess_move-21_source" class="dyn-source">
193
+ <pre><span class="ruby-comment"># File lib/chess/gnuchess.rb, line 39</span>
194
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">gnuchess_move!</span>
195
+ <span class="ruby-identifier">next_move</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">gnuchess_move</span>
196
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">move</span>(<span class="ruby-identifier">next_move</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">next_move</span>
197
+ <span class="ruby-keyword">end</span></pre>
198
+ </div>
199
+ </div>
200
+
201
+ </div>
202
+ </div>
203
+
204
+ </div>
205
+ </body>
206
+ </html>
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title>Chess::IllegalMoveError</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8
+ <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
+ <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
11
+ <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
15
+
16
+ </head>
17
+
18
+ <body>
19
+ <div class="banner">
20
+
21
+ <h1>
22
+ <span class="type">Class</span>
23
+ Chess::IllegalMoveError
24
+
25
+ <span class="parent">&lt;
26
+
27
+ StandardError
28
+
29
+ </span>
30
+
31
+ </h1>
32
+ <ul class="files">
33
+
34
+ <li><a href="../../files/ext/chess_c.html">ext/chess.c</a></li>
35
+
36
+ </ul>
37
+ </div>
38
+ <div id="bodyContent">
39
+ <div id="content">
40
+
41
+ <div class="description">
42
+
43
+ <p>This exception will be raised when making an illegal move.</p>
44
+
45
+ </div>
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <!-- Methods -->
78
+ </div>
79
+
80
+ </div>
81
+ </body>
82
+ </html>
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title>Chess::InvalidFenFormatError</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8
+ <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
+ <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
11
+ <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
15
+
16
+ </head>
17
+
18
+ <body>
19
+ <div class="banner">
20
+
21
+ <h1>
22
+ <span class="type">Class</span>
23
+ Chess::InvalidFenFormatError
24
+
25
+ <span class="parent">&lt;
26
+
27
+ StandardError
28
+
29
+ </span>
30
+
31
+ </h1>
32
+ <ul class="files">
33
+
34
+ <li><a href="../../files/lib/chess/exceptions_rb.html">lib/chess/exceptions.rb</a></li>
35
+
36
+ </ul>
37
+ </div>
38
+ <div id="bodyContent">
39
+ <div id="content">
40
+
41
+ <div class="description">
42
+
43
+ <p>This exception will be raised when an invalid FEN string is used.</p>
44
+
45
+ </div>
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <!-- Methods -->
78
+ </div>
79
+
80
+ </div>
81
+ </body>
82
+ </html>
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title>Chess::InvalidPgnFormatError</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8
+ <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
+ <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
11
+ <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
15
+
16
+ </head>
17
+
18
+ <body>
19
+ <div class="banner">
20
+
21
+ <h1>
22
+ <span class="type">Class</span>
23
+ Chess::InvalidPgnFormatError
24
+
25
+ <span class="parent">&lt;
26
+
27
+ StandardError
28
+
29
+ </span>
30
+
31
+ </h1>
32
+ <ul class="files">
33
+
34
+ <li><a href="../../files/lib/chess/exceptions_rb.html">lib/chess/exceptions.rb</a></li>
35
+
36
+ </ul>
37
+ </div>
38
+ <div id="bodyContent">
39
+ <div id="content">
40
+
41
+ <div class="description">
42
+
43
+ <p>This exception will be raised when a malformed PGN file is loaded.</p>
44
+
45
+ </div>
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <!-- Methods -->
78
+ </div>
79
+
80
+ </div>
81
+ </body>
82
+ </html>