Check out Alice Chess, our featured variant for June, 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
Game Courier. PHP script for playing Chess variants online.[All Comments] [Add Comment or Rating]
A. M. DeWitt wrote on Sun, Dec 18, 2022 10:06 AM EST in reply to Fergus Duniho from Sat Dec 17 10:04 PM:

Fair enough.


H. G. Muller wrote on Sun, Dec 18, 2022 10:38 AM EST in reply to Fergus Duniho from Sat Dec 17 01:12 PM:

If all your pieces are from the same set, I am going to recommend using aliases instead of the newer method of rewriting $pieces.

Note that I added several 'Automatic' sets, each of which contains all available pieces of the corresponding style. E.g. alfaeriePNG, alfaeriePNG35, Utrecht/Small, XBoard, XBoard33.) That makes it easier to satisfy the 'same set' condition.

These all use the (fully capitalized or lower-cased) image names as internal piece labels. If I understand everything correctly that would not be a problem, and can be hidden from the user by defining an alias for those to be used in notation.


🕸💡📝Fergus Duniho wrote on Sun, Dec 18, 2022 09:01 PM EST in reply to A. M. DeWitt from Sun Nov 20 10:12 AM:

Adam,

I was recently getting lines like this in the PHP error log:

[18-Dec-2022 15:05:06 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 45
[18-Dec-2022 15:05:06 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 45
[18-Dec-2022 15:05:06 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 45
[18-Dec-2022 15:05:06 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 45
[18-Dec-2022 15:05:06 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 45
[18-Dec-2022 15:05:06 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 45

Not sure what was going on, I added some code to log the value of $move, and now it looks like this:

[19-Dec-2022 00:27:03 UTC] move: sub israngecapture from to kingpos
[19-Dec-2022 00:27:03 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 47
[19-Dec-2022 00:27:03 UTC] move: sub israngecapture from to kingpos
[19-Dec-2022 00:27:03 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 47
[19-Dec-2022 00:27:03 UTC] move: sub israngecapture from to kingpos
[19-Dec-2022 00:27:03 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 47
[19-Dec-2022 00:27:03 UTC] move: sub israngecapture from to kingpos
[19-Dec-2022 00:27:03 UTC] PHP Warning:  Undefined array key 2 in /home/chessvariants/public_html/play/pbm/gamecode.php on line 47

The culprit seems to be your israngecapture subroutine. When I looked at your code, it was defined with the three parameters shown above, but you were calling it without a value for the last parameter. Now that I understand what the problem is, I have replaced the error log with an error message for the user.


A. M. DeWitt wrote on Mon, Dec 19, 2022 09:25 AM EST in reply to Fergus Duniho from Sun Dec 18 09:01 PM:

It seems I had an extra parameter in the israngecapture subroutine from when I was trying to use a subroutine to determine whether a range capturing piece had any legal moves left mid-move. It is fixed now. The responsibility of determining whether a piece has any moves left mid-move has been moved to the Post-Game sections, making use of the legalmoves2 subroutine's return value. I also fixed Mitsugumi Shogi's GC preset, which had the same problem.

Edit: I also got rid of the from parameter in the israngecapture subroutine and the statements that call it. Since it wasn't being used within the subroutine itself, there was no need to include it in the parameter list.


🕸💡📝Fergus Duniho wrote on Sun, Dec 25, 2022 03:24 PM EST:

I am currently working on supporting recolored SVG pieces in Game Courier for the CSS and Table formats. This involves the display of individual piece images. It works fine for GIF or PNG pieces, but not for SVG pieces. Although it will work if loaded into a separate tab, it will not display the piece through an IMG tag. The first piece below is from the alfaerie-svg set, and the second is from the alfaerie set. Only the latter is displaying through the IMG tag. Any ideas why?

Here's my code for recoloring and displaying the SVG image:

if (preg_match("/\.svg$/i", $url)) {
    $blob = file_get_contents($url);
    if (array_key_exists($color, $colorcode))
        $color = $colorcode[$color];
    if ($color[0] != "#")
        $color = "#" . $color;
    if (strtolower($color) != "#f9f9f9")
        $blob = str_replace("#f9f9f9", $color, $blob);
    echo $blob;
}

H. G. Muller wrote on Sun, Dec 25, 2022 03:32 PM EST in reply to Fergus Duniho from 03:24 PM:

Does the showpiece.php say in the header that the Content-Type is image/svg, rather than image/png?


🕸💡📝Fergus Duniho wrote on Sun, Dec 25, 2022 03:48 PM EST in reply to H. G. Muller from 03:32 PM:

When I included the line header('Content-Type: image/svg');, it still did not work in an IMG tag, and it would not even work in a separate tab. Instead, it would download the SVG file.


🕸💡📝Fergus Duniho wrote on Sun, Dec 25, 2022 03:56 PM EST in reply to H. G. Muller from 03:32 PM:

I got it to work by changing the content-type to image/svg+xml.


🕸💡📝Fergus Duniho wrote on Sun, Dec 25, 2022 05:32 PM EST:

Game Courier now supports the use of recolored SVG pieces with all of its rendering methods. The available set I've tested this with is "alfaerie-svg", which is listed as "Alfaerie SVG". The "Alfaerie: All SVG" set actually uses PNG images, not SVG images. It should be renamed, or its pieces should be modified to use SVG pieces.


🕸💡📝Fergus Duniho wrote on Fri, Jan 13, 2023 06:52 PM EST:

To prevent the recoloring of pieces not meant to be recolored, such as Shogi pieces, I stopped assigning values to $originalwhite and $originalblack if the set doesn't already have known colors.


abcdefgh1357 wrote on Sun, Jul 9, 2023 08:11 AM EDT:
Bug in Alice Chess, move not marked as legal.

1. P d2-d3 
1... n g8-f6 
2. N b1-c3 
2... p e7-e6 
3. N C3-D5 
3... q d8-e7 
4. P e2-e3 
4... n b8-c6 
5. Q d1-d2 
5... p a7-a5 
6. N g1-f3 
6... b f8-c5 
7. B f1-e2 
7... n F6-E4 
8. K e1-g1 
8... r h8-g8 // - Check! -
9. P g2-g3 
9... p b7-b6 
10. B c1-h6 
10... b c8-a6 
11. R a1-c1 
11... n C6-B4 
12. N d5-b4 
12... p A5-B4 [not marked as legal, had to force it]

Also, the Preview of Comment doesn't seem to work.

🕸💡📝Fergus Duniho wrote on Mon, Jul 10, 2023 06:02 PM EDT in reply to abcdefgh1357 from Sun Jul 9 08:11 AM:

Bug in Alice Chess, move not marked as legal.

I determined that the problem was only with Pawns on the side, and it was due to the functions that determine the spaces to check for legal moves in. These functions originally looked like this:

def PL array where #0 0 2 where #0 0 1 where #0 -1 1 where #0 1 1;
def pL array where #0 0 -2 where #0 0 -1 where #0 -1 -1 where #0 1 -1;

I replaced them with the more up-to-date and sophisticated versions from the fairychess include file, and they now look like this:

def PL filter lambda (onboard #1) mergeall where #ori -1 1 where #ori 1 1 values lambda (where #ori 0 #1) range 1 var fps =ori;
def pL filter lambda (onboard #1) mergeall where #ori -1 -1 where #ori 1 -1 values lambda (where #ori 0 neg #1) range 1 var fps =ori;

Apparently, the earlier version would break out prematurely if one of the spaces was not on the board, which would be the case for a Pawn on the side of the board. But the one using lambda functions does not do this.


H. G. Muller wrote on Sun, Sep 24, 2023 07:12 AM EDT in reply to Fergus Duniho from Mon Jul 10 06:02 PM:

@Fergus: It appears the GAME-code operator lastrank returns 8 on a 9x8 board (e.g. when I add some code to print its value in this preset). That is not correct, is it? The GAME-code reference manual states it should return 7 on a board with 8 ranks.


🕸💡📝Fergus Duniho wrote on Wed, Sep 27, 2023 06:54 PM EDT in reply to H. G. Muller from Sun Sep 24 07:12 AM:

It appears the GAME-code operator lastrank returns 8 on a 9x8 board (e.g. when I add some code to print its value in this preset). That is not correct, is it?

It's not correct, but the bug is not on my end. When I entered the FEN code for this game into a preset for Chess, it gave the correct value of 7. The problem is that your Rank Labels field explicitly specifies 9 ranks with the value of "1 2 3 4 5 6 7 8 9". This adds an extra element to the $ranks array, whose size is used to calculate lastrank.


H. G. Muller wrote on Thu, Sep 28, 2023 02:33 AM EDT in reply to Fergus Duniho from Wed Sep 27 06:54 PM:

It's not correct, but the bug is not on my end. When I entered the FEN code for this game into a preset for Chess, it gave the correct value of 7. The problem is that your Rank Labels field explicitly specifies 9 ranks with the value of "1 2 3 4 5 6 7 8 9". This adds an extra element to the $ranks array, whose size is used to calculate lastrank.

OK, thanks for resolving this. The preset isn't mine, but I was using it for testing a new feature in the betza.txt include file, since it was one of the presets automated through this that I was aware of. This way of automating is not responsible for the rank labels, and purely works with the internal rank numbers. And it was not using any feature of the betza.txt incluce that was dependent on lastrank. But the new feature I was testing did. (And would actually work correctly in a context that provides the correct value of lastrank.)

There seems to be some inconsistency here, though, as the 'fantom rank' does not show up in the board diagram. So some parts of the Game Courier code must have a different notion of how many ranks there are from what the rank labels imply.


🕸💡📝Fergus Duniho wrote on Thu, Sep 28, 2023 11:39 AM EDT in reply to H. G. Muller from 02:33 AM:

There seems to be some inconsistency here, though, as the 'fantom rank' does not show up in the board diagram. So some parts of the Game Courier code must have a different notion of how many ranks there are from what the rank labels imply.

The inconsistency is between the FEN code and the Rank Labels field. The FEN code has defined only 8 ranks, and the Rank Labels has named 9 ranks.


H. G. Muller wrote on Thu, Sep 28, 2023 12:50 PM EDT in reply to Fergus Duniho from 11:39 AM:

Indeed. But some parts of Game Courier appear to base the number of ranks on the FEN, and other parts on the labels. This allows incompatible values to coexist internally, without warning, and not easily noticed. It might be better to use one of those as the accepted value, and emit an error message if the other doesn't comply. That would guarantee consistency, rather than making it depend on fallible users.


🕸💡📝Fergus Duniho wrote on Thu, Sep 28, 2023 02:40 PM EDT in reply to H. G. Muller from 12:50 PM:

It might be better to use one of those as the accepted value, and emit an error message if the other doesn't comply.

I have added code to display a warning if the number of ranks calculated from the FEN Code does not match the number calculated from the value of the Rank Labels field. Perhaps because of the CSS for the warning class, it is showing up even though it's where messages are normally hidden.


🕸💡📝Fergus Duniho wrote on Thu, Sep 28, 2023 02:48 PM EDT in reply to Fergus Duniho from 02:40 PM:

Perhaps because of the CSS for the warning class, it is showing up even though it's where messages are normally hidden.

No, it looks like any text is showing up where it should be hidden. I'll look into this after lunch.


🕸💡📝Fergus Duniho wrote on Thu, Sep 28, 2023 05:59 PM EDT in reply to Fergus Duniho from 02:48 PM:

The text that is hidden is just narrower than I thought it was. It only hides the output of runsubroutine(), and the warning I inserted was before this.


Kevin Pacey wrote on Tue, Jan 30 06:51 PM EST:

@ Fergus:

In the settings file of mine linked to below, I had its 3 cells' colors scheme working before the introduction some time ago of automatic 'rank' labels to circular chess presets.

That is, besides shifting the position of the armies in the setup by 45 degrees, the automatic labeling seems to have unhinged the 8 orange-color cells' scheme I previously had working successfully (the majority of cells being colored either white or pink). I have recently tried many things to 'restore order' to the appearance of this preset, but no luck so far. Perhaps you can help:

https://www.chessvariants.com/play/pbm/play.php?game=Carrousel+Chess&settings=default


🕸💡📝Fergus Duniho wrote on Thu, Feb 1 03:20 PM EST in reply to Kevin Pacey from Tue Jan 30 06:51 PM:

I fixed it according to how it should work with the first and last file meeting at 6:00. You should now be able to adjust your colors to how you want them.


Kevin Pacey wrote on Thu, Feb 1 05:09 PM EST in reply to Fergus Duniho from 03:20 PM:

I think that the settings file is fine the way you have it right now, Fergus. Thanks.


Kevin Pacey wrote on Thu, Feb 1 08:46 PM EST:

@ Fergus (or H.G.):

I made a rules enforcing preset for 4 Kings Quasi-Shatranj (see link below), but in spite of including custom set specifications and all other details that the Play-Test Applet generated, wrong piece types are showing up in the preset diagram, both before or after finishing editing the settings file.

I've used Alfaerie: Many (thinking it did not matter), but I also tried Auto Alfaerie PNG and Auto Alfaerie PNG35 as my piece sets for the settings file, but none of those choices worked properly after editing or before. Is there something I am missing that's not stated (or I've overlooked) on the Applet's page (a Menu: Tools item) regarding customs sets, or are the custom sets (or their implementation) no longer working properly, if they ever did?:

https://www.chessvariants.com/play/pbm/play.php?game=4+Kings+Quasi-Shatranj&settings=enforcing


🕸💡📝Fergus Duniho wrote on Thu, Feb 1 09:14 PM EST in reply to Kevin Pacey from 08:46 PM:

I've used Alfaerie: Many (thinking it did not matter),

It does matter. Your set should be "Completely Custom Set" from the Custom group.


25 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.