Check out Grant Acedrex, our featured variant for April, 2024.


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

Comments/Ratings for a Single Item

LatestLater Reverse Order EarlierEarliest
Apothecary Chess-Classic. Large board variant obtained through tinkering with known games.[All Comments] [Add Comment or Rating]
🕸Fergus Duniho wrote on Tue, Jul 21, 2020 07:46 PM UTC in reply to Aurelian Florea from 07:32 PM:

The first thing it does is require that the move is a capture. If it is not a capture, it will not proceed any further.


💡📝Aurelian Florea wrote on Tue, Jul 21, 2020 07:32 PM UTC:

I have corrected the post move code to:

if != const alias $moved White_Joker:
  if != const alias $moved White_Pawn:
    set last_type_moved const alias $moved;
  else:
    set last_type_moved Black_Barren_Pawn;
  endif;
endif;

and similar for black. This code works.

But the Barren_Pawn worked fine when I had done only the move part of the pawn's powers but now I have added the capture part and nothing is legal anymore. Please help if you may! The code in question is:

def Black_Barren_Pawn
checkaleap #0 #1 0 -1 and cond empty #0 not capture empty #1
or checkleap #0 #1 -1 -1 or checkleap #0 #1 1 -1 
and cond empty #0 capture isupper space #1;


🕸Fergus Duniho wrote on Tue, Jul 21, 2020 03:43 PM UTC in reply to Aurelian Florea from 01:13 PM:

It doesn't work, because you are testing the codename of the piece, but Pawn is not the codename for any piece. It is the display name for the pieces with the codenames of Black_Pawn and White_Pawn.


🕸Fergus Duniho wrote on Tue, Jul 21, 2020 03:39 PM UTC in reply to H. G. Muller from 02:05 PM:

Is that minus sign in Pawn-Range intended, or is it a typo for an underscore?

It's a hyphen, not a minus sign, and it is not a typo.


H. G. Muller wrote on Tue, Jul 21, 2020 02:05 PM UTC:

Is that minus sign in Pawn-Range intended, or is it a typo for an underscore?


💡📝Aurelian Florea wrote on Tue, Jul 21, 2020 01:13 PM UTC:

@Fergus

A few weeks ago I have figured out that the joker imitates the pawn in all things which causes the joker moves to not be allowed.

To tackle this issue I have decided to write a Barren_Pawn function that the joker will use when imitating a pawn instead of imitating the regular pawn function. Otherwise things are unchanged. The Barren_Pawn functions are:

def White_Barren_Pawn checkaleap #0 #1 1 0 and empty #1 islower space #1 and or checkaleap #0 #1 1 -1 checkaleap #0 #1 1 1;

def White_Barren_Pawn-Range merge leaps #0 1 0 leaps #0 1 1;

def Black_Barren_Pawn checkaleap #0 #1 -1 0 and empty #1 isupper space #1 and or checkaleap #0 #1 -1 -1 checkaleap #0 #1 -1 1;

def Black_Barren_Pawn-Range merge leaps #0 1 0 leaps #0 1 1;

The piece of code involving the joker imitation is:

if != const alias $moved White_Joker:
  if != const alias $moved Pawn:
    set last_type_moved const alias $moved;
  else:
    set last_type_moved White_Barren_Pawn;
  endif;
endif;

and for black:

if != const alias $moved Black_Joker:
  if != const alias $moved Pawn:
    set last_type_moved const alias $moved;
  else:
    set last_type_moved Black_Barren_Pawn;
  endif;
endif;

I thought it should easily work. Unfortunately it does not. Any idea why that is?


💡📝Aurelian Florea wrote on Mon, Jul 6, 2020 01:41 PM UTC:

Ok, thanks for the heads up. I'll try to think at something else.


🕸Fergus Duniho wrote on Mon, Jul 6, 2020 01:28 PM UTC:

I wouldn't recommend that. That doesn't sound like the correct solution to your problem.


💡📝Aurelian Florea wrote on Mon, Jul 6, 2020 12:29 PM UTC:

@Fergus

The way I had thought the game, the joker should, when imitating a pawn, get only the regular power and not promotion rights or double move privileges. And that works best with moving some of the lines in the pawn function to the pawn subroutine. It should be rather easy.


🕸Fergus Duniho wrote on Fri, Jul 3, 2020 05:02 PM UTC:

Since it works for displaying legal moves, it's probably because the Pawn functions are only for potential moves, and the Joker is trying to use one of the Pawn functions when making an actual move. Specifically, I think it fails on the line "and empty #1" in the Pawn function, because that space is occupied for an actual move. Some options include changing your rules, rewriting the Pawn functions to handle both potential and actual moves, or using a Joker subroutine for actual moves, which would let you undo the Joker's move before testing it with a function, then redoing it if it is legal.


💡📝Aurelian Florea wrote on Fri, Jul 3, 2020 11:38 AM UTC:

@Fergus,

I have unfortunately uncovered another bug on the preset for this game.

