Check out Smess, our featured variant for February, 2025.


[ 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 Enforce Rules in Game Courier. A tutorial on programming a rule-enforcing preset in the GAME Code language.[All Comments] [Add Comment or Rating]
Daniel Zacharias wrote on Thu, Jan 19, 2023 02:17 AM UTC:

I'm trying to follow these instructions to enforce the rules for this game, but I've run into trouble with my pawn subroutine. I want the pawns to capture by jumping over one piece to an empty space, but the hopping move isn't accepted as legal.

sub P from to;
    verify > rank #to rank #from;
    if capture:
        die "A Pawn may only capture by jumping over a piece immediately in front of itself.";
    elseif == distance #from #to 2: 
        verify checkahop #from #to -1 1 or checkahop #from #to 0 1 and islower screen;
        capture screen;
    else:
         verify checkaride #from #to -1 1 or checkaride #from #to 0 1;
    endif;
    if onboard where #to 0 #pzs or onboard where #to -1 #pzs:
        if != space #to moved:
            die "You may not promote a Pawn until it reaches the promotion zone.";
        endif;
    elseif == P space #to:
        askpromote #wprom;
    elseif not match space #to var wprom:
        set np space #to;
        die "You may not promote your Pawn to a" #np;
    endif;
    set nopvc 0;
    return true;
endsub;