Check out Glinski's Hexagonal Chess, our featured variant for May, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

How to Display Legal Moves in Game Courier - A Tutorial. A Game Courier Tutorial.[All Comments] [Add Comment or Rating]
Jose Carrillo wrote on Sat, Jan 7, 2017 02:00 PM UTC:
Fergus,
 
I'm also going to need new definitions for the noupper and nolower functions that only look at the first character.
 
Also for the samecase function found in the new "checked" subroutine.
 
Thanks
 
===
From chess3.txt:
 
sub stalemated kingpos:
  store;
  local from piece to;
  if isupper space #kingpos:
    def friends filter lambda (regmatch "/[A-Z]/" #1) pieces;
    def nofriends noupper;
    def friend isupper #0;
  else:
    def friends filter lambda (regmatch "/[a-z]/" #1) pieces;
    def nofriends nolower;
    def friend islower #0;
  endif;
// This subroutine checks whether a King is in check.

def checked any lambda . . . . "fn space #0 #0 " #0 " unless samecase space #0 space " #0 spaces;

sub checked king:
my from piece;
if isupper cond empty #king moved space #king:
def enemies filter lambda (regmatch "/[a-z]/" #1) pieces;
else:
def enemies filter lambda (regmatch "/[A-Z]/" #1) pieces;
endif;
for (from piece) fn enemies:
if fn #piece #from #king:
return #from;
endif;
next;
return false;
endsub;