This preset has now been updated to spot check, checkmate, and stalemate.
You may not promote a Cavalier before reaching the last rank.
Use your browser's BACK button to go back to the previous page, then reload if necessary.
For general reference, here is the complete list of moves:
1. H d2-c4 1... g7-f5 2. e2-c3 2... f8-g7 3. I g1-e2 3... a7-b5 4. I e2-h8 4... g7-h8 5. Q d1-g4 5... h7-g5 6. f2-e4 6... g8-h6 7. Q g4-h5 7... d7-c5 8. h2-g4 8... b8-h5 // by way of d7 and f6 9. M h1-h5 9... h8-g7 10. M h5-g7 10... f5-g7 11. e4-f6 11... e8-f6 12. I b1-d2 12... f6-e8 13. c4-e5 13... c8-g4 14. I d2-c4 14... e8-f8 15. e5-g4 15... h6-g4 16. I c4-a8 16... d8-a8 17. c3-b5 17... c7-b5 18. b2-c4 18... b7-a5 19. a2-b4 19... g7-f5 20. g2-e3 20... f5-e3 21. c2-e3 21... g4-c6 22. A c1-d2 22... f7-e5 23. c4-e5 23... c6-e5 24. e3-g4 24... e5-g4 25. M a1-a4 25... g5-e4 26. A d2-f3 26... g4-f6 27. A f1-b5 27... a8-d8 28. M a4-b2 28... f6-h7 29. X e1-e2 29... e7-f5 30. M b2-d1 30... d8-f6 31. b4-d5 | 31... f5-g3 // check! | 32. d5-f6 | // On last move, Carlos, WKing not checked because f3 blocks | // g3. Go ahead and make another move 31, fine with me. 31... f6-h6 32. A f3-e4 32... h6-h5 // check! 33. X e2-c1 33... a5-b3 // check! 34. M d1-b2 34... h5-h6 // check! 35. X c1-b1 35... h7-e1 36. A e4-f5 36... h6-h1 37. A b5-d6 37... f8-g8 38. A f5-e7 38... g8-h6 39. M b2-h2 39... h1-h2 40. A d6-h2 40... h6-h5 41. d5-c7 41... c5-e4 42. c7-e8; Q -e8 42... resignIf this is your settings file, you may edit it at https://www.chessvariants.com/play/pbm/play.php?game=Cavalier+Chess&settings=Motif&submit=Edit
Here is a code listing:
0 echo This preset has now been updated to spot check, checkmate, and stalemate. 1 set k findpiece x spaces 2 set K findpiece X spaces 3 include cavalier 4 sub postauto1 5 set legal false 6 if islower moved 7 list 8 die You may not move your opponent's pieces. 9 endif 10 if isupper old 11 die You may not capture your own pieces. 12 endif 13 if == moved H 14 set legal sub H origin dest 15 elseif match moved X M A I Q 16 set legal fn moved origin dest 17 if != moved space dest 18 die You may not change your moved into something else. 19 endif 20 endif 21 if not #legal 22 die You may not move a moved from origin to dest 23 endif 24 if == moved X 25 set K dest 26 endif 27 if sub checked #K 28 die You may not move your Eques Rex into check 29 endif 30 endsub 31 sub postauto2 32 set legal false 33 if isupper moved 34 list 35 die You may not move your opponent's pieces. 36 endif 37 if islower old 38 die You may not capture your own pieces. 39 endif 40 if == moved h 41 set legal sub h origin dest 42 elseif match moved x m a i q 43 set legal fn moved origin dest 44 if != moved space dest 45 die You may not change your moved into something else. 46 endif 47 endif 48 if not #legal 49 die You may not move a moved from origin to dest 50 endif 51 if == moved x 52 set k dest 53 endif 54 if sub checked #k 55 die You may not move your Eques Rex into check 56 endif 57 endsub 58 moveindex 0 59 MOVE: H d2-c4 60 postauto1 61 moveindex 1 62 MOVE: g7-f5 63 postauto2 64 moveindex 2 65 MOVE: e2-c3 66 postauto1 67 moveindex 3 68 MOVE: f8-g7 69 postauto2 70 moveindex 4 71 MOVE: I g1-e2 72 postauto1 73 moveindex 5 74 MOVE: a7-b5 75 postauto2 76 moveindex 6 77 MOVE: I e2-h8 78 postauto1 79 moveindex 7 80 MOVE: g7-h8 81 postauto2 82 moveindex 8 83 MOVE: Q d1-g4 84 postauto1 85 moveindex 9 86 MOVE: h7-g5 87 postauto2 88 moveindex 10 89 MOVE: f2-e4 90 postauto1 91 moveindex 11 92 MOVE: g8-h6 93 postauto2 94 moveindex 12 95 MOVE: Q g4-h5 96 postauto1 97 moveindex 13 98 MOVE: d7-c5 99 postauto2 100 moveindex 14 101 MOVE: h2-g4 102 postauto1 103 moveindex 15 104 MOVE: b8-h5 105 postauto2 106 moveindex 16 107 MOVE: M h1-h5 108 postauto1 109 moveindex 17 110 MOVE: h8-g7 111 postauto2 112 moveindex 18 113 MOVE: M h5-g7 114 postauto1 115 moveindex 19 116 MOVE: f5-g7 117 postauto2 118 moveindex 20 119 MOVE: e4-f6 120 postauto1 121 moveindex 21 122 MOVE: e8-f6 123 postauto2 124 moveindex 22 125 MOVE: I b1-d2 126 postauto1 127 moveindex 23 128 MOVE: f6-e8 129 postauto2 130 moveindex 24 131 MOVE: c4-e5 132 postauto1 133 moveindex 25 134 MOVE: c8-g4 135 postauto2 136 moveindex 26 137 MOVE: I d2-c4 138 postauto1 139 moveindex 27 140 MOVE: e8-f8 141 postauto2 142 moveindex 28 143 MOVE: e5-g4 144 postauto1 145 moveindex 29 146 MOVE: h6-g4 147 postauto2 148 moveindex 30 149 MOVE: I c4-a8 150 postauto1 151 moveindex 31 152 MOVE: d8-a8 153 postauto2 154 moveindex 32 155 MOVE: c3-b5 156 postauto1 157 moveindex 33 158 MOVE: c7-b5 159 postauto2 160 moveindex 34 161 MOVE: b2-c4 162 postauto1 163 moveindex 35 164 MOVE: b7-a5 165 postauto2 166 moveindex 36 167 MOVE: a2-b4 168 postauto1 169 moveindex 37 170 MOVE: g7-f5 171 postauto2 172 moveindex 38 173 MOVE: g2-e3 174 postauto1 175 moveindex 39 176 MOVE: f5-e3 177 postauto2 178 moveindex 40 179 MOVE: c2-e3 180 postauto1 181 moveindex 41 182 MOVE: g4-c6 183 postauto2 184 moveindex 42 185 MOVE: A c1-d2 186 postauto1 187 moveindex 43 188 MOVE: f7-e5 189 postauto2 190 moveindex 44 191 MOVE: c4-e5 192 postauto1 193 moveindex 45 194 MOVE: c6-e5 195 postauto2 196 moveindex 46 197 MOVE: e3-g4 198 postauto1 199 moveindex 47 200 MOVE: e5-g4 201 postauto2 202 moveindex 48 203 MOVE: M a1-a4 204 postauto1 205 moveindex 49 206 MOVE: g5-e4 207 postauto2 208 moveindex 50 209 MOVE: A d2-f3 210 postauto1 211 moveindex 51 212 MOVE: g4-f6 213 postauto2 214 moveindex 52 215 MOVE: A f1-b5 216 postauto1 217 moveindex 53 218 MOVE: a8-d8 219 postauto2 220 moveindex 54 221 MOVE: M a4-b2 222 postauto1 223 moveindex 55 224 MOVE: f6-h7 225 postauto2 226 moveindex 56 227 MOVE: X e1-e2 228 postauto1 229 moveindex 57 230 MOVE: e7-f5 231 postauto2 232 moveindex 58 233 MOVE: M b2-d1 234 postauto1 235 moveindex 59 236 MOVE: d8-f6 237 postauto2 238 moveindex 60 239 MOVE: b4-d5 240 postauto1 241 moveindex 65 242 MOVE: f6-h6 243 postauto2 244 moveindex 66 245 MOVE: A f3-e4 246 postauto1 247 moveindex 67 248 MOVE: h6-h5 249 postauto2 250 moveindex 68 251 MOVE: X e2-c1 252 postauto1 253 moveindex 69 254 MOVE: a5-b3 255 postauto2 256 moveindex 70 257 MOVE: M d1-b2 258 postauto1 259 moveindex 71 260 MOVE: h5-h6 261 postauto2 262 moveindex 72 263 MOVE: X c1-b1 264 postauto1 265 moveindex 73 266 MOVE: h7-e1 267 postauto2 268 moveindex 74 269 MOVE: A e4-f5 270 postauto1 271 moveindex 75 272 MOVE: h6-h1 273 postauto2 274 moveindex 76 275 MOVE: A b5-d6 276 postauto1 277 moveindex 77 278 MOVE: f8-g8 279 postauto2 280 moveindex 78 281 MOVE: A f5-e7 282 postauto1 283 moveindex 79 284 MOVE: g8-h6 285 postauto2 286 moveindex 80 287 MOVE: M b2-h2 288 postauto1 289 moveindex 81 290 MOVE: h1-h2 291 postauto2 292 moveindex 82 293 MOVE: A d6-h2 294 postauto1 295 moveindex 83 296 MOVE: h6-h5 297 postauto2 298 moveindex 84 299 MOVE: d5-c7 300 postauto1 301 moveindex 85 302 MOVE: c5-e4 303 postauto2 304 moveindex 86 305 MOVE: c7-e8 306 MOVE: Q -e8 307 postauto1 308 moveindex 87 309 MOVE: resign 310 postauto2 311 if sub stalemated #K 312 if sub checked #K 313 say Checkmate! Black has won! 314 won 315 else 316 say Stalemate! Game is drawn! 317 drawn 318 endif 319 won 320 elseif sub checked #K 321 say Check! 322 endif 323 end 324 325 lib cavalier 326 include grandcavalier 327 def H checktwostep #0 #1 0 1 1 1 328 def h checktwostep #0 #1 0 1 1 1 329 sub h from to 330 verify checktwostep #0 #1 0 1 1 1 #from #to 331 set hp space #to 332 if == #hp h 333 if != rank #to 0 334 return true 335 endif 336 switch #to 337 case a1 h1 338 add m #to 339 break 340 case b1 g1 341 add i #to 342 break 343 case c1 f1 344 add a #to 345 break 346 case d1 347 add q #to 348 break 349 default 350 askpromote q m a i 351 break 352 endswitch 353 else 354 if != rank #0 0 355 die You may not promote a Cavalier before reaching the last rank. 356 endif 357 switch #to 358 case a1 h1 359 if != #hp m 360 die You may not promote a Cavalier here to anything but a Marshall. 361 endif 362 break 363 case b1 g1 364 if != #hp i 365 die You may not promote a Cavalier here to anything but a Nightrider. 366 endif 367 break 368 case c1 f1 369 if != #hp a 370 die You may not promote a Cavalier here to anything but a Paladin. 371 endif 372 break 373 case d1 374 if != #hp m 375 die You may not promote a Cavalier here to anything but a Queen. 376 endif 377 break 378 default 379 if not match #hp q m a i 380 die You may promote here only to a Queen, Marshall, Paladin, or Nightrider of your own color. 381 endif 382 endswitch 383 endif 384 return true 385 endsub 386 sub H from to 387 verify checktwostep #0 #1 0 1 1 1 #from #to 388 set hp space #to 389 if == #hp H 390 if != rank #to 7 391 return true 392 endif 393 switch #to 394 case a8 h8 395 add M #to 396 break 397 case b8 g8 398 add I #to 399 break 400 case c8 f8 401 add A #to 402 break 403 case d8 404 add Q #to 405 break 406 default 407 askpromote Q M A I 408 break 409 endswitch 410 else 411 if != rank #0 7 412 die You may not promote a Cavalier before reaching the last rank. 413 endif 414 switch #to 415 case a8 h8 416 if != #hp M 417 die You may not promote a Cavalier here to anything but a Marshall. 418 endif 419 break 420 case b8 g8 421 if != #hp I 422 die You may not promote a Cavalier here to anything but a Nightrider. 423 endif 424 break 425 case c8 f8 426 if != #hp A 427 die You may not promote a Cavalier here to anything but a Paladin. 428 endif 429 break 430 case d8 431 if != #hp M 432 die You may not promote a Cavalier here to anything but a Queen. 433 endif 434 break 435 default 436 if not match #hp Q M A I 437 die You may promote here only to a Queen, Marshall, Paladin, or Nightrider of your own color. 438 endif 439 endswitch 440 endif 441 return true 442 endsub 443 endlib 444 lib grandcavalier 445 def H > 0 sum var CAP or == space #1 x or != rank #1 9 and checktwostep #0 #1 0 1 1 1 446 def C cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1 447 def Q checkride #0 #1 1 0 or checkride #0 #1 1 1 448 def M checkride #0 #1 1 0 or checkleap #0 #1 1 2 449 def A checkride #0 #1 1 1 or checkleap #0 #1 1 2 450 def X checkleap #0 #1 1 0 or checkleap #0 #1 1 1 or checkleap #0 #1 1 2 451 def I checkride #0 #1 1 2 452 def h > 0 sum var cap or == space #1 X or != rank #1 0 and checktwostep #0 #1 0 1 1 1 453 def c cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1 454 def q checkride #0 #1 1 0 or checkride #0 #1 1 1 455 def m checkride #0 #1 1 0 or checkleap #0 #1 1 2 456 def a checkride #0 #1 1 1 or checkleap #0 #1 1 2 457 def x checkleap #0 #1 1 0 or checkleap #0 #1 1 1 or checkleap #0 #1 1 2 458 def i checkride #0 #1 1 2 459 sub h from to 460 if not checktwostep #from #to 0 1 1 1 461 return false 462 endif 463 set hp space #to 464 if == #hp h 465 if != rank #to 0 466 return true 467 endif 468 die You may not move a Cavalier to the last rank without promoting it. 469 endif 470 if < elem #hp cap 1 471 die "You may not promote your Cavalier to a" #hp "until one has been captured." 472 endif 473 setelem cap #hp dec elem #hp cap 474 return true 475 endsub 476 sub H from to 477 if not checktwostep #from #to 0 1 1 1 478 return false 479 endif 480 set hp space #to 481 if == #hp H 482 if != rank #to 9 483 return true 484 endif 485 die You may not move a Cavalier to the last rank without promoting it. 486 endif 487 if < elem #hp CAP 1 488 die "You may not promote your Cavalier to a" #hp "until one has been captured." 489 endif 490 setelem CAP #hp dec elem #hp CAP 491 return true 492 endsub 493 sub checked king 494 local from piece 495 if isupper space #king 496 def enemies onlylower 497 else 498 def enemies onlyupper 499 endif 500 for (from piece) fn enemies 501 if fn #piece #from #king 502 return true 503 endif 504 next 505 return false 506 endsub 507 sub stalemated kingpos 508 store 509 local from piece to key lglmvs 510 set lglmvs () 511 if isupper space #kingpos 512 def friends onlyupper 513 def nofriends noupper 514 def friend isupper #0 515 else 516 def friends onlylower 517 def nofriends nolower 518 def friend islower #0 519 endif 520 set royal space var kingpos 521 store 522 for to fn join toupper #royal L #kingpos 523 if fn #royal #kingpos #to and not fn friend space #to and onboard #to 524 move #kingpos #to 525 set incheck sub checked #to 526 restore 527 if not #incheck 528 set key array #kingpos #to 529 push lglmvs #key 530 endif 531 endif 532 next 533 restore 534 for (from piece) fn friends 535 if == #from #kingpos 536 continue 537 endif 538 for to fn join toupper #piece L #from 539 if fn #piece #from #to and not fn friend space #to and onboard #to 540 move #from #to 541 set incheck sub checked #kingpos 542 if not #incheck 543 set key array #from #to 544 push lglmvs #key 545 endif 546 endif 547 restore 548 next 549 next 550 setsystem legalmoves var lglmvs 551 return cond count var lglmvs false true 552 endsub 553 def HL leaps #0 1 2 554 def CL rays #0 1 0 555 def QL merge rays #0 1 0 rays #0 1 1 556 def ML merge rays #0 1 0 leaps #0 1 2 557 def AL merge rays #0 1 1 leaps #0 1 2 558 def XL merge merge leaps #0 1 0 leaps #0 1 1 leaps #0 1 2 559 def IL rays #0 1 2 560 endlib