53
BANNED INPUT: resigns on turn 27:
There is a global ban on commands in user input, and no exception has been made for the resigns command on the part of the turn indexed 1.
Go back and try again.
What is otherwise valid user input in Game Courier can be banned in a GAME Code program for the sake of better enforcing the rules. See "Restricting User Input" in the Game Courier Developer's Guide for details on how this is done.
If you believe that your input should not have been banned, contact Fergus Duniho or whoever programmed the rules for this game.
Edit Settings File0 if == thismove null 1 say This preset enforces the rules and displays legal moves. 2 endif 3 set K findpiece K spaces 4 set k findpiece k spaces 5 setglobal piecekeys k d h r b g s l n p z K D H R B G S L N P Z 6 set promote assoc z (n l s g) p (n l s g) n (l s g) l (s g) s (g) g () k () r (d) b (h) d () h () Z (N L S G) P (N L S G) N (L S G) L (S G) S (G) G () K () R (D) B (H) D () H () 7 alias +b h +B H +r d +R D 8 include shogi 9 allow skip 2 10 setflag rules 11 setsystem capturedpieces false 12 sub postauto1 13 if isupper moved 14 die You may not move any enemy pieces. 15 endif 16 if islower old 17 die You may not capture your own pieces. 18 endif 19 set pp space dest 20 if not isalnum origin 21 if capture 22 die You may not drop a piece on an occupied space. 23 elseif not isalnum dest 24 die You may not drop a piece off the board. 25 elseif == rank dest 8 and match moved z p l n 26 die You may not drop a moved onto the last rank. 27 elseif == rank dest 7 and match moved z n 28 die You may not drop a moved onto this rank. 29 elseif != moved #pp 30 die You may not promote a piece when dropping it. 31 elseif twinonfile dest and == moved p 32 die You may not drop a Pawn on a file that already has another of your unpromoted Pawns on it. 33 endif 34 elseif not fn moved origin dest 35 die You not move a moved from origin to dest 36 elseif != #pp moved 37 if < rank origin 6 and < rank dest 6 38 die You may not promote any piece without moving from or to the last three ranks. 39 elseif not match #pp elem moved promote 40 die You may not promote your moved to a #pp 41 elseif == #pp n and > rank dest 6 42 die You may not promote to a Knight on a space from which a Knight may not move. 43 elseif match #pp l and == rank dest 8 44 die You may not promote to a Lance on a space from which a Lance may not move. 45 endif 46 elseif == moved k 47 set k dest 48 elseif == moved z and capture 49 if == #pp z 50 empty dest 51 else 52 die You may not promote a Kamikaze when capturing with it. 53 endif 54 elseif not fnmatch *-dest* thismove and not fnmatch *skip* thismove 55 if == rank dest 8 and match moved z p n l 56 askpromote s g 57 elseif == rank dest 7 and == moved p 58 askpromote p l s g 59 elseif == rank dest 7 and match moved z n l 60 askpromote l s g 61 elseif >= rank dest 6 or >= rank origin 6 and >= mln system maxmln 62 set pra elem moved promote 63 if count var pra 64 push pra moved 65 askpromote #pra 66 endif 67 endif 68 endif 69 if fn ATTACKEDBYW #k 70 die You may not move into check. 71 endif 72 verify capture 73 set p old 74 set c dest 75 drop old first !Ai !Ah !Ag !Af !Ae !Ad !Ac !Ab !Aa !Bi !Bh !Bg !Bf !Be !Bd !Bc !Bb !Ba !Ci !Ch !Cg !Cf !Ce !Cd !Cc !Cb !Ca !Di !Dh !Dg !Df !De !Dd !Dc !Db !Da 76 flip dest 77 change dest d h r b g s l n p z @ 78 setglobal lastcaptured #p 79 setglobal "dest" #c 80 endsub 81 sub postauto2 82 if islower moved 83 die You may not move any enemy pieces. 84 endif 85 if isupper old 86 die You may not capture your own pieces. 87 endif 88 set pp space dest 89 if not isalnum origin 90 if capture 91 die You may not drop a piece on an occupied space. 92 elseif not isalnum dest 93 die You may not drop a piece off the board. 94 elseif == rank dest 0 and match moved Z P L N 95 die You may not drop a moved onto the last rank. 96 elseif == rank dest 1 and match moved Z N 97 die You may not drop a moved onto this rank. 98 elseif != moved #pp 99 die You may not promote a piece when dropping it. 100 elseif twinonfile dest and == moved P 101 die You may not drop a Pawn on a file that already has another of your unpromoted Pawns on it. 102 endif 103 elseif not fn moved origin dest 104 die You may not move a moved from origin to dest 105 elseif != #pp moved 106 if < 2 rank origin and < 2 rank dest 107 die You may not promote any piece without moving from or to the last three ranks. 108 elseif not match #pp elem moved promote 109 die You may not promote your moved to a #pp 110 elseif == #pp N and < rank dest 2 111 die You may not promote to a Knight on a space from which a Knight may not move. 112 elseif match #pp L and == rank dest 0 113 die You may not promote to a Lance on a space from which a Lance may not move. 114 endif 115 elseif == moved K 116 set K dest 117 elseif == moved Z and capture 118 if == #pp Z 119 empty dest 120 else 121 die You may not promote a Kamikaze when capturing with it. 122 endif 123 elseif not fnmatch *-dest* thismove and not fnmatch *skip* thismove 124 if == rank dest 0 and match moved Z P N L 125 askpromote S G 126 elseif == rank dest 1 and == moved P 127 askpromote P L S G 128 elseif == rank dest 1 and match moved Z N L 129 askpromote L S G 130 elseif >= 2 rank dest or >= 2 rank origin and >= mln system maxmln 131 set pra elem moved promote 132 if count var pra 133 push pra moved 134 askpromote #pra 135 endif 136 endif 137 endif 138 if fn ATTACKEDBYB #K 139 die You may not move into check. 140 endif 141 verify capture 142 set p old 143 set c dest 144 drop old last !Ai !Ah !Ag !Af !Ae !Ad !Ac !Ab !Aa !Bi !Bh !Bg !Bf !Be !Bd !Bc !Bb !Ba !Ci !Ch !Cg !Cf !Ce !Cd !Cc !Cb !Ca !Di !Dh !Dg !Df !De !Dd !Dc !Db !Da 145 flip dest 146 change dest D H R B G S L N P Z @ 147 setglobal lastcaptured #p 148 setglobal "dest" #c 149 endsub 150 moveindex 0 151 MOVE: p 2g-2f 152 postauto1 153 moveindex 1 154 MOVE: P 8c-8d 155 postauto2 156 moveindex 2 157 MOVE: g 6i-6h 158 postauto1 159 moveindex 3 160 MOVE: P 8d-8e 161 postauto2 162 moveindex 4 163 MOVE: l 9i-9h 164 postauto1 165 moveindex 5 166 MOVE: P 8e-8f 167 postauto2 168 moveindex 6 169 MOVE: p 8g-8f 170 postauto1 171 moveindex 7 172 MOVE: R 8b-8f 173 postauto2 174 moveindex 8 175 MOVE: g 6h-7h 176 postauto1 177 moveindex 9 178 MOVE: R 8f-8b 179 postauto2 180 moveindex 10 181 MOVE: p 7g-7f 182 postauto1 183 moveindex 11 184 MOVE: G 4a-3b 185 postauto2 186 moveindex 12 187 MOVE: k 5i-5h 188 postauto1 189 moveindex 13 190 MOVE: K 5a-4a 191 postauto2 192 moveindex 14 193 MOVE: z*5e 194 postauto1 195 moveindex 15 196 MOVE: Z*8e 197 postauto2 198 moveindex 16 199 MOVE: b 8h-6f 200 postauto1 201 moveindex 17 202 MOVE: Z 8e-8g 203 MOVE: S-8g 204 postauto2 205 moveindex 18 206 MOVE: z 5e-5c 207 postauto1 208 moveindex 19 209 MOVE: S 8g-9h 210 postauto2 211 moveindex 20 212 MOVE: z*8d 213 postauto1 214 moveindex 21 215 MOVE: R 8b-5b 216 postauto2 217 moveindex 22 218 MOVE: n 8i-7g 219 postauto1 220 moveindex 23 221 MOVE: N*7d 222 postauto2 223 moveindex 24 224 MOVE: b 6f-7e 225 postauto1 226 moveindex 25 227 MOVE: P 9c-9d 228 postauto2 229 moveindex 26 230 MOVE: g 7h-8h 231 postauto1 232 moveindex 27 233 MOVE: P 9d-9e 234 postauto2 235 moveindex 28 236 MOVE: g 8h-9h 237 postauto1 238 moveindex 29 239 MOVE: P 9e-9f 240 postauto2 241 moveindex 30 242 MOVE: p 9g-9f 243 postauto1 244 moveindex 31 245 MOVE: L 9a-9f 246 postauto2 247 moveindex 32 248 MOVE: g 9h-8h 249 postauto1 250 moveindex 33 251 MOVE: Z*5e 252 postauto2 253 moveindex 34 254 MOVE: p 5g-5f 255 postauto1 256 moveindex 35 257 MOVE: P 1c-1d 258 postauto2 259 moveindex 36 260 MOVE: g 8h-8i 261 postauto1 262 moveindex 37 263 MOVE: B 2b-1c 264 postauto2 265 moveindex 38 266 MOVE: z*4f 267 postauto1 268 moveindex 39 269 MOVE: N 8a-9c 270 postauto2 271 moveindex 40 272 MOVE: s 7i-8h 273 postauto1 274 moveindex 41 275 MOVE: P 1d-1e 276 postauto2 277 moveindex 42 278 MOVE: s 8h-8g 279 postauto1 280 moveindex 43 281 MOVE: B 1c-2b 282 postauto2 283 moveindex 44 284 MOVE: s 8g-9f 285 postauto1 286 moveindex 45 287 MOVE: S 3a-4b 288 postauto2 289 moveindex 46 290 MOVE: n 7g-6e 291 postauto1 292 moveindex 47 293 MOVE: S 7a-6b 294 postauto2 295 moveindex 48 296 MOVE: z 8d-8b 297 MOVE: s-8b 298 postauto1 299 moveindex 49 300 MOVE: S 6b-7a 301 postauto2 302 moveindex 50 303 MOVE: s 8b-7c 304 MOVE: g-7c 305 postauto1 306 moveindex 51 307 MOVE: S 7a-7b 308 postauto2 309 moveindex 52 310 MOVE: g 7c-7d 311 postauto1 312 moveindex 53 313 MOVE: resigns 314 postauto2 315 if <= rank origin 2 or <= rank dest 2 and not fnmatch *skip* thismove and not fnmatch *dest* thismove and == moved space dest and isalnum origin and moved 316 switch moved 317 case R 318 askpromote R +R 319 break 320 case B 321 askpromote B +B 322 break 323 case S 324 askpromote S G 325 break 326 case L 327 askpromote L S G 328 break 329 case N 330 askpromote N L S G 331 break 332 case P 333 askpromote P N L S G 334 break 335 case Z 336 askpromote Z N L S G 337 break 338 default 339 break 340 endswitch 341 endif 342 set checks sub checks #k 343 if var checks 344 if sub checkmated #k #checks 345 restore 346 if == moved P and not isalnum origin 347 die You may not checkmate a King by dropping a Pawn. 348 endif 349 say Checkmate! White has won! 350 won 351 else 352 say Check! 353 endif 354 elseif sub stalemated #k 355 say Stalemate! The game is drawn. 356 drawn 357 endif 358 end 359 360 lib shogi 361 setsystem maxmove 2 362 ban commands allmoves 363 allow moves 1 captures 1 drops 1 promotions 2 364 def p checkaleap #0 #1 0 1 365 def n checkaleap #0 #1 1 2 or checkaleap #0 #1 -1 2 366 def b checkride #0 #1 1 1 367 def r checkride #0 #1 1 0 368 def l checkaride #0 #1 0 1 369 def s checkaleap #0 #1 0 1 or checkleap #0 #1 1 1 370 def g checkaleap #0 #1 1 1 or checkaleap #0 #1 -1 1 or checkleap #0 #1 0 1 371 def t checkaleap #0 #1 1 1 or checkaleap #0 #1 -1 1 or checkleap #0 #1 0 1 372 def y checkaleap #0 #1 1 1 or checkaleap #0 #1 -1 1 or checkleap #0 #1 0 1 373 def m checkaleap #0 #1 1 1 or checkaleap #0 #1 -1 1 or checkleap #0 #1 0 1 374 def v checkaleap #0 #1 1 1 or checkaleap #0 #1 -1 1 or checkleap #0 #1 0 1 375 def h checkleap #0 #1 1 0 or checkride #0 #1 1 1 376 def d checkleap #0 #1 1 1 or checkride #0 #1 1 0 377 def k checkleap #0 #1 1 1 or checkleap #0 #1 1 0 378 def z checkaleap #0 #1 0 2 379 def P checkaleap #0 #1 0 -1 380 def N checkaleap #0 #1 1 -2 or checkaleap #0 #1 -1 -2 381 def B checkride #0 #1 1 1 382 def R checkride #0 #1 1 0 383 def L checkaride #0 #1 0 -1 384 def S checkaleap #0 #1 0 -1 or checkleap #0 #1 1 1 385 def G checkaleap #0 #1 1 -1 or checkaleap #0 #1 -1 -1 or checkleap #0 #1 0 1 386 def T checkaleap #0 #1 1 -1 or checkaleap #0 #1 -1 -1 or checkleap #0 #1 0 1 387 def Y checkaleap #0 #1 1 -1 or checkaleap #0 #1 -1 -1 or checkleap #0 #1 0 1 388 def M checkaleap #0 #1 1 -1 or checkaleap #0 #1 -1 -1 or checkleap #0 #1 0 1 389 def V checkaleap #0 #1 1 -1 or checkaleap #0 #1 -1 -1 or checkleap #0 #1 0 1 390 def H checkleap #0 #1 1 0 or checkride #0 #1 1 1 391 def D checkleap #0 #1 1 1 or checkride #0 #1 1 0 392 def K checkleap #0 #1 1 1 or checkleap #0 #1 1 0 393 def Z checkaleap #0 #1 0 -2 394 def @ #0 and #1 and false 395 def FVL match #1 what #0 0 1 396 def BVL match #1 what #0 0 -1 397 def FVR match #1 insight #0 0 1 398 def BVR match #1 insight #0 0 -1 399 def FDL match #1 what #0 1 1 what #0 -1 1 400 def BDL match #1 what #0 1 -1 what #0 -1 -1 401 def FNL match N what #0 1 2 what #0 -1 2 402 def BNL match n what #0 1 -2 what #0 -1 -2 403 def FZL == Z what #0 0 2 404 def BZL == z what #0 0 -2 405 def OL check what #0 0 -1 check what #0 -1 0 check what #0 0 1 check what #0 1 0 target #1 406 def DL check what #0 -1 -1 check what #0 -1 1 check what #0 1 -1 check what #0 1 1 target #1 407 def OR check insight #0 0 -1 check insight #0 -1 0 check insight #0 0 1 check insight #0 1 0 target #1 408 def DR check insight #0 -1 -1 check insight #0 -1 1 check insight #0 1 -1 check insight #0 1 1 target #1 409 def ATTACKEDBYW fn FZL #0 or fn FNL #0 or fn FVL #0 (P S) or fn DL #0 (S K D) or fn FDL #0 (G T M V) or fn OL #0 (G T Y M V K H) or fn FVR #0 L or fn OR #0 (R D) or fn DR #0 (B H) 410 def ATTACKEDBYB fn BZL #0 or fn BNL #0 or fn BVL #0 (p s) or fn DL #0 (s k d) or fn BDL #0 (g t m v) or fn OL #0 (g t y m v k h) or fn BVR #0 l or fn OR #0 (r d) or fn DR #0 (b h) 411 sub checks king 412 my checks c 413 set checks () 414 if dest 415 if fn space dest dest #king 416 setelem checks dest space dest 417 endif 418 if isalnum origin 419 set c sub checkedthru #king origin 420 if #c 421 setelem checks #c space #c 422 endif 423 endif 424 else 425 if isupper cond empty #king moved space #king 426 def enemies onlylower 427 else 428 def enemies onlyupper 429 endif 430 for (from piece) fn enemies 431 if fn #piece #from #king 432 setelem checks #from space #from 433 if > count var checks 1 434 break 435 endif 436 endif 437 next 438 endif 439 return var checks 440 endsub 441 sub checkmated king checks 442 store 443 local from piece to key piece 444 set lglmvs array 445 if isupper space #king 446 def friends onlyupper 447 def friend isupper #0 448 def attacked fn ATTACKEDBYB #0 449 set lastrank 9 450 set pawn P 451 set forward 1 452 else 453 def friends onlylower 454 def friend islower #0 455 def attacked fn ATTACKEDBYW #0 456 set lastrank 1 457 set pawn p 458 set forward -1 459 endif 460 set kingmoves merge leaps #king 1 0 leaps #king 1 1 461 for to #kingmoves 462 if not fn friend space #to and onboard #to 463 move #king #to 464 set checked fn attacked #to 465 restore 466 if not #checked 467 setlegal #king #to 468 endif 469 endif 470 next 471 if == count var checks 1 472 for (key enemy) var checks 473 for (from piece) fn friends 474 if == #from #king 475 continue 476 endif 477 if isalnum #from and #piece 478 if fn #piece #from #key 479 echo #piece #from #key 480 move #from #key 481 set checked fn attacked #king 482 restore 483 if not #checked 484 setlegal #from #key 485 endif 486 endif 487 endif 488 set possible path #king #key 489 for to #possible 490 if isalnum #from 491 if fn #piece #from #to and #piece 492 move #from #to 493 set checked fn attacked #king 494 restore 495 if not #checked 496 setlegal #from #to 497 endif 498 endif 499 else 500 switch #piece 501 case P p 502 if onboard where #to #forward 0 and not onfile filename #to #piece 503 setlegal #from #to 504 endif 505 break 506 case L l 507 if onboard where #to #forward 0 508 setlegal #from #to 509 endif 510 break 511 case N n Z z 512 if onboard where #to * #forward 2 0 513 setlegal #from #to 514 endif 515 break 516 default 517 setlegal #from #to 518 break 519 endswitch 520 endif 521 next 522 next 523 next 524 endif 525 return cond count system legalmoves false true and checks 526 endsub 527 sub stalemated king 528 local forward from piece to pawninhand pawn key pawndrops lancedrops knightdrops piecedrops 529 set pawndrops array 530 set lancedrops array 531 set knightdrops array 532 set piecedrops array 533 set pawnonfile array 534 if isupper space #king 535 def friend isupper #0 536 def friends onlyupper 537 def attacked fn ATTACKEDBYB #0 538 set pawn P 539 set forward -1 540 else 541 def friend islower #0 542 def friends onlylower 543 def attacked fn ATTACKEDBYW #0 544 set pawn p 545 set forward 1 546 endif 547 store 548 for (from piece) fn friends 549 if not isalnum #from 550 continue 551 endif 552 switch #piece 553 case p 554 set spcs array where #from 0 1 555 break 556 case l 557 set spcs ray #from 0 1 558 break 559 case P 560 set spcs array where #from 0 -1 561 break 562 case L 563 set spcs ray #from 0 -1 564 break 565 case n 566 set spcs array where #from 1 2 where #from -1 2 567 break 568 case N 569 set spcs array where #from 1 -2 where #from -1 -2 570 break 571 case s 572 set spcs merge leaps #from 1 1 array where #from 0 1 573 break 574 case S 575 set spcs merge leaps #from 1 1 array where #from 0 -1 576 break 577 case g t m v y 578 set spcs merge leaps #from 1 0 array where #from -1 1 where #from 1 1 579 break 580 case G T M V Y 581 set spcs merge leaps #from 1 0 array where #from -1 -1 where #from 1 -1 582 break 583 case z 584 set spcs array where #from 0 2 585 case Z 586 set spcs array where #from 0 -2 587 case r R 588 set spcs rays #from 0 1 589 break 590 case d D 591 set spcs merge rays #from 0 1 leaps #from 1 1 592 break 593 case b B 594 set spcs rays #from 1 1 595 break 596 case h H 597 set spcs merge rays #from 1 1 leaps #from 0 1 598 break 599 case k K 600 set spcs merge leaps #from 1 0 leaps #from 1 1 601 break 602 default 603 set spcs merge rays #from 1 0 rays #from 1 1 604 break 605 endswitch 606 for to #spcs 607 if fn #piece #from #to and onboard #to and not fn friend space #to 608 move #from #to 609 if == #from #king 610 set checked fn attacked #to 611 else 612 set checked fn attacked #king 613 endif 614 restore 615 if not #checked 616 setlegal #from #to 617 endif 618 endif 619 next 620 next 621 for to fn spaces 622 if empty #to and isalnum #to 623 push piecedrops #to 624 if onboard where #to 0 #forward 625 push lancedrops #to 626 if not sub pawndropcheckmate #pawn #to and not onfile filename #to #pawn 627 push pawndrops #to 628 endif 629 if onboard where #to 0 * #forward 2 630 push knightdrops #to 631 endif 632 endif 633 endif 634 next 635 for (from piece) fn friends 636 if not isalnum #from 637 switch #piece 638 case p P 639 for to var pawndrops 640 setlegal "{#piece}*{#to}" 641 next 642 break 643 case n N z Z 644 for to var knightdrops 645 setlegal "{#piece}*{#to}" 646 next 647 break 648 case l L 649 for to var lancedrops 650 setlegal "{#piece}*{#to}" 651 next 652 break 653 default 654 for to var piecedrops 655 setlegal "{#piece}*{#to}" 656 next 657 break 658 endswitch 659 endif 660 next 661 return cond count system legalmoves false true 662 endsub 663 sub pawndropcheckmate pawn spot 664 my allies 665 local king kingmoves black test to 666 verify empty #spot and onboard #spot 667 if == #pawn P 668 set king where #spot 0 -1 669 set black true 670 else 671 set king where #spot 0 1 672 set black false 673 endif 674 verify == space #king cond #black k K 675 set kingmoves merge leaps #king 1 0 leaps # 1 1 676 for to #kingmoves 677 if not cond #black islower space #to isupper space #to or empty #to and onboard #to 678 move #king #to 679 set checked fn cond #black ATTACKEDBYW ATTACKEDBYB #to 680 restore 681 verify #checked 682 endif 683 next 684 if #black 685 set allies onlylower 686 else 687 set allies onlyupper 688 endif 689 for (from piece) #allies 690 if == #piece #king 691 continue 692 endif 693 if fn #piece #from #spot and #piece 694 move #from #spot 695 set checked fn cond #black ATTACKEDBYW ATTACKEDBYB #king 696 restore 697 verify #checked 698 endif 699 next 700 return true 701 endsub 702 sub checkedthru king loc 703 my dir c p 704 set c revealed #king #loc 705 set p space #c 706 if samecase space #king #p or not #c 707 return false 708 endif 709 set dir direction #king #loc 710 switch #dir 711 case n 712 if match #p R r D d L 713 return #c 714 endif 715 return false 716 case s 717 if match #p R r D d l 718 return #c 719 endif 720 return false 721 case e w 722 if match #p R r D d 723 return #c 724 endif 725 return false 726 case nw sw ne se 727 if match #p B b H h 728 return #c 729 endif 730 return false 731 default 732 return false 733 endswitch 734 endsub 735 endlib