The joker can't move when imitating a pawn, although the moves are properly displayed. Any idea why?

 


💡📝Aurelian Florea wrote on Thu, Jul 2, 2020 08:51 AM UTC:

@ Fergus,

I have found the mistake. 
This piece of code was missing and adding it has solved the problem.

if == moved K: 
unsetflag f2;
set Kpos $dest;
endif;


💡📝Aurelian Florea wrote on Wed, Jul 1, 2020 04:56 PM UTC:

It still gives the error:  "you may not move into check".


🕸Fergus Duniho wrote on Wed, Jul 1, 2020 04:40 PM UTC:

I didn't say to get rid of the else clause. I said to get rid of the else. Just the else. A single line of code.


💡📝Aurelian Florea wrote on Wed, Jul 1, 2020 04:40 AM UTC:

The new sub looks like this:

sub Apothecary_King from to:
if checkleap #from #to 1 1 or checkleap #from #to 1 0: 
return true;
endif;
move #to #from;
     if checkleap #from #to 1 3
     or checkleap #from #to 1 2
     and match rankname #to 1 10
     and flag #from :
         if not sub checked #from:
         move #from #to;
         return true;
         else die You may not perform the special moves out of check.;
         endif;
      endif;    
     return false;
endsub;

When trying to use regular moves out of check, I get the error "you cannot move into check.". This happens with or without the else part.


🕸Fergus Duniho wrote on Tue, Jun 30, 2020 11:54 PM UTC:

Also, add "return false;" to the very end of the subroutine.


🕸Fergus Duniho wrote on Tue, Jun 30, 2020 11:50 PM UTC:

The function looks fine. In the subroutine, you should remove the else.


💡📝Aurelian Florea wrote on Tue, Jun 30, 2020 06:45 PM UTC:

I have made the distinction between the function and the subroutine. But I still could not make work as expected.

def Apothecary_King
checkleap #0 #1 1 3
or checkleap #0 #1 1 2
and not sub checked #0
and match rankname #1 1 10
and flag #0
or checkleap #0 #1 1 0 
or checkleap #0 #1 1 1;

 

sub Apothecary_King from to:
if checkleap #from #to 1 1 or checkleap #from #to 1 0: 
return true;
endif;
move #to #from;
     if checkleap #from #to 1 3
     or checkleap #from #to 1 2
     and match rankname #to 1 10
     and flag #from :
         if sub checked #from:
         die You may not perform the special moves out of check.;
          endif;
     else:
     move #from #to;
     return true;
     endif;
endsub;


🕸Fergus Duniho wrote on Tue, Jun 30, 2020 02:03 PM UTC:

$origin should not be included in the function definition. It may be used as an argument when calling a function or subroutine, but it should not be included in the definition of one. You should check the flag before calling the checked subroutine, because that will minimize the use of the subroutine. The same goes for checking the rank of the destination. Always do less expensive operations before more expensive operations, because that will minimize the need to do the most expensive operations.


💡📝Aurelian Florea wrote on Tue, Jun 30, 2020 08:18 AM UTC:

You are saying the the checked subroutine must be used inside the function?

Like that:

def Apothecary_King
checkleap #0 #1 1 3
or checkleap #0 #1 1 2
and match rankname #1 1 10
and flag #0
and not sub checked $origin
or checkleap #0 #1 1 0 
or checkleap #0 #1 1 1;

because this does not work.


🕸Fergus Duniho wrote on Mon, Jun 29, 2020 07:15 PM UTC:

The subroutine should undo the King's move before checking whether it is in check. If the move is legal, then it should redo it. The function does not need to undo and redo the King's move, but it should make sure the King is not in check before allowing the special moves. Also, each should handle the regular moves before checking whether the King is in check. Your current subroutine is very wasteful, because it will check whether the King is in check every single time.


💡📝Aurelian Florea wrote on Mon, Jun 29, 2020 05:19 PM UTC:

I have separated the 2 codes but never are the special moves availeble. I'm not sure about what to do!


🕸Fergus Duniho wrote on Mon, Jun 29, 2020 03:38 PM UTC:

This should be handled in the Apothecary_King function and in the Apothecary_King subroutine, not externally. Furthermore, the subroutine should not call the function. Each one should handle this independently from the other.


💡📝Aurelian Florea wrote on Mon, Jun 29, 2020 02:07 PM UTC:

@Fergus

I have tried to implement the ban on special moves while the virgin king is in check. I'm far from the result.

Could you take a look at the link below?

https://www.chessvariants.com/play/pbm/play.php?game=Apothecary+Chess+2&settings=Apothecary2working&submit=Edit


💡📝Aurelian Florea wrote on Tue, Jun 23, 2020 01:52 PM UTC:

HG,

I'm not sure what placement chess is.

I was wondering if the placement of the pieces may be done automatically. Can a javascript be written to do this. and after each restart another legitimate initial position can be generated.


25 comments displayed

LatestLater Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.