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 Sun, Feb 14, 2021 08:17 PM UTC in reply to Fergus Duniho from 06:25 PM:

Those for Janus Chess each contain the whole script in a single line, making them difficult to read. Besides that, they are so incredibly different and obfuscated that I cannot make heads or tails of them. It's more like something a compiler would output than a human would write.

And that is exactly what it is. What you are looking at is the so-called 'uglified' library file, generated in the compilation process that created the library. This is common practice in JavaScript, to minimize the size, and thus the bandwidth use of the server that hosts it. The tar ball only contained that library. The source code is also on my website, at http://hgm.nubati.net/jocly/jocly-master/src/ .

Beware, though: that is the original source code I downloaded from GitHub. It doesn't contain any of the games I implemented. Initially I had so much trouble compiling the thing (I actually never managed that on Windows, and finally had to create a new Virtual Machine running a recent Ubuntu version to get it done), that I just started hacking the new games into the library. Unfortunately the compilation process fuses the general Chess code ('base-model.js') with the variant-specific model file in the compilation process. So what I did is take a file for normal Chess, and replaced the uglified code of the chess model by normal source code for the variant I wanted to implement instead. But leaving the uglified base-model.js that was also in the file just as it was.

In the end I mastered the compilation of Jocly on Linux, and back-ported most of the hacks I had done to decent source code. (But not all yet.) That source code can now be found in my on-line git repository (jocly.git section, 'hgm' branch). If you go to the 'tree' of the latest snapshot ('Fix castling and stalemate in Wildebeest Chess') in that branch, to directory /src/games/chessbase/, you will find the werewolf-model.js and werewolf-view.js files (and spartan, and shogi, and elven, ...) there as decent source code. Since some of these games require originally unsupported chess concepts (such as multiple royalty, double capture) those will only work together with files 'deeper' in Jocly (e.g. base-model and -view for general chess-variant support) that I also modified. You would have to use my versions for these as well, and I am not sure whether the method you were using for embedding Jocly would allow that. (It probably takes those from the jquery.jocly.min.js file, and you would have to somehow overrule that.)

I think it would be a far easier path to adapt the control.html that comes with the new Jocly distro; it is a quite simple page, as all the script to actually make Jocly appear and run it is in an external JavaScript file. It should be very easy to convert the look of that file to what you have for the games already on CVP. Just add the ads at the bottom of the column on the right, and put a description of the game at the bottom, and CVP headers and footers above and below it. The only thing that is dependent on the variant is the rule description. But all these Jocly games already come with rule-description files, and you could just copy-paste those there. Or, if you want to be really smart, put some JavaScript code there that would display the rule description for the variant that the argument in the URL requests in a frame. Then you can use exactly the same page for all variants.


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.