chess 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Rakefile +1 -0
- data/doc/apple-touch-icon.png +0 -0
- data/doc/classes/Chess.html +162 -0
- data/doc/classes/Chess/BadNotationError.html +84 -0
- data/doc/classes/Chess/Board.html +795 -0
- data/doc/classes/Chess/CGame.html +1168 -0
- data/doc/classes/Chess/Game.html +775 -0
- data/doc/classes/Chess/Gnuchess.html +206 -0
- data/doc/classes/Chess/IllegalMoveError.html +82 -0
- data/doc/classes/Chess/InvalidFenFormatError.html +82 -0
- data/doc/classes/Chess/InvalidPgnFormatError.html +82 -0
- data/doc/classes/Chess/Pgn.html +332 -0
- data/doc/classes/Chess/UTF8Notation.html +175 -0
- data/doc/created.rid +15 -0
- data/doc/css/github.css +123 -0
- data/doc/css/main.css +323 -0
- data/doc/css/panel.css +384 -0
- data/doc/css/reset.css +48 -0
- data/doc/favicon.ico +0 -0
- data/doc/files/README_rdoc.html +122 -0
- data/doc/files/ext/bitboard_c.html +68 -0
- data/doc/files/ext/board_c.html +68 -0
- data/doc/files/ext/chess_c.html +68 -0
- data/doc/files/ext/common_c.html +68 -0
- data/doc/files/ext/game_c.html +68 -0
- data/doc/files/ext/special_c.html +68 -0
- data/doc/files/lib/chess/exceptions_rb.html +94 -0
- data/doc/files/lib/chess/game_rb.html +84 -0
- data/doc/files/lib/chess/gnuchess_rb.html +84 -0
- data/doc/files/lib/chess/pgn_rb.html +84 -0
- data/doc/files/lib/chess/utf8_notation_rb.html +84 -0
- data/doc/files/lib/chess/version_rb.html +85 -0
- data/doc/files/lib/chess_rb.html +84 -0
- data/doc/i/arrows.png +0 -0
- data/doc/i/results_bg.png +0 -0
- data/doc/i/tree_bg.png +0 -0
- data/doc/index.html +13 -0
- data/doc/js/highlight.pack.js +1 -0
- data/doc/js/jquery-1.3.2.min.js +19 -0
- data/doc/js/jquery-effect.js +593 -0
- data/doc/js/main.js +24 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searchdoc.js +449 -0
- data/doc/js/searcher.js +228 -0
- data/doc/panel/index.html +73 -0
- data/doc/panel/links.html +34 -0
- data/doc/panel/tree.js +1 -0
- data/ext/chess.c +82 -33
- data/ext/chess.h +1 -1
- data/ext/common.c +1 -1
- data/ext/common.h +1 -1
- data/ext/game.c +7 -6
- data/ext/game.h +1 -1
- data/lib/chess/exceptions.rb +2 -1
- data/lib/chess/game.rb +18 -5
- data/lib/chess/gnuchess.rb +1 -1
- data/lib/chess/utf8_notation.rb +1 -0
- data/lib/chess/version.rb +1 -1
- metadata +50 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 973c9e62761545d56d62ed051f3fdcda270eed70
|
4
|
+
data.tar.gz: f1cdd754afaf51da28c59eb883b379c14f9e6263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d609c00560340a939f9a9d2a54f3bed16dc12a97c887bae9e932d63084558867f5931348e2996e7ac5471183e0b59ca1c8553c0ddb5fb9b7c191884c4935b76
|
7
|
+
data.tar.gz: 7cde74aca5fc145faec8230cc54b8cb8384db7147f33e458512fd5a2f3ced969a18739894e2f8712de857e6e2faebbbeceffc3b7598a40d3bbf52339d7957eda
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
Binary file
|
@@ -0,0 +1,162 @@
|
|
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</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
|
24
|
+
|
25
|
+
</h1>
|
26
|
+
<ul class="files">
|
27
|
+
|
28
|
+
<li><a href="../files/ext/chess_c.html">ext/chess.c</a></li>
|
29
|
+
|
30
|
+
<li><a href="../files/lib/chess/exceptions_rb.html">lib/chess/exceptions.rb</a></li>
|
31
|
+
|
32
|
+
<li><a href="../files/lib/chess/game_rb.html">lib/chess/game.rb</a></li>
|
33
|
+
|
34
|
+
<li><a href="../files/lib/chess/gnuchess_rb.html">lib/chess/gnuchess.rb</a></li>
|
35
|
+
|
36
|
+
<li><a href="../files/lib/chess/pgn_rb.html">lib/chess/pgn.rb</a></li>
|
37
|
+
|
38
|
+
<li><a href="../files/lib/chess/utf8_notation_rb.html">lib/chess/utf8_notation.rb</a></li>
|
39
|
+
|
40
|
+
<li><a href="../files/lib/chess/version_rb.html">lib/chess/version.rb</a></li>
|
41
|
+
|
42
|
+
</ul>
|
43
|
+
</div>
|
44
|
+
<div id="bodyContent">
|
45
|
+
<div id="content">
|
46
|
+
|
47
|
+
<div class="description">
|
48
|
+
|
49
|
+
<p>The <a href="Chess.html">Chess</a> library module.</p>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Namespace -->
|
64
|
+
<div class="sectiontitle">Namespace</div>
|
65
|
+
<ul>
|
66
|
+
|
67
|
+
<li>
|
68
|
+
<span class="type">MODULE</span>
|
69
|
+
<a href="Chess/Gnuchess.html">Chess::Gnuchess</a>
|
70
|
+
</li>
|
71
|
+
|
72
|
+
<li>
|
73
|
+
<span class="type">MODULE</span>
|
74
|
+
<a href="Chess/UTF8Notation.html">Chess::UTF8Notation</a>
|
75
|
+
</li>
|
76
|
+
|
77
|
+
<li>
|
78
|
+
<span class="type">CLASS</span>
|
79
|
+
<a href="Chess/BadNotationError.html">Chess::BadNotationError</a>
|
80
|
+
</li>
|
81
|
+
|
82
|
+
<li>
|
83
|
+
<span class="type">CLASS</span>
|
84
|
+
<a href="Chess/Board.html">Chess::Board</a>
|
85
|
+
</li>
|
86
|
+
|
87
|
+
<li>
|
88
|
+
<span class="type">CLASS</span>
|
89
|
+
<a href="Chess/CGame.html">Chess::CGame</a>
|
90
|
+
</li>
|
91
|
+
|
92
|
+
<li>
|
93
|
+
<span class="type">CLASS</span>
|
94
|
+
<a href="Chess/Game.html">Chess::Game</a>
|
95
|
+
</li>
|
96
|
+
|
97
|
+
<li>
|
98
|
+
<span class="type">CLASS</span>
|
99
|
+
<a href="Chess/IllegalMoveError.html">Chess::IllegalMoveError</a>
|
100
|
+
</li>
|
101
|
+
|
102
|
+
<li>
|
103
|
+
<span class="type">CLASS</span>
|
104
|
+
<a href="Chess/InvalidFenFormatError.html">Chess::InvalidFenFormatError</a>
|
105
|
+
</li>
|
106
|
+
|
107
|
+
<li>
|
108
|
+
<span class="type">CLASS</span>
|
109
|
+
<a href="Chess/InvalidPgnFormatError.html">Chess::InvalidPgnFormatError</a>
|
110
|
+
</li>
|
111
|
+
|
112
|
+
<li>
|
113
|
+
<span class="type">CLASS</span>
|
114
|
+
<a href="Chess/Pgn.html">Chess::Pgn</a>
|
115
|
+
</li>
|
116
|
+
|
117
|
+
</ul>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<!-- Section constants -->
|
135
|
+
<div class="sectiontitle">Constants</div>
|
136
|
+
<table border='0' cellpadding='5'>
|
137
|
+
|
138
|
+
<tr valign='top'>
|
139
|
+
<td class="attr-name">VERSION</td>
|
140
|
+
<td>=</td>
|
141
|
+
<td class="attr-value">'0.1.0'</td>
|
142
|
+
</tr>
|
143
|
+
|
144
|
+
<tr valign='top'>
|
145
|
+
<td> </td>
|
146
|
+
<td colspan="2" class="attr-desc"><p>The library version.</p></td>
|
147
|
+
</tr>
|
148
|
+
|
149
|
+
|
150
|
+
</table>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- Methods -->
|
158
|
+
</div>
|
159
|
+
|
160
|
+
</div>
|
161
|
+
</body>
|
162
|
+
</html>
|
@@ -0,0 +1,84 @@
|
|
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::BadNotationError</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::BadNotationError
|
24
|
+
|
25
|
+
<span class="parent"><
|
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 short algebraic chess
|
44
|
+
notation string is passed to the <a
|
45
|
+
href="Game.html#method-i-move">Chess::Game#move</a> function.</p>
|
46
|
+
|
47
|
+
</div>
|
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
|
+
|
78
|
+
|
79
|
+
<!-- Methods -->
|
80
|
+
</div>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
</body>
|
84
|
+
</html>
|
@@ -0,0 +1,795 @@
|
|
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::Board</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::Board
|
24
|
+
|
25
|
+
<span class="parent"><
|
26
|
+
|
27
|
+
Object
|
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 class rappresents a chess board. The rappresentation of the board use
|
44
|
+
<em>bitboards</em> where each bit represents a game position or state,
|
45
|
+
designed for optimization of speed and/or memory or disk use in mass
|
46
|
+
calculations. This ensures a fast library.</p>
|
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>#</dt>
|
68
|
+
<dd>
|
69
|
+
<ul>
|
70
|
+
|
71
|
+
|
72
|
+
<li>
|
73
|
+
<a href="#method-i-5B-5D">[]</a>
|
74
|
+
</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</dd>
|
78
|
+
|
79
|
+
<dt>A</dt>
|
80
|
+
<dd>
|
81
|
+
<ul>
|
82
|
+
|
83
|
+
|
84
|
+
<li>
|
85
|
+
<a href="#method-i-active_color">active_color</a>
|
86
|
+
</li>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</dd>
|
90
|
+
|
91
|
+
<dt>C</dt>
|
92
|
+
<dd>
|
93
|
+
<ul>
|
94
|
+
|
95
|
+
|
96
|
+
<li>
|
97
|
+
<a href="#method-i-check-3F">check?</a>,
|
98
|
+
</li>
|
99
|
+
|
100
|
+
|
101
|
+
<li>
|
102
|
+
<a href="#method-i-checkmate-3F">checkmate?</a>
|
103
|
+
</li>
|
104
|
+
|
105
|
+
</ul>
|
106
|
+
</dd>
|
107
|
+
|
108
|
+
<dt>F</dt>
|
109
|
+
<dd>
|
110
|
+
<ul>
|
111
|
+
|
112
|
+
|
113
|
+
<li>
|
114
|
+
<a href="#method-i-fifty_rule_move-3F">fifty_rule_move?</a>,
|
115
|
+
</li>
|
116
|
+
|
117
|
+
|
118
|
+
<li>
|
119
|
+
<a href="#method-i-fullmove_number">fullmove_number</a>
|
120
|
+
</li>
|
121
|
+
|
122
|
+
</ul>
|
123
|
+
</dd>
|
124
|
+
|
125
|
+
<dt>H</dt>
|
126
|
+
<dd>
|
127
|
+
<ul>
|
128
|
+
|
129
|
+
|
130
|
+
<li>
|
131
|
+
<a href="#method-i-halfmove_clock">halfmove_clock</a>
|
132
|
+
</li>
|
133
|
+
|
134
|
+
</ul>
|
135
|
+
</dd>
|
136
|
+
|
137
|
+
<dt>I</dt>
|
138
|
+
<dd>
|
139
|
+
<ul>
|
140
|
+
|
141
|
+
|
142
|
+
<li>
|
143
|
+
<a href="#method-i-insufficient_material-3F">insufficient_material?</a>
|
144
|
+
</li>
|
145
|
+
|
146
|
+
</ul>
|
147
|
+
</dd>
|
148
|
+
|
149
|
+
<dt>P</dt>
|
150
|
+
<dd>
|
151
|
+
<ul>
|
152
|
+
|
153
|
+
|
154
|
+
<li>
|
155
|
+
<a href="#method-i-placement">placement</a>
|
156
|
+
</li>
|
157
|
+
|
158
|
+
</ul>
|
159
|
+
</dd>
|
160
|
+
|
161
|
+
<dt>S</dt>
|
162
|
+
<dd>
|
163
|
+
<ul>
|
164
|
+
|
165
|
+
|
166
|
+
<li>
|
167
|
+
<a href="#method-i-stalemate-3F">stalemate?</a>
|
168
|
+
</li>
|
169
|
+
|
170
|
+
</ul>
|
171
|
+
</dd>
|
172
|
+
|
173
|
+
<dt>T</dt>
|
174
|
+
<dd>
|
175
|
+
<ul>
|
176
|
+
|
177
|
+
|
178
|
+
<li>
|
179
|
+
<a href="#method-i-to_fen">to_fen</a>,
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li>
|
184
|
+
<a href="#method-i-to_s">to_s</a>
|
185
|
+
</li>
|
186
|
+
|
187
|
+
</ul>
|
188
|
+
</dd>
|
189
|
+
|
190
|
+
</dl>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<!-- Methods -->
|
210
|
+
|
211
|
+
<div class="sectiontitle">Instance Public methods</div>
|
212
|
+
|
213
|
+
<div class="method">
|
214
|
+
<div class="title method-title" id="method-i-5B-5D">
|
215
|
+
|
216
|
+
<b>[square]
|
217
|
+
</b>
|
218
|
+
|
219
|
+
<a href="../../classes/Chess/Board.html#method-i-5B-5D" name="method-i-5B-5D" class="permalink">Link</a>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
|
223
|
+
<div class="description">
|
224
|
+
<p>Returns the piece on the <code>square</code> of the chessboard. If there is
|
225
|
+
no piece or the square is not valid return the blank string.</p>
|
226
|
+
|
227
|
+
<p>Each square on the chessboard is represented by an integer according to the
|
228
|
+
following scheme:</p>
|
229
|
+
|
230
|
+
<pre><code>8 | 56 57 58 59 60 61 62 63
|
231
|
+
7 | 48 49 50 51 52 53 54 55
|
232
|
+
6 | 40 41 42 43 44 45 46 47
|
233
|
+
5 | 32 33 34 35 36 37 38 39
|
234
|
+
4 | 24 25 26 27 28 29 30 31
|
235
|
+
3 | 16 17 18 19 20 21 22 23
|
236
|
+
2 | 8 9 10 11 12 13 14 15
|
237
|
+
1 | 0 1 2 3 4 5 6 7
|
238
|
+
+-------------------------
|
239
|
+
a b c d e f g h</code></pre>
|
240
|
+
|
241
|
+
<p>Parameters are:</p>
|
242
|
+
<dl class="rdoc-list note-list"><dt><code>square</code>
|
243
|
+
<dd>
|
244
|
+
<p>the square of the board. Can be a fixnum between 0 and 63 or a</p>
|
245
|
+
</dd></dl>
|
246
|
+
|
247
|
+
<p>string like 'a2', 'c5'… The string must be downcase.</p>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
<div class="sourcecode">
|
258
|
+
|
259
|
+
<p class="source-link">
|
260
|
+
Source:
|
261
|
+
<a href="javascript:toggleSource('method-i-5B-5D_source')" id="l_method-i-5B-5D_source">show</a>
|
262
|
+
|
263
|
+
</p>
|
264
|
+
<div id="method-i-5B-5D_source" class="dyn-source">
|
265
|
+
<pre>VALUE
|
266
|
+
board_get_piece (VALUE self, VALUE square)
|
267
|
+
{
|
268
|
+
Board *board;
|
269
|
+
Data_Get_Struct (self, Board, board);
|
270
|
+
int i;
|
271
|
+
char piece[2];
|
272
|
+
piece[1] = '\0';
|
273
|
+
if (TYPE (square) == T_STRING)
|
274
|
+
i = coord_to_square (StringValuePtr (square));
|
275
|
+
else
|
276
|
+
i = FIX2INT (square);
|
277
|
+
piece[0] = board->placement[i];
|
278
|
+
return rb_str_new2 (piece);
|
279
|
+
}</pre>
|
280
|
+
</div>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method">
|
286
|
+
<div class="title method-title" id="method-i-active_color">
|
287
|
+
|
288
|
+
<b>active_color
|
289
|
+
</b>
|
290
|
+
|
291
|
+
<a href="../../classes/Chess/Board.html#method-i-active_color" name="method-i-active_color" class="permalink">Link</a>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
<div class="description">
|
296
|
+
<p>Returns the active color: <code>false</code> means white turn,
|
297
|
+
<code>true</code> means black turn.</p>
|
298
|
+
</div>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
<div class="sourcecode">
|
308
|
+
|
309
|
+
<p class="source-link">
|
310
|
+
Source:
|
311
|
+
<a href="javascript:toggleSource('method-i-active_color_source')" id="l_method-i-active_color_source">show</a>
|
312
|
+
|
313
|
+
</p>
|
314
|
+
<div id="method-i-active_color_source" class="dyn-source">
|
315
|
+
<pre>VALUE
|
316
|
+
board_active_color (VALUE self)
|
317
|
+
{
|
318
|
+
Board *board;
|
319
|
+
Data_Get_Struct (self, Board, board);
|
320
|
+
if (board->active_color)
|
321
|
+
return Qtrue;
|
322
|
+
else
|
323
|
+
return Qfalse;
|
324
|
+
}</pre>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
</div>
|
329
|
+
|
330
|
+
<div class="method">
|
331
|
+
<div class="title method-title" id="method-i-check-3F">
|
332
|
+
|
333
|
+
<b>check?
|
334
|
+
</b>
|
335
|
+
|
336
|
+
<a href="../../classes/Chess/Board.html#method-i-check-3F" name="method-i-check-3F" class="permalink">Link</a>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
|
340
|
+
<div class="description">
|
341
|
+
<p>Returns <code>true</code> if the king of the color that has the turn is in
|
342
|
+
check, <code>false</code> otherwise.</p>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<div class="sourcecode">
|
353
|
+
|
354
|
+
<p class="source-link">
|
355
|
+
Source:
|
356
|
+
<a href="javascript:toggleSource('method-i-check-3F_source')" id="l_method-i-check-3F_source">show</a>
|
357
|
+
|
358
|
+
</p>
|
359
|
+
<div id="method-i-check-3F_source" class="dyn-source">
|
360
|
+
<pre>VALUE
|
361
|
+
board_king_in_check (VALUE self)
|
362
|
+
{
|
363
|
+
Board *board;
|
364
|
+
Data_Get_Struct (self, Board, board);
|
365
|
+
if (king_in_check (board, board->active_color))
|
366
|
+
return Qtrue;
|
367
|
+
else
|
368
|
+
return Qfalse;
|
369
|
+
}</pre>
|
370
|
+
</div>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
</div>
|
374
|
+
|
375
|
+
<div class="method">
|
376
|
+
<div class="title method-title" id="method-i-checkmate-3F">
|
377
|
+
|
378
|
+
<b>checkmate?
|
379
|
+
</b>
|
380
|
+
|
381
|
+
<a href="../../classes/Chess/Board.html#method-i-checkmate-3F" name="method-i-checkmate-3F" class="permalink">Link</a>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
|
385
|
+
<div class="description">
|
386
|
+
<p>Returns <code>true</code> if the king of the color that has the turn is in
|
387
|
+
checkmate, <code>false</code> otherwise.</p>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
<div class="sourcecode">
|
398
|
+
|
399
|
+
<p class="source-link">
|
400
|
+
Source:
|
401
|
+
<a href="javascript:toggleSource('method-i-checkmate-3F_source')" id="l_method-i-checkmate-3F_source">show</a>
|
402
|
+
|
403
|
+
</p>
|
404
|
+
<div id="method-i-checkmate-3F_source" class="dyn-source">
|
405
|
+
<pre>VALUE
|
406
|
+
board_king_in_checkmate (VALUE self)
|
407
|
+
{
|
408
|
+
Board *board;
|
409
|
+
Data_Get_Struct (self, Board, board);
|
410
|
+
if (king_in_checkmate (board, board->active_color))
|
411
|
+
return Qtrue;
|
412
|
+
else
|
413
|
+
return Qfalse;
|
414
|
+
}</pre>
|
415
|
+
</div>
|
416
|
+
</div>
|
417
|
+
|
418
|
+
</div>
|
419
|
+
|
420
|
+
<div class="method">
|
421
|
+
<div class="title method-title" id="method-i-fifty_rule_move-3F">
|
422
|
+
|
423
|
+
<b>fifty_move_rule?
|
424
|
+
</b>
|
425
|
+
|
426
|
+
<a href="../../classes/Chess/Board.html#method-i-fifty_rule_move-3F" name="method-i-fifty_rule_move-3F" class="permalink">Link</a>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
|
430
|
+
<div class="description">
|
431
|
+
<p>Returns <code>true</code> if a player can claim draw by the fifty-move
|
432
|
+
rule, <code>false</code> otherwise.</p>
|
433
|
+
</div>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
<div class="sourcecode">
|
443
|
+
|
444
|
+
<p class="source-link">
|
445
|
+
Source:
|
446
|
+
<a href="javascript:toggleSource('method-i-fifty_rule_move-3F_source')" id="l_method-i-fifty_rule_move-3F_source">show</a>
|
447
|
+
|
448
|
+
</p>
|
449
|
+
<div id="method-i-fifty_rule_move-3F_source" class="dyn-source">
|
450
|
+
<pre>VALUE
|
451
|
+
board_fifty_move_rule (VALUE self)
|
452
|
+
{
|
453
|
+
Board *board;
|
454
|
+
Data_Get_Struct (self, Board, board);
|
455
|
+
if (fifty_move_rule (board))
|
456
|
+
return Qtrue;
|
457
|
+
else
|
458
|
+
return Qfalse;
|
459
|
+
}</pre>
|
460
|
+
</div>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
</div>
|
464
|
+
|
465
|
+
<div class="method">
|
466
|
+
<div class="title method-title" id="method-i-fullmove_number">
|
467
|
+
|
468
|
+
<b>fullmove_number
|
469
|
+
</b>
|
470
|
+
|
471
|
+
<a href="../../classes/Chess/Board.html#method-i-fullmove_number" name="method-i-fullmove_number" class="permalink">Link</a>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
|
475
|
+
<div class="description">
|
476
|
+
<p>Returns the fullmove number: the number of the full move. It starts at 1,
|
477
|
+
and is incremented after black's move.</p>
|
478
|
+
</div>
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
<div class="sourcecode">
|
488
|
+
|
489
|
+
<p class="source-link">
|
490
|
+
Source:
|
491
|
+
<a href="javascript:toggleSource('method-i-fullmove_number_source')" id="l_method-i-fullmove_number_source">show</a>
|
492
|
+
|
493
|
+
</p>
|
494
|
+
<div id="method-i-fullmove_number_source" class="dyn-source">
|
495
|
+
<pre>VALUE
|
496
|
+
board_fullmove_number (VALUE self)
|
497
|
+
{
|
498
|
+
Board *board;
|
499
|
+
Data_Get_Struct (self, Board, board);
|
500
|
+
return INT2FIX (board->fullmove_number);
|
501
|
+
}</pre>
|
502
|
+
</div>
|
503
|
+
</div>
|
504
|
+
|
505
|
+
</div>
|
506
|
+
|
507
|
+
<div class="method">
|
508
|
+
<div class="title method-title" id="method-i-halfmove_clock">
|
509
|
+
|
510
|
+
<b>halfmove_clock
|
511
|
+
</b>
|
512
|
+
|
513
|
+
<a href="../../classes/Chess/Board.html#method-i-halfmove_clock" name="method-i-halfmove_clock" class="permalink">Link</a>
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
<div class="description">
|
518
|
+
<p>Returns the halfmove clock that is the number of halfmoves since the last
|
519
|
+
pawn advance or capture. This is used to determine if a draw can be claimed
|
520
|
+
under the fifty-move rule.</p>
|
521
|
+
</div>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
<div class="sourcecode">
|
531
|
+
|
532
|
+
<p class="source-link">
|
533
|
+
Source:
|
534
|
+
<a href="javascript:toggleSource('method-i-halfmove_clock_source')" id="l_method-i-halfmove_clock_source">show</a>
|
535
|
+
|
536
|
+
</p>
|
537
|
+
<div id="method-i-halfmove_clock_source" class="dyn-source">
|
538
|
+
<pre>VALUE
|
539
|
+
board_halfmove_clock (VALUE self)
|
540
|
+
{
|
541
|
+
Board *board;
|
542
|
+
Data_Get_Struct (self, Board, board);
|
543
|
+
return INT2FIX (board->halfmove_clock);
|
544
|
+
}</pre>
|
545
|
+
</div>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
</div>
|
549
|
+
|
550
|
+
<div class="method">
|
551
|
+
<div class="title method-title" id="method-i-insufficient_material-3F">
|
552
|
+
|
553
|
+
<b>insufficient_material?
|
554
|
+
</b>
|
555
|
+
|
556
|
+
<a href="../../classes/Chess/Board.html#method-i-insufficient_material-3F" name="method-i-insufficient_material-3F" class="permalink">Link</a>
|
557
|
+
</div>
|
558
|
+
|
559
|
+
|
560
|
+
<div class="description">
|
561
|
+
<p>Returns <code>true</code> if the board has insufficient material to
|
562
|
+
checkmate, <code>false</code> otherwise.</p>
|
563
|
+
</div>
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
<div class="sourcecode">
|
573
|
+
|
574
|
+
<p class="source-link">
|
575
|
+
Source:
|
576
|
+
<a href="javascript:toggleSource('method-i-insufficient_material-3F_source')" id="l_method-i-insufficient_material-3F_source">show</a>
|
577
|
+
|
578
|
+
</p>
|
579
|
+
<div id="method-i-insufficient_material-3F_source" class="dyn-source">
|
580
|
+
<pre>VALUE
|
581
|
+
board_insufficient_material (VALUE self)
|
582
|
+
{
|
583
|
+
Board *board;
|
584
|
+
Data_Get_Struct (self, Board, board);
|
585
|
+
if (insufficient_material (board))
|
586
|
+
return Qtrue;
|
587
|
+
else
|
588
|
+
return Qfalse;
|
589
|
+
}</pre>
|
590
|
+
</div>
|
591
|
+
</div>
|
592
|
+
|
593
|
+
</div>
|
594
|
+
|
595
|
+
<div class="method">
|
596
|
+
<div class="title method-title" id="method-i-placement">
|
597
|
+
|
598
|
+
<b>placement { |piece, index| block }
|
599
|
+
</b>
|
600
|
+
|
601
|
+
<a href="../../classes/Chess/Board.html#method-i-placement" name="method-i-placement" class="permalink">Link</a>
|
602
|
+
</div>
|
603
|
+
|
604
|
+
|
605
|
+
<div class="description">
|
606
|
+
<p>Calls <code>block</code> once for each square in the board, passing the
|
607
|
+
<code>piece</code> in the square and the <code>index</code> as parameters.
|
608
|
+
Return self. If no block is given, the array of pieces is returned instead.</p>
|
609
|
+
</div>
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
<div class="sourcecode">
|
619
|
+
|
620
|
+
<p class="source-link">
|
621
|
+
Source:
|
622
|
+
<a href="javascript:toggleSource('method-i-placement_source')" id="l_method-i-placement_source">show</a>
|
623
|
+
|
624
|
+
</p>
|
625
|
+
<div id="method-i-placement_source" class="dyn-source">
|
626
|
+
<pre>VALUE
|
627
|
+
board_placement (VALUE self)
|
628
|
+
{
|
629
|
+
Board *board;
|
630
|
+
Data_Get_Struct (self, Board, board);
|
631
|
+
int i;
|
632
|
+
char piece[2];
|
633
|
+
piece[1] = '\0';
|
634
|
+
if (!rb_block_given_p ())
|
635
|
+
{
|
636
|
+
VALUE placement = rb_ary_new ();
|
637
|
+
for (i = 0; i < 64; i++)
|
638
|
+
{
|
639
|
+
piece[0] = board->placement[i];
|
640
|
+
rb_ary_push (placement, rb_str_new2 (piece));
|
641
|
+
}
|
642
|
+
return placement;
|
643
|
+
}
|
644
|
+
else
|
645
|
+
{
|
646
|
+
for (i = 0; i < 64; i++)
|
647
|
+
{
|
648
|
+
piece[0] = board->placement[i];
|
649
|
+
rb_yield_values (2, rb_str_new2 (piece), INT2FIX (i));
|
650
|
+
}
|
651
|
+
return self;
|
652
|
+
}
|
653
|
+
}</pre>
|
654
|
+
</div>
|
655
|
+
</div>
|
656
|
+
|
657
|
+
</div>
|
658
|
+
|
659
|
+
<div class="method">
|
660
|
+
<div class="title method-title" id="method-i-stalemate-3F">
|
661
|
+
|
662
|
+
<b>stalemate?
|
663
|
+
</b>
|
664
|
+
|
665
|
+
<a href="../../classes/Chess/Board.html#method-i-stalemate-3F" name="method-i-stalemate-3F" class="permalink">Link</a>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
|
669
|
+
<div class="description">
|
670
|
+
<p>Returns <code>true</code> if the pieces of the color that has the turn are
|
671
|
+
in stalemate, <code>false</code> otherwise.</p>
|
672
|
+
</div>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
<div class="sourcecode">
|
682
|
+
|
683
|
+
<p class="source-link">
|
684
|
+
Source:
|
685
|
+
<a href="javascript:toggleSource('method-i-stalemate-3F_source')" id="l_method-i-stalemate-3F_source">show</a>
|
686
|
+
|
687
|
+
</p>
|
688
|
+
<div id="method-i-stalemate-3F_source" class="dyn-source">
|
689
|
+
<pre>VALUE
|
690
|
+
board_stalemate (VALUE self)
|
691
|
+
{
|
692
|
+
Board *board;
|
693
|
+
Data_Get_Struct (self, Board, board);
|
694
|
+
if (stalemate (board, board->active_color))
|
695
|
+
return Qtrue;
|
696
|
+
else
|
697
|
+
return Qfalse;
|
698
|
+
}</pre>
|
699
|
+
</div>
|
700
|
+
</div>
|
701
|
+
|
702
|
+
</div>
|
703
|
+
|
704
|
+
<div class="method">
|
705
|
+
<div class="title method-title" id="method-i-to_fen">
|
706
|
+
|
707
|
+
<b>to_fen
|
708
|
+
</b>
|
709
|
+
|
710
|
+
<a href="../../classes/Chess/Board.html#method-i-to_fen" name="method-i-to_fen" class="permalink">Link</a>
|
711
|
+
</div>
|
712
|
+
|
713
|
+
|
714
|
+
<div class="description">
|
715
|
+
<p>Return the FEN string of the board.</p>
|
716
|
+
</div>
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
<div class="sourcecode">
|
726
|
+
|
727
|
+
<p class="source-link">
|
728
|
+
Source:
|
729
|
+
<a href="javascript:toggleSource('method-i-to_fen_source')" id="l_method-i-to_fen_source">show</a>
|
730
|
+
|
731
|
+
</p>
|
732
|
+
<div id="method-i-to_fen_source" class="dyn-source">
|
733
|
+
<pre>VALUE
|
734
|
+
board_to_fen (VALUE self)
|
735
|
+
{
|
736
|
+
Board *board;
|
737
|
+
Data_Get_Struct (self, Board, board);
|
738
|
+
char *fen = to_fen (board);
|
739
|
+
VALUE rb_fen = rb_str_new2 (fen);
|
740
|
+
free (fen);
|
741
|
+
return rb_fen;
|
742
|
+
}</pre>
|
743
|
+
</div>
|
744
|
+
</div>
|
745
|
+
|
746
|
+
</div>
|
747
|
+
|
748
|
+
<div class="method">
|
749
|
+
<div class="title method-title" id="method-i-to_s">
|
750
|
+
|
751
|
+
<b>to_s
|
752
|
+
</b>
|
753
|
+
|
754
|
+
<a href="../../classes/Chess/Board.html#method-i-to_s" name="method-i-to_s" class="permalink">Link</a>
|
755
|
+
</div>
|
756
|
+
|
757
|
+
|
758
|
+
<div class="description">
|
759
|
+
<p><a href="Board.html">Board</a> to string.</p>
|
760
|
+
</div>
|
761
|
+
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
<div class="sourcecode">
|
770
|
+
|
771
|
+
<p class="source-link">
|
772
|
+
Source:
|
773
|
+
<a href="javascript:toggleSource('method-i-to_s_source')" id="l_method-i-to_s_source">show</a>
|
774
|
+
|
775
|
+
</p>
|
776
|
+
<div id="method-i-to_s_source" class="dyn-source">
|
777
|
+
<pre>VALUE
|
778
|
+
board_to_s (VALUE self)
|
779
|
+
{
|
780
|
+
Board *board;
|
781
|
+
Data_Get_Struct (self, Board, board);
|
782
|
+
char *s = print_board (board);
|
783
|
+
VALUE rb_s = rb_str_new2 (s);
|
784
|
+
free (s);
|
785
|
+
return rb_s;
|
786
|
+
}</pre>
|
787
|
+
</div>
|
788
|
+
</div>
|
789
|
+
|
790
|
+
</div>
|
791
|
+
</div>
|
792
|
+
|
793
|
+
</div>
|
794
|
+
</body>
|
795
|
+
</html>
|