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

@ Fergus Duniho[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Mon, Nov 13, 2023 08:54 AM UTC in reply to Fergus Duniho from Sun Nov 12 09:49 PM:

To elaborate a bit on what Fergus said: the PHP set scripts assign a piece label (usually a single letter) to each image, which then can be used in the FEN fed to the Diagram Designer. But some sets are 'automatic', which means they scan the image directory for any images for which they haven't defined a piece label yet, and include these in the set with the root of the image name as label. This is the kind of thing you would want here. To give an example, I printed the auto-alfaeriePNG.php script below:

<?
include_once "/home/chessvariants/public_html/play/pbm/constants.php";
$dir = "/graphics.dir/alfaeriePNG/";
$dirname = CVP_ROOT . "/graphics.dir/alfaeriePNG/";
$maindir = opendir($dirname);
$pieces = array();
$width = $height = 50;
while ($filename = readdir($maindir)) {
    $fullname = $dirname . $filename;
    if (!is_file($fullname))
        continue;
    $t = mime_content_type($fullname);
    if (($t != "image/gif") && ($t != "image/png"))
        continue;
    list($w, $h, $t) = getimagesize($fullname);
    if (($t != IMAGETYPE_GIF) && ($t != IMAGETYPE_PNG))
        continue;
    if (($w > $width) || ($h > $height))
        continue;
    $key = substr($filename, 1, strlen($filename)-5);
    if (($filename[0] == "w") || ($filename[0] == "W"))
        $key = strtoupper($key);
    elseif (($filename[0] == "b") || ($filename[0] == "B"))
        $key = strtolower($key);
    else
        $key = $filename[0] . $key;
    $pieces[$key] = $filename;
    $width = max($width, $w);
    $height = max($width, $h);
}
$pieces["P"] = $pieces["PAWN"];
$pieces["p"] = $pieces["pawn"];
$pieces["N"] = $pieces["KNIGHT"];
$pieces["n"] = $pieces["knight"];
$pieces["B"] = $pieces["BISHOP"];
$pieces["b"] = $pieces["bishop"];
$pieces["R"] = $pieces["ROOK"];
$pieces["r"] = $pieces["rook"];
$pieces["Q"] = $pieces["QUEEN"];
$pieces["q"] = $pieces["queen"];
$pieces["K"] = $pieces["KING"];
$pieces["k"] = $pieces["king"];
$pieces["C"] = $pieces["CANNON"];
$pieces["c"] = $pieces["cannon"];
$pieces["A"] = $pieces["CARDINAL"];
$pieces["a"] = $pieces["cardinal"];
$pieces["M"] = $pieces["CHANCELLOR"];
$pieces["m"] = $pieces["chancellor"];
$pieces["E"] = $pieces["ELEPHANTFERZ"];
$pieces["e"] = $pieces["elephantferz"];
$pieces["J"] = $pieces["CAMEL"];
$pieces["j"] = $pieces["camel"];
$pieces["D"] = $pieces["DRAGON"];
$pieces["d"] = $pieces["dragon"];
$pieces["W"] = $pieces["WILDEBEEST"];
$pieces["w"] = $pieces["wildebeest"];
$pieces["L"] = $pieces["LION"];
$pieces["l"] = $pieces["lion"];
$pieces["U"] = $pieces["UNICORN"];
$pieces["u"] = $pieces["unicorn"];
$pieces["F"] = $pieces["BIRD"];
$pieces["f"] = $pieces["bird"];
$pieces["Z"] = $pieces["AMAZON"];
$pieces["z"] = $pieces["amazon"];
$pieces["G"] = $pieces["GRYPHON"];
$pieces["g"] = $pieces["gryphon"];
closedir ($maindir);
$width = $height = 50;
asort ($pieces);
?>