| 1 |
<html> |
| 2 |
<head> |
| 3 |
<style> |
| 4 |
a.move {color: black; text-decoration: none} |
| 5 |
</style> |
| 6 |
<script language="javascript" type="text/javascript"> |
| 7 |
|
| 8 |
//image data |
| 9 |
var pieces = new Array("", "wp", "wn", "wb", "wr", "wq", "wk", "bp", "bn", "bb", "br", "bq", "bk"); |
| 10 |
|
| 11 |
ws = new Image(); |
| 12 |
ws.src = "<pieces/>/ws.png"; |
| 13 |
wpws = new Image(); |
| 14 |
wpws.src = "<pieces/>/wpws.png"; |
| 15 |
wnws = new Image(); |
| 16 |
wnws.src = "<pieces/>/wnws.png"; |
| 17 |
wbws = new Image(); |
| 18 |
wbws.src = "<pieces/>/wbws.png"; |
| 19 |
wrws = new Image(); |
| 20 |
wrws.src = "<pieces/>/wrws.png"; |
| 21 |
wqws = new Image(); |
| 22 |
wqws.src = "<pieces/>/wqws.png"; |
| 23 |
wkws = new Image(); |
| 24 |
wkws.src = "<pieces/>/wkws.png"; |
| 25 |
bpws = new Image(); |
| 26 |
bpws.src = "<pieces/>/bpws.png"; |
| 27 |
bnws = new Image(); |
| 28 |
bnws.src = "<pieces/>/bnws.png"; |
| 29 |
bbws = new Image(); |
| 30 |
bbws.src = "<pieces/>/bbws.png"; |
| 31 |
brws = new Image(); |
| 32 |
brws.src = "<pieces/>/brws.png"; |
| 33 |
bqws = new Image(); |
| 34 |
bqws.src = "<pieces/>/bqws.png"; |
| 35 |
bkws = new Image(); |
| 36 |
bkws.src = "<pieces/>/bkws.png"; |
| 37 |
bs = new Image(); |
| 38 |
bs.src = "<pieces/>/bs.png"; |
| 39 |
wpbs = new Image(); |
| 40 |
wpbs.src = "<pieces/>/wpbs.png"; |
| 41 |
wnbs = new Image(); |
| 42 |
wnbs.src = "<pieces/>/wnbs.png"; |
| 43 |
wbbs = new Image(); |
| 44 |
wbbs.src = "<pieces/>/wbbs.png"; |
| 45 |
wrbs = new Image(); |
| 46 |
wrbs.src = "<pieces/>/wrbs.png"; |
| 47 |
wqbs = new Image(); |
| 48 |
wqbs.src = "<pieces/>/wqbs.png"; |
| 49 |
wkbs = new Image(); |
| 50 |
wkbs.src = "<pieces/>/wkbs.png"; |
| 51 |
bpbs = new Image(); |
| 52 |
bpbs.src = "<pieces/>/bpbs.png"; |
| 53 |
bnbs = new Image(); |
| 54 |
bnbs.src = "<pieces/>/bnbs.png"; |
| 55 |
bbbs = new Image(); |
| 56 |
bbbs.src = "<pieces/>/bbbs.png"; |
| 57 |
brbs = new Image(); |
| 58 |
brbs.src = "<pieces/>/brbs.png"; |
| 59 |
bqbs = new Image(); |
| 60 |
bqbs.src = "<pieces/>/bqbs.png"; |
| 61 |
bkbs = new Image(); |
| 62 |
bkbs.src = "<pieces/>/bkbs.png"; |
| 63 |
|
| 64 |
|
| 65 |
//initial/current position |
| 66 |
var variation = 0; |
| 67 |
var move = 0; |
| 68 |
var flipped = false; |
| 69 |
var board = new Array(10,8,9,11,12,9,8,10,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,4,2,3,5,6,3,2,4); |
| 70 |
|
| 71 |
//initial timerID |
| 72 |
var intervalID = -1; |
| 73 |
|
| 74 |
function autoplay(interval) |
| 75 |
{ |
| 76 |
if(intervalID != -1) |
| 77 |
{ |
| 78 |
clearInterval(intervalID); |
| 79 |
} |
| 80 |
|
| 81 |
if(interval != -1) |
| 82 |
{ |
| 83 |
intervalID = setInterval("forward()", interval * 1000); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
function flip() |
| 88 |
{ |
| 89 |
var temp; |
| 90 |
for(square = 0; square < 32; square++) |
| 91 |
{ |
| 92 |
temp = board[square]; |
| 93 |
board[square] = board[63 - square]; |
| 94 |
board[63 - square] = temp |
| 95 |
} |
| 96 |
flipped = ~flipped; |
| 97 |
update(); |
| 98 |
} |
| 99 |
|
| 100 |
function domove() |
| 101 |
{ |
| 102 |
var source = parent.game.moves[variation][move * 4]; |
| 103 |
var destination = parent.game.moves[variation][move * 4 + 1]; |
| 104 |
|
| 105 |
if(source < 0) |
| 106 |
{ |
| 107 |
return; |
| 108 |
} |
| 109 |
|
| 110 |
if(flipped) |
| 111 |
{ |
| 112 |
source = 63 - source; |
| 113 |
destination = 63 - destination; |
| 114 |
} |
| 115 |
|
| 116 |
board[destination] = board[source]; |
| 117 |
board[source] = 0; |
| 118 |
|
| 119 |
if(parent.game.moves[variation][move * 4 + 2] < -1) |
| 120 |
{ |
| 121 |
board[destination] = - parent.game.moves[variation][move * 4 + 2]; |
| 122 |
} |
| 123 |
|
| 124 |
source = parent.game.moves[variation][move * 4 + 2]; |
| 125 |
destination = parent.game.moves[variation][move * 4 + 3]; |
| 126 |
|
| 127 |
if(flipped) |
| 128 |
{ |
| 129 |
source = 63 - source; |
| 130 |
destination = 63 - destination; |
| 131 |
} |
| 132 |
|
| 133 |
if(source >= 0) |
| 134 |
{ |
| 135 |
board[destination] = board[source]; |
| 136 |
board[source] = 0; |
| 137 |
} |
| 138 |
|
| 139 |
move++; |
| 140 |
} |
| 141 |
|
| 142 |
function jumpto(target_variation, target_move) |
| 143 |
{ |
| 144 |
var route; |
| 145 |
unhighlight(); |
| 146 |
reset(); |
| 147 |
|
| 148 |
while(variation != target_variation) |
| 149 |
{ |
| 150 |
route = target_variation; |
| 151 |
|
| 152 |
while(parent.game.parents[route][0] != variation) |
| 153 |
{ |
| 154 |
route = parent.game.parents[route][0]; |
| 155 |
} |
| 156 |
|
| 157 |
while(move != parent.game.parents[route][1]) |
| 158 |
{ |
| 159 |
domove(); |
| 160 |
} |
| 161 |
|
| 162 |
variation = route; |
| 163 |
move = 0; |
| 164 |
} |
| 165 |
|
| 166 |
while(move != target_move) |
| 167 |
{ |
| 168 |
domove(); |
| 169 |
} |
| 170 |
|
| 171 |
update(); |
| 172 |
} |
| 173 |
|
| 174 |
function reset() |
| 175 |
{ |
| 176 |
variation = 0; |
| 177 |
move = 0; |
| 178 |
|
| 179 |
for(square = 0; square < 64; square++) |
| 180 |
{ |
| 181 |
if(flipped) |
| 182 |
{ |
| 183 |
board[square] = parent.game.initial[63 - square]; |
| 184 |
} |
| 185 |
else |
| 186 |
{ |
| 187 |
board[square] = parent.game.initial[square]; |
| 188 |
} |
| 189 |
} |
| 190 |
} |
| 191 |
|
| 192 |
function unhighlight() |
| 193 |
{ |
| 194 |
if(move > 0) |
| 195 |
{ |
| 196 |
parent.game.document.getElementById("v" + variation + "m" + move).style.background = "white"; |
| 197 |
} |
| 198 |
} |
| 199 |
|
| 200 |
function update() |
| 201 |
{ |
| 202 |
for(square = 0; square < 64; square++) |
| 203 |
{ |
| 204 |
document.getElementById("s" + square).src = "<pieces/>/" + pieces[board[square]] + (((square % 8 + Math.floor(square / 8)) % 2) ? "bs" : "ws") + ".png"; |
| 205 |
} |
| 206 |
|
| 207 |
if(move != 0) |
| 208 |
{ |
| 209 |
parent.game.document.getElementById("v" + variation + "m" + move).style.background = "silver"; |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
function first() |
| 214 |
{ |
| 215 |
unhighlight(); |
| 216 |
reset(); |
| 217 |
update(); |
| 218 |
} |
| 219 |
|
| 220 |
function backward() |
| 221 |
{ |
| 222 |
if(move > 1) |
| 223 |
{ |
| 224 |
jumpto(variation, move - 1); |
| 225 |
} |
| 226 |
else |
| 227 |
{ |
| 228 |
if(parent.game.parents[variation][0] == -1) |
| 229 |
{ |
| 230 |
jumpto(0, 0); |
| 231 |
} |
| 232 |
else |
| 233 |
{ |
| 234 |
jumpto(parent.game.parents[variation][0], parent.game.parents[variation][1]); |
| 235 |
} |
| 236 |
} |
| 237 |
} |
| 238 |
|
| 239 |
function forward() |
| 240 |
{ |
| 241 |
unhighlight(); |
| 242 |
domove(); |
| 243 |
update(); |
| 244 |
} |
| 245 |
|
| 246 |
function last() |
| 247 |
{ |
| 248 |
unhighlight(); |
| 249 |
while(parent.game.moves[variation][move * 4] != -1) |
| 250 |
{ |
| 251 |
domove(); |
| 252 |
} |
| 253 |
update(); |
| 254 |
} |
| 255 |
|
| 256 |
</script> |
| 257 |
</head> |
| 258 |
<body> |
| 259 |
<table> |
| 260 |
<tr><td align="center" valign="top"> |
| 261 |
<gamelist/> |
| 262 |
</td></tr> |
| 263 |
<tr><td align="center" valign="top" style="padding-top: 16px"> |
| 264 |
<table style="border: double; padding: 1" cellpadding="0" cellspacing="0" width="256" height="256"> |
| 265 |
<tr> |
| 266 |
<td width="32" height="32"><img id="s0" src="<pieces/>/brws.png"></td> |
| 267 |
<td width="32" height="32"><img id="s1" src="<pieces/>/bnbs.png"></td> |
| 268 |
<td width="32" height="32"><img id="s2" src="<pieces/>/bbws.png"></td> |
| 269 |
<td width="32" height="32"><img id="s3" src="<pieces/>/bqbs.png"></td> |
| 270 |
<td width="32" height="32"><img id="s4" src="<pieces/>/bkws.png"></td> |
| 271 |
<td width="32" height="32"><img id="s5" src="<pieces/>/bbbs.png"></td> |
| 272 |
<td width="32" height="32"><img id="s6" src="<pieces/>/bnws.png"></td> |
| 273 |
<td width="32" height="32"><img id="s7" src="<pieces/>/brbs.png"></td> |
| 274 |
</tr> |
| 275 |
<tr> |
| 276 |
<td width="32" height="32"><img id="s8" src="<pieces/>/bpbs.png"></td> |
| 277 |
<td width="32" height="32"><img id="s9" src="<pieces/>/bpws.png"></td> |
| 278 |
<td width="32" height="32"><img id="s10" src="<pieces/>/bpbs.png"></td> |
| 279 |
<td width="32" height="32"><img id="s11" src="<pieces/>/bpws.png"></td> |
| 280 |
<td width="32" height="32"><img id="s12" src="<pieces/>/bpbs.png"></td> |
| 281 |
<td width="32" height="32"><img id="s13" src="<pieces/>/bpws.png"></td> |
| 282 |
<td width="32" height="32"><img id="s14" src="<pieces/>/bpbs.png"></td> |
| 283 |
<td width="32" height="32"><img id="s15" src="<pieces/>/bpws.png"></td> |
| 284 |
</tr> |
| 285 |
<tr> |
| 286 |
<td width="32" height="32"><img id="s16" src="<pieces/>/ws.png"></td> |
| 287 |
<td width="32" height="32"><img id="s17" src="<pieces/>/bs.png"></td> |
| 288 |
<td width="32" height="32"><img id="s18" src="<pieces/>/ws.png"></td> |
| 289 |
<td width="32" height="32"><img id="s19" src="<pieces/>/bs.png"></td> |
| 290 |
<td width="32" height="32"><img id="s20" src="<pieces/>/ws.png"></td> |
| 291 |
<td width="32" height="32"><img id="s21" src="<pieces/>/bs.png"></td> |
| 292 |
<td width="32" height="32"><img id="s22" src="<pieces/>/ws.png"></td> |
| 293 |
<td width="32" height="32"><img id="s23" src="<pieces/>/bs.png"></td> |
| 294 |
</tr> |
| 295 |
<tr> |
| 296 |
<td width="32" height="32"><img id="s24" src="<pieces/>/bs.png"></td> |
| 297 |
<td width="32" height="32"><img id="s25" src="<pieces/>/ws.png"></td> |
| 298 |
<td width="32" height="32"><img id="s26" src="<pieces/>/bs.png"></td> |
| 299 |
<td width="32" height="32"><img id="s27" src="<pieces/>/ws.png"></td> |
| 300 |
<td width="32" height="32"><img id="s28" src="<pieces/>/bs.png"></td> |
| 301 |
<td width="32" height="32"><img id="s29" src="<pieces/>/ws.png"></td> |
| 302 |
<td width="32" height="32"><img id="s30" src="<pieces/>/bs.png"></td> |
| 303 |
<td width="32" height="32"><img id="s31" src="<pieces/>/ws.png"></td> |
| 304 |
</tr> |
| 305 |
<tr> |
| 306 |
<td width="32" height="32"><img id="s32" src="<pieces/>/ws.png"></td> |
| 307 |
<td width="32" height="32"><img id="s33" src="<pieces/>/bs.png"></td> |
| 308 |
<td width="32" height="32"><img id="s34" src="<pieces/>/ws.png"></td> |
| 309 |
<td width="32" height="32"><img id="s35" src="<pieces/>/bs.png"></td> |
| 310 |
<td width="32" height="32"><img id="s36" src="<pieces/>/ws.png"></td> |
| 311 |
<td width="32" height="32"><img id="s37" src="<pieces/>/bs.png"></td> |
| 312 |
<td width="32" height="32"><img id="s38" src="<pieces/>/ws.png"></td> |
| 313 |
<td width="32" height="32"><img id="s39" src="<pieces/>/bs.png"></td> |
| 314 |
</tr> |
| 315 |
<tr> |
| 316 |
<td width="32" height="32"><img id="s40" src="<pieces/>/bs.png"></td> |
| 317 |
<td width="32" height="32"><img id="s41" src="<pieces/>/ws.png"></td> |
| 318 |
<td width="32" height="32"><img id="s42" src="<pieces/>/bs.png"></td> |
| 319 |
<td width="32" height="32"><img id="s43" src="<pieces/>/ws.png"></td> |
| 320 |
<td width="32" height="32"><img id="s44" src="<pieces/>/bs.png"></td> |
| 321 |
<td width="32" height="32"><img id="s45" src="<pieces/>/ws.png"></td> |
| 322 |
<td width="32" height="32"><img id="s46" src="<pieces/>/bs.png"></td> |
| 323 |
<td width="32" height="32"><img id="s47" src="<pieces/>/ws.png"></td> |
| 324 |
</tr> |
| 325 |
<tr> |
| 326 |
<td width="32" height="32"><img id="s48" src="<pieces/>/wpws.png"></td> |
| 327 |
<td width="32" height="32"><img id="s49" src="<pieces/>/wpbs.png"></td> |
| 328 |
<td width="32" height="32"><img id="s50" src="<pieces/>/wpws.png"></td> |
| 329 |
<td width="32" height="32"><img id="s51" src="<pieces/>/wpbs.png"></td> |
| 330 |
<td width="32" height="32"><img id="s52" src="<pieces/>/wpws.png"></td> |
| 331 |
<td width="32" height="32"><img id="s53" src="<pieces/>/wpbs.png"></td> |
| 332 |
<td width="32" height="32"><img id="s54" src="<pieces/>/wpws.png"></td> |
| 333 |
<td width="32" height="32"><img id="s55" src="<pieces/>/wpbs.png"></td> |
| 334 |
</tr> |
| 335 |
<tr> |
| 336 |
<td width="32" height="32"><img id="s56" src="<pieces/>/wrbs.png"></td> |
| 337 |
<td width="32" height="32"><img id="s57" src="<pieces/>/wnws.png"></td> |
| 338 |
<td width="32" height="32"><img id="s58" src="<pieces/>/wbbs.png"></td> |
| 339 |
<td width="32" height="32"><img id="s59" src="<pieces/>/wqws.png"></td> |
| 340 |
<td width="32" height="32"><img id="s60" src="<pieces/>/wkbs.png"></td> |
| 341 |
<td width="32" height="32"><img id="s61" src="<pieces/>/wbws.png"></td> |
| 342 |
<td width="32" height="32"><img id="s62" src="<pieces/>/wnbs.png"></td> |
| 343 |
<td width="32" height="32"><img id="s63" src="<pieces/>/wrws.png"></td> |
| 344 |
</tr> |
| 345 |
</table> |
| 346 |
<p> |
| 347 |
<input type="button" value=" |< " onclick="first()"> |
| 348 |
<input type="button" value=" < " onclick="backward()"> |
| 349 |
<input type="button" value=" > " onclick="forward()"> |
| 350 |
<input type="button" value=" >| " onclick="last()"> |
| 351 |
<p>Autoplay: |
| 352 |
<select style="vertical-align: middle" name="autoplay" onchange="autoplay(this.value)"> |
| 353 |
<option value="-1">Off |
| 354 |
<option value="1">1s |
| 355 |
<option value="3">3s |
| 356 |
<option value="5">5s |
| 357 |
<option value="10">10s |
| 358 |
<option value="30">30s |
| 359 |
</select> |
| 360 |
|
| 361 |
<input style="vertical-align: middle" type="button" value="Flip board" onclick="flip()"> |
| 362 |
</td></tr> |
| 363 |
<tr><td align="center"> |
| 364 |
<br><small><credit/></small> |
| 365 |
</td><tr> |
| 366 |
</table> |
| 367 |
</body> |
| 368 |
</html> |