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 Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

EarliestEarlier Reverse Order LaterLatest
Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
Aurelian Florea wrote on Sun, Dec 26, 2021 06:19 PM UTC:

Hello HG, While testing the interactive diagram on grand apothecary chess alert I have noticed that the joker imitating a berolina pawn has moved 5 spaces. This is probably because the berolina pawn is defined like this mfF*fceW and that means the joker inherited the ability to move as much as to the center of the board. But the rules of the games, as I had made them state : "A joker imitating a pawn has only the regular moves, no double step, no enpassant and no promotion even if that pawn has promoted the last move."

In the game courier I had created a special case for when the joker imitates a pawn to get the moves of a fictious barren pawn that does not promote, and gets no double steps or en passat. But I don't think that can be done here. Can it?

Here is the game that led to this situation:

{770295349} 1. f7 Xi8 2. e6 Wb10 3. d5 Wk10 4. Bd4 Ig9 5. g7 h9 6. f8 Ii7 7. Gi5 Ik9 8. f6 Uk8 9. Me4 Ig6 10. Mf4 Gd9 11. Of3 Id10 12. Wf5 Oj9 13. Wig5 Fb9 14. Xe7 Ji10

Grand Apothecary chess alert can be found here:

https://www.chessvariants.com/rules/grand-apothecary-chess-alert


💡📝H. G. Muller wrote on Sun, Dec 26, 2021 09:39 PM UTC in reply to Aurelian Florea from 06:19 PM:

The Diagram does not support 'partial imitators', which can only imitate a subset of the pieces, or of the moves of some of the pieces. I suppose it would be possible to exploit the possibility to veto unwanted moves through a user-supplied JavaScript function BadZone. Originally this feature was created for confining pieces to part of the board as  in Xiangqi. It could be used to veto moves for any reason, though. Problem in this case is that the routine should know which piece the imitator is imitating, because you don't want to veto distant forward moves when it is imitating a Rook. The Diagram keeps track of that in a variable that is accessible from the routine. But it is a different variable in case of a move in the game from when the AI is thinking.


Greg Strong wrote on Mon, Dec 27, 2021 02:55 AM UTC in reply to H. G. Muller from Sun Dec 26 09:39 PM:

The Diagram does not support 'partial imitators', which can only imitate a subset of the pieces, or of the moves of some of the pieces. I suppose it would be possible to exploit the possibility to veto unwanted moves through a user-supplied JavaScript function BadZone.

I had to do something similar to this to get it working in ChessV.  A basic imitator rule will, of course, imitate all moves.  It requires extra code to stop it from imitating this.  Also, the Joker imitating a pawn cannot capture en passant even if a pawn could do so.  Fortunately, this did not require extra code for me just because of the way en passant is implemented as a rule and not a movement capability.


Aurelian Florea wrote on Mon, Dec 27, 2021 04:17 AM UTC in reply to H. G. Muller from Sun Dec 26 09:39 PM:

HG, I don't understand the bad zone script. How it would work. The way I see it the specific instructions to be added here would be something like: if lastMoved is pawn then imitate barren pawn. if lastMoved is berolina then imitate barren berolina.

The barren pieces pieces could be added in the diagram but not used in the initial setup.

But I don't think the interactive diagram supports lastMoved as the game courier supports it. It seems I'm screwed with this one!


💡📝H. G. Muller wrote on Mon, Dec 27, 2021 01:45 PM UTC in reply to Aurelian Florea from 04:17 AM:

Well, the idea was not to change any piece types, but detect whether the generated move was for an imitator imitating a pawn, and in that case forbid the move (by returning a non-zero value) when it advanced more than one rank. This was not so easy, though, because BadZone did not get the coordinates of the origin square passed to it, and it was not obvious what the imitator was imitating.

I did change the Diagram script now to make this easier: the variable 'imi' now contains the imitated piece at all times during the game, not just when the AI is thinking. And the square of origin are passed as extra parameters to BadZone. (Refresh the browser cache!) This should make the following script so what you want:

<script>
function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
  if(pieceType != NUMBER_OF_JOKER) return 0;
  if(imi != NUMBER_OF_PAWN) return 0;
  return (fromRank != (color ? toRank + 1 : toRank - 1));
}
</script>

