Check out Alice Chess, our featured variant for June, 2024.

Enter Your Reply

The Comment You're Replying To
H. G. Muller wrote on Mon, Jan 15 02:03 PM UTC in reply to François Houdebert from 09:26 AM:

If a 'prelude-model.js' is created, I'll try to use it to set timurid parameters, which will allow the declinations to be merged.

I wonder how I could best generalize the Metamachy prelude code. In Metamachy the various options are presented as a 4x3 matrix of clickable images, each image being a 2x2 composit of 4 icons in various relative positions. For Metamachy that makes sense, as the setups to be selected partain to an area of 2x2 squares.

In general the area could have any shape, e.g. a number of pieces on the back rank, and then another layout would be more natural. So it should be able to configure both the layout of the selection panel, and the layout of the individual clickable items in them. It could also be useful to allow accompanying texts, although the use of icons should be the principal method. (But in the Tamerid games it would be nice to have the name of the variant next to the icon-decorated buttons.)

So I am thinking in the direction of having the caller of a function that defines a prelude supply information on how the selection panel should look. A button in the selection panel could be defined by a character string as a mini-FEN. A numeric argument could indicate how many buttons should be displayed side by side.

Metamachy adapts the board-display routine to not show the configurable pieces, and then shuffles those according to the selection that was made. (Or by the AI: randomly.) This seems a round-about way of doing things; why not just leave the pieces away in the initial setup to begin with, and then just place them instead of shuffling them? That also saves you the work of taking them away! (And correcting the hash key for that...) Anyway, apart from how the icons must be painted on the buttons, it must also be specified to which square each position on the button corresponds, so that he piece can be moved there according to the selection. That can be an array of square numbers.

Because the selection might apply to both black and white, (as is the case in Metamachy) we might actually want to pass two such arrays. We should also account for the possibility that the prelude involves a number of selection events. And in whose turn these events must take place. E.g. white and black might be allowed to each chose their initial setup independently. I think Jocly enforces strict turn alteration, so it could be needed to skip some turns. (I think Metamachy already does this: black selects the setup, so the game must start with a dforced pass for white.) And it must be possible to provide a routine for the AI to make the selection, which would be run instead of showing the selection panel when the selection happens in the AI's turn.

Perhaps something like this:

Model.Board.Prelude = [ // sequence of panel descriptors in an array
  {
    who: 1, // show during white's next turn
    panelWidth: 4, // 4 buttons on a row
    setups: ["KQ/LE", "KQ/EL", "QK/EL", "QK/LE"], // the 4 options, and how their buttons look
    squares: { // where the 4 pieces go
      "1": [14,15,4,5], // for white
      "-1": [84,85,94,95] // and for black
    },
    ai: function() {  return Math.floor(Math.random()*4); } // how the AI would select
  }
];

Edit Form

Comment on the page Jocly

Conduct Guidelines
This is a Chess variants website, not a general forum.
Please limit your comments to Chess variants or the operation of this site.
Keep this website a safe space for Chess variant hobbyists of all stripes.
Because we want people to feel comfortable here no matter what their political or religious beliefs might be, we ask you to avoid discussing politics, religion, or other controversial subjects here. No matter how passionately you feel about any of these subjects, just take it someplace else.
Avoid Inflammatory Comments
If you are feeling anger, keep it to yourself until you calm down. Avoid insulting, blaming, or attacking someone you are angry with. Focus criticisms on ideas rather than people, and understand that criticisms of your ideas are not personal attacks and do not justify an inflammatory response.
Quick Markdown Guide

By default, new comments may be entered as Markdown, simple markup syntax designed to be readable and not look like markup. Comments stored as Markdown will be converted to HTML by Parsedown before displaying them. This follows the Github Flavored Markdown Spec with support for Markdown Extra. For a good overview of Markdown in general, check out the Markdown Guide. Here is a quick comparison of some commonly used Markdown with the rendered result:

Top level header: <H1>

Block quote

Second paragraph in block quote

First Paragraph of response. Italics, bold, and bold italics.

Second Paragraph after blank line. Here is some HTML code mixed in with the Markdown, and here is the same <U>HTML code</U> enclosed by backticks.

Secondary Header: <H2>

  • Unordered list item
  • Second unordered list item
  • New unordered list
    • Nested list item

Third Level header <H3>

  1. An ordered list item.
  2. A second ordered list item with the same number.
  3. A third ordered list item.
Here is some preformatted text.
  This line begins with some indentation.
    This begins with even more indentation.
And this line has no indentation.

Alt text for a graphic image

A definition list
A list of terms, each with one or more definitions following it.
An HTML construct using the tags <DL>, <DT> and <DD>.
A term
Its definition after a colon.
A second definition.
A third definition.
Another term following a blank line
The definition of that term.