Check out Janggi (Korean Chess), our featured variant for December, 2024.

Enter Your Reply

The Comment You're Replying To
H. G. Muller wrote on Wed, Jan 17 08:12 AM UTC in reply to François Houdebert from Mon Jan 15 02:40 PM:

I did it slightly differently: the prelude property in the game definition is now an array of objects like the one I proposed, except that I dropped the 'who' property. Each position in the array corrsponds to a turn, so it is already obvious who is on move for each prelude 'stage'.

If the array item is a zero, that turn will be passed; this is for allowing two different selections in a row by the same player, or black starting to make a selection.

I copied most of the code for the prelude model and view files from Metamachy, replacing the hard-coded locations and sizes of the selection panel and buttons by values calculated from the prelude definition. There is one thing I do differently, though: in Metamachy all pieces start on the board in a default location. (It appears this is important for them to show up later). The display function is intercepted to suppress the display of the pieces to displayed, and when a setup is selected, the pieces are first removed, and then placed back in another constellation.

As we want to be able to select from a wider range of pieces than actually has to be placed this same method could not be used anyway. So what I do is not shuffling the pieces, but 'promoting' them by altering their type. As I noticed that Jocly sorts the piece list by increasing value of the piece type (which does not seem to be essential, as on promotion during a game it doesn't resort it, but it could have efficiency ramifications for the AI), I resort the list afterwards. (This required a small change in base-model, to make the sorting available as a separate function.)

So you would typically start with pieces in all locations where you want to place any, it doesn't matter of which type. The prelude then assigns them the types that were selected for the square they are on.

If you would want a square to appear empty before the prelude (as is done in Metamachy) this could be achieved by initially placing a piece there of a type that has an invisible image. Or perhaps better, that shows up like a flat marker (a checker?) with a question mark on it. That way makes it clear which squares you are making the selection for, if there are more empty squares than pieces to place. (As is the case in Metamachy!) I will see if I can make the prelude-view automatically add such a piece to the set that is in use; in the piece-drops sub-model I do provide flat 'pieces' with a number on them, which can be put on the holdings squares to indicate how many pieces of that type you have in hand.

I tested the thing on Timorid, by adding to the game definition:

prelude: [0,{
  panelWidth: 1,
  setups: ["XQX","HQH","XHX","QHQ"],
  squares: { 1:[15,18,20], '-1':[123,126,128] }
}],

with some (nonsense) alternatives for the setup of Ships (X), Queens and Griffons (H). The 0 indicates that white passes his first turn, so that the selection is done by black (and randomly picked if the computer plays black). This give the following selection panel:

A complication is that asymmetric pieces must be defined as separate types for white and black in Jocly. This has always annoyed me, and perhaps we should fix this one day (by assigning every type two graphs, one for white and an (optionally different) one for black. Anyway, for now I solved it by allowing an optional property 'blackOffsets' in the prelude objects, which would be an object that for each relevant piece type optionally specifies how much should be added to the type number when it is black.

I kept the layout principles of the selection panel the same as was used for Metamachy: one icon size between the buttons, and half that between button and edge. This looks a bit spacey when the buttons are only a single icon high, like here. On the other hand, it would offer space to display a text under the button; perhaps I can manage that. (This would require a new optional property in the prelude object, e.g. 'subscripts', and array that contains a string for each setup.) The layout might need a larger margin at the bottom for that, though. (And perhaps there could also be a larger margin at the top, to allow you to display a message there over the full width of the panel, fiven by an optional property 'header'.)


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.