(Replace the NUMBER_OF_... by the actual numbers your pieces have in your table.)


Aurelian Florea wrote on Mon, Dec 27, 2021 02:57 PM UTC in reply to H. G. Muller from 01:45 PM:

Wow H.G.,

Thanks!

I thought that was it!


Aurelian Florea wrote on Mon, Dec 27, 2021 03:40 PM UTC in reply to H. G. Muller from 01:45 PM:

I could not figure out where to put the bad zone script. It does not work yet it seems, even if with the proper modifications. Another thing that I am in doubt is if the hole piece count towards piece number. I assumed it does!


💡📝H. G. Muller wrote on Mon, Dec 27, 2021 06:00 PM UTC in reply to Aurelian Florea from 03:40 PM:

No, it does not. It is not in the table. (In fact the Diagram uses piece type = 250 for holes internally.) The Diagram should be put on the HTML page that contains the Diagram. It should not matter where. There is no way to relate the script to a specific Diagram, however. So if there are more than a single Diagram on the same page, they will all use the BadZone function defined in the script.


Aurelian Florea wrote on Mon, Dec 27, 2021 06:25 PM UTC in reply to H. G. Muller from 06:00 PM:

I have the following script, without any result:

function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) { if(pieceType != 14) return 0; if(imi != 1 && imi != 2) return 0; return (fromRank != (color ? toRank + 1 : toRank - 1)); }


💡📝H. G. Muller wrote on Mon, Dec 27, 2021 10:22 PM UTC in reply to Aurelian Florea from 06:25 PM:

Well, that looks OK. If you would post a link to the page where you have it, I could have a look at it, and maybe we could have some progress...


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 09:06 AM UTC in reply to Aurelian Florea from 07:02 AM:

OK, I found the problem. It turns out that the variable 'imi' was copied directly from the board, where it also contains color and highlighting information, besides the piece type. So these bits have to be stripped first by taking (imi & 511) to be left with the type. I suppose I should change the Diagram script to already do this by itself when storing imi, rather than when using it. For now you can fix it by using

  <script>
    function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
      if(pieceType != 14) return 0;
      if((imi & 511) > 2) return 0;
      return (fromRank > toRank + 1 || fromRank < toRank - 1);
    }
  </script>

This also fixes the problem that the highlighting function is also called to highlight the selected piece itself (so that fromRank equals toRank), and we don't want to suppress that. So I changed the test for suppressing only moves of more than 1 rank.

Note that it still wouldbe able to e.p. capture when imitating a pawn.


Aurelian Florea wrote on Tue, Dec 28, 2021 09:58 AM UTC in reply to H. G. Muller from 09:06 AM:

The longer moves are still shown. I'm not sure if the ai internally makes only 1 step moves. The enpassant and promotion rights are probably still there needing more BadZone functions, probably.

Also all these things should be done manually in the game courier generated script. Isn't that true?


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 12:34 PM UTC in reply to Aurelian Florea from 09:58 AM:

I can confirm that the BadZone function has no effect in the page at the link you gave. The weird thing is that when I ask the page source of that page, copy the Diagram in it to a local HTML page on my own computer, and open it in the browser, the distant moves do get suppressed. I have no idea why it doesn't work on your page. If I look in the browser console I do not get any error messages from the JavaScript on your page.

The problem is that I cannot experiment on your page; only you have access to it. This is why I copied to my own computer, but the copy shows no errors, so there is nothing to debug. Perhaps you can try the following: add as a first line in the BadZone routine the line

return 1;

This should suppress every move of every piece, and even prevent the highlighting of the piece itself. If that has no effect, I am pretty sure that the routine BadZone never gets called.


Aurelian Florea wrote on Tue, Dec 28, 2021 12:52 PM UTC in reply to H. G. Muller from 12:34 PM:

When I had put return 1 all moves where indeed suppressed.


Aurelian Florea wrote on Tue, Dec 28, 2021 01:00 PM UTC in reply to H. G. Muller from 12:34 PM:

Is there a mail of yours where I can send my password to you, so you can work on it? Then after you are done I just change the password.


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 01:05 PM UTC in reply to Aurelian Florea from 12:52 PM:

OK, so the routine is in fact called. Try the following. Below the script add a place where we can print debug output:

<p id="debug"></p>

Then inside the BadZone routine add a line

document.getElementById("debug").innerHTML += 'BadZone(' + toFile + ',' + toRank + ',' + pieceType + ',' + color + ',' + fromFile + ',' + toFile + ') imi =' + imi + '<br>';

Then we can get an impression of what goes wrong.

 


Aurelian Florea wrote on Tue, Dec 28, 2021 01:26 PM UTC in reply to H. G. Muller from 01:05 PM:

I get these errors, after a few moves:

BadZone(3,3,1,0,undefined,3) imi =undefined BadZone(3,4,1,0,undefined,3) imi =undefined BadZone(3,5,1,0,undefined,3) imi =undefined BadZone(3,6,1,0,undefined,3) imi =undefined BadZone(3,4,1,0,undefined,3) imi =undefined BadZone(3,5,1,0,undefined,3) imi =undefined BadZone(3,6,1,0,undefined,3) imi =undefined BadZone(1,4,1,0,undefined,1) imi =undefined BadZone(1,5,1,0,undefined,1) imi =undefined BadZone(1,6,1,0,undefined,1) imi =undefined BadZone(4,4,1,0,undefined,4) imi =undefined BadZone(4,5,1,0,undefined,4) imi =undefined BadZone(4,6,1,0,undefined,4) imi =undefined BadZone(7,4,1,0,undefined,7) imi =undefined BadZone(7,5,1,0,undefined,7) imi =undefined BadZone(7,6,1,0,undefined,7) imi =undefined BadZone(8,4,1,0,undefined,8) imi =undefined BadZone(8,5,1,0,undefined,8) imi =undefined BadZone(8,6,1,0,undefined,8) imi =undefined BadZone(10,4,1,0,undefined,10) imi =undefined BadZone(10,5,1,0,undefined,10) imi =undefined BadZone(10,6,1,0,undefined,10) imi =undefined BadZone(5,5,1,0,undefined,5) imi =undefined BadZone(5,6,1,0,undefined,5) imi =undefined BadZone(6,5,1,0,undefined,6) imi =undefined BadZone(6,6,1,0,undefined,6) imi =undefined BadZone(3,3,0,0,undefined,3) imi =1073741825 BadZone(3,6,1,0,undefined,3) imi =1073741825 BadZone(5,9,1,1024,undefined,5) imi =1073741825 BadZone(5,8,1,1024,undefined,5) imi =1073741825 BadZone(5,7,1,1024,undefined,5) imi =1073741825 BadZone(5,8,1,1024,undefined,5) imi =1073741825 BadZone(5,7,1,1024,undefined,5) imi =1073741825 BadZone(6,8,1,1024,undefined,6) imi =1073741825 BadZone(6,7,1,1024,undefined,6) imi =1073741825 BadZone(1,9,1,1024,undefined,1) imi =1073741825 BadZone(1,8,1,1024,undefined,1) imi =1073741825 BadZone(1,7,1,1024,undefined,1) imi =1073741825 BadZone(3,9,1,1024,undefined,3) imi =1073741825 BadZone(3,8,1,1024,undefined,3) imi =1073741825 BadZone(3,7,1,1024,undefined,3) imi =1073741825 BadZone(4,9,1,1024,undefined,4) imi =1073741825 BadZone(4,8,1,1024,undefined,4) imi =1073741825 BadZone(4,7,1,1024,undefined,4) imi =1073741825 BadZone(7,9,1,1024,undefined,7) imi =1073741825 BadZone(7,8,1,1024,undefined,7) imi =1073741825 BadZone(7,7,1,1024,undefined,7) imi =1073741825 BadZone(8,9,1,1024,undefined,8) imi =1073741825 BadZone(8,8,1,1024,undefined,8) imi =1073741825 BadZone(8,7,1,1024,undefined,8) imi =1073741825 BadZone(10,9,1,1024,undefined,10) imi =1073741825 BadZone(10,8,1,1024,undefined,10) imi =1073741825 BadZone(10,7,1,1024,undefined,10) imi =1073741825 BadZone(5,7,1,0,undefined,5) imi =1073742849 BadZone(5,9,0,0,undefined,5) imi =1073742849 BadZone(4,3,1,0,undefined,4) imi =1073742849 BadZone(4,4,1,0,undefined,4) imi =1073742849 BadZone(4,5,1,0,undefined,4) imi =1073742849 BadZone(4,6,1,0,undefined,4) imi =1073742849 BadZone(4,4,1,0,undefined,4) imi =1073742849 BadZone(4,5,1,0,undefined,4) imi =1073742849 BadZone(4,6,1,0,undefined,4) imi =1073742849 BadZone(1,4,1,0,undefined,1) imi =1073742849 BadZone(1,5,1,0,undefined,1) imi =1073742849 BadZone(1,6,1,0,undefined,1) imi =1073742849 BadZone(7,4,1,0,undefined,7) imi =1073742849 BadZone(7,5,1,0,undefined,7) imi =1073742849 BadZone(7,6,1,0,undefined,7) imi =1073742849 BadZone(8,4,1,0,undefined,8) imi =1073742849 BadZone(8,5,1,0,undefined,8) imi =1073742849 BadZone(8,6,1,0,undefined,8) imi =1073742849 BadZone(10,4,1,0,undefined,10) imi =1073742849 BadZone(10,5,1,0,undefined,10) imi =1073742849 BadZone(10,6,1,0,undefined,10) imi =1073742849 BadZone(5,5,1,0,undefined,5) imi =1073742849 BadZone(5,6,1,0,undefined,5) imi =1073742849 BadZone(6,5,1,0,undefined,6) imi =1073742849 BadZone(6,6,1,0,undefined,6) imi =1073742849 BadZone(3,7,1,0,undefined,3) imi =1073742849 BadZone(4,3,0,0,undefined,4) imi =1073741825 BadZone(4,6,1,0,undefined,4) imi =1073741825 BadZone(6,9,1,1024,undefined,6) imi =1073741825 BadZone(6,8,1,1024,undefined,6) imi =1073741825 BadZone(6,7,1,1024,undefined,6) imi =1073741825 BadZone(6,8,1,1024,undefined,6) imi =1073741825 BadZone(6,7,1,1024,undefined,6) imi =1073741825 BadZone(5,6,1,1024,undefined,5) imi =1073741825 BadZone(4,6,1,1024,undefined,4) imi =1073741825 BadZone(1,9,1,1024,undefined,1) imi =1073741825 BadZone(1,8,1,1024,undefined,1) imi =1073741825 BadZone(1,7,1,1024,undefined,1) imi =1073741825 BadZone(3,9,1,1024,undefined,3) imi =1073741825 BadZone(3,8,1,1024,undefined,3) imi =1073741825 BadZone(3,7,1,1024,undefined,3) imi =1073741825 BadZone(4,9,1,1024,undefined,4) imi =1073741825 BadZone(4,8,1,1024,undefined,4) imi =1073741825 BadZone(4,7,1,1024,undefined,4) imi =1073741825 BadZone(5,9,1,1024,undefined,5) imi =1073741825 BadZone(5,8,1,1024,undefined,5) imi =1073741825 BadZone(7,9,1,1024,undefined,7) imi =1073741825 BadZone(7,8,1,1024,undefined,7) imi =1073741825 BadZone(7,7,1,1024,undefined,7) imi =1073741825 BadZone(8,9,1,1024,undefined,8) imi =1073741825 BadZone(8,8,1,1024,undefined,8) imi =1073741825 BadZone(8,7,1,1024,undefined,8) imi =1073741825 BadZone(10,9,1,1024,undefined,10) imi =1073741825 BadZone(10,8,1,1024,undefined,10) imi =1073741825 BadZone(10,7,1,1024,undefined,10) imi =1073741825 BadZone(6,7,1,0,undefined,6) imi =1073742849 BadZone(6,9,0,0,undefined,6) imi =1073742849 BadZone(4,2,8,0,undefined,4) imi =1073742849 BadZone(4,5,8,0,undefined,4) imi =1073742849 BadZone(3,3,8,0,undefined,3) imi =1073742849 BadZone(4,4,8,0,undefined,4) imi =1073742849 BadZone(4,5,8,0,undefined,4) imi =1073742849 BadZone(3,3,8,0,undefined,3) imi =1073742849 BadZone(4,4,8,0,undefined,4) imi =1073742849 BadZone(7,5,8,0,undefined,7) imi =1073742849 BadZone(7,4,8,0,undefined,7) imi =1073742849 BadZone(4,2,0,0,undefined,4) imi =1073741832 BadZone(4,5,8,0,undefined,4) imi =1073741832 BadZone(5,10,1,1024,undefined,5) imi =1073741832 BadZone(5,9,1,1024,undefined,5) imi =1073741832 BadZone(5,8,1,1024,undefined,5) imi =1073741832 BadZone(5,9,1,1024,undefined,5) imi =1073741832 BadZone(5,8,1,1024,undefined,5) imi =1073741832 BadZone(5,6,1,1024,undefined,5) imi =1073741832 BadZone(4,6,1,1024,undefined,4) imi =1073741832 BadZone(6,6,1,1024,undefined,6) imi =1073741832 BadZone(1,9,1,1024,undefined,1) imi =1073741832 BadZone(1,8,1,1024,undefined,1) imi =1073741832 BadZone(1,7,1,1024,undefined,1) imi =1073741832 BadZone(3,9,1,1024,undefined,3) imi =1073741832 BadZone(3,8,1,1024,undefined,3) imi =1073741832 BadZone(3,7,1,1024,undefined,3) imi =1073741832 BadZone(4,9,1,1024,undefined,4) imi =1073741832 BadZone(4,8,1,1024,undefined,4) imi =1073741832 BadZone(4,7,1,1024,undefined,4) imi =1073741832 BadZone(6,9,1,1024,undefined,6) imi =1073741832 BadZone(6,8,1,1024,undefined,6) imi =1073741832 BadZone(7,9,1,1024,undefined,7) imi =1073741832 BadZone(7,8,1,1024,undefined,7) imi =1073741832 BadZone(7,7,1,1024,undefined,7) imi =1073741832 BadZone(8,9,1,1024,undefined,8) imi =1073741832 BadZone(8,8,1,1024,undefined,8) imi =1073741832 BadZone(8,7,1,1024,undefined,8) imi =1073741832 BadZone(10,9,1,1024,undefined,10) imi =1073741832 BadZone(10,8,1,1024,undefined,10) imi =1073741832 BadZone(10,7,1,1024,undefined,10) imi =1073741832 BadZone(5,8,1,0,undefined,5) imi =1073742849 BadZone(5,10,0,0,undefined,5) imi =1073742849 BadZone(4,1,18,0,undefined,4) imi =1073742849 BadZone(3,3,18,0,undefined,3) imi =1073742849 BadZone(2,5,18,0,undefined,2) imi =1073742849 BadZone(1,7,18,0,undefined,1) imi =1073742849 BadZone(0,9,18,0,undefined,0) imi =1073742849 BadZone(3,3,18,0,undefined,3) imi =1073742849 BadZone(2,5,18,0,undefined,2) imi =1073742849 BadZone(1,7,18,0,undefined,1) imi =1073742849 BadZone(0,9,18,0,undefined,0) imi =1073742849 BadZone(4,1,0,0,undefined,4) imi =1073741842 BadZone(1,7,18,0,undefined,1) imi =1073741842 BadZone(6,10,1,1024,undefined,6) imi =1073741842 BadZone(6,9,1,1024,undefined,6) imi =1073741842 BadZone(6,8,1,1024,undefined,6) imi =1073741842 BadZone(6,9,1,1024,undefined,6) imi =1073741842 BadZone(6,8,1,1024,undefined,6) imi =1073741842 BadZone(5,6,1,1024,undefined,5) imi =1073741842 BadZone(4,6,1,1024,undefined,4) imi =1073741842 BadZone(6,6,1,1024,undefined,6) imi =1073741842 BadZone(1,9,1,1024,undefined,1) imi =1073741842 BadZone(1,8,1,1024,undefined,1) imi =1073741842 BadZone(3,9,1,1024,undefined,3) imi =1073741842 BadZone(3,8,1,1024,undefined,3) imi =1073741842 BadZone(3,7,1,1024,undefined,3) imi =1073741842 BadZone(4,9,1,1024,undefined,4) imi =1073741842 BadZone(4,8,1,1024,undefined,4) imi =1073741842 BadZone(4,7,1,1024,undefined,4) imi =1073741842 BadZone(7,9,1,1024,undefined,7) imi =1073741842 BadZone(7,8,1,1024,undefined,7) imi =1073741842 BadZone(7,7,1,1024,undefined,7) imi =1073741842 BadZone(8,9,1,1024,undefined,8) imi =1073741842 BadZone(8,8,1,1024,undefined,8) imi =1073741842 BadZone(8,7,1,1024,undefined,8) imi =1073741842 BadZone(10,9,1,1024,undefined,10) imi =1073741842 BadZone(10,8,1,1024,undefined,10) imi =1073741842 BadZone(10,7,1,1024,undefined,10) imi =1073741842 BadZone(6,8,1,0,undefined,6) imi =1073742849 BadZone(6,10,0,0,undefined,6) imi =1073742849 BadZone(4,0,14,0,undefined,4) imi =1073742849 BadZone(4,1,14,0,undefined,4) imi =1073742849 BadZone(4,2,14,0,undefined,4) imi =1073742849 BadZone(4,3,14,0,undefined,4) imi =1073742849 BadZone(4,4,14,0,undefined,4) imi =1073742849


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 02:23 PM UTC in reply to Aurelian Florea from 01:26 PM:

OK, the problem obviously is that 'imi' is not defined. I am pretty sure I uploaded the version that updates 'imi' also on user moves yesterday, but it turns out the old version was still on the CVP website. So somehow th upload must have failed. I now uploaded it again, and this fixes the problem. You can remove the document... line from the BadZone function now.


Aurelian Florea wrote on Tue, Dec 28, 2021 03:59 PM UTC in reply to H. G. Muller from 02:23 PM:

This is done. It works correctly. What about enpassant and promotion?


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 05:55 PM UTC in reply to Aurelian Florea from 03:59 PM:

Promotion is done based on the piece type, so if the Joker is not amongst the promotable pieces, it will not promote. Only moves are immitated.

Because you have two different kinds of Pawns the test for it becomes complicated. In any case the destination square must be empty. But then for normal Pawns diagonal moves must be excluded, and for Berolinas the straight moves. So omething like

if(board[toRank][toFile] & 511) {
  if(pieceType == 1) return (toFile != fromFile);
  if(pieceType == 2) return (toFile == fromFile);
}

Aurelian Florea wrote on Tue, Dec 28, 2021 09:08 PM UTC in reply to H. G. Muller from 05:55 PM:

This should be in another function BadZone2 for example, isn't it?


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 10:34 PM UTC in reply to Aurelian Florea from 09:08 PM:

No, ther can be only one function BadZone, which must detect all moves you want to forbid, and return true (non-zero) for those (and false or 0 for the others). So you have to put this in BadZone just before the final return statement (which would otherwise return 'false', because in e.p. capture you only advance one rank)


Aurelian Florea wrote on Wed, Dec 29, 2021 08:43 AM UTC in reply to H. G. Muller from Tue Dec 28 10:34 PM:

It works well, HG, Thank you and a happy new year.


💡📝H. G. Muller wrote on Wed, Dec 29, 2021 10:00 PM UTC in reply to Aurelian Florea from 08:43 AM:

Well, actually it doesn't, because I messed up. One should not test pieceType (which will always be 14 at this point), but imi, to decide which moves to forbid. In addition, I tested for a full square, rather than an empty. The following routine should work: it first declares OK all non-imitator moves, all imitations of non-pawns, and all moves to occupied squares. At that point only non-capture pawn imitations are left, and advances of more than 1 rank can be flagged as illegal. finally it tests for e.p. depending on which pawn type is imitated.

    function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
      if(pieceType != 14) return 0;
      if((imi & 511) > 2) return 0;
      if(board[toRank][toFile] & 511) return 0;
      if(fromRank > toRank + 1 || fromRank < toRank - 1) return 1; 
      if(imi == 1) return (toFile != fromFile);
      return (toFile == fromFile);
    }

25 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.