Check out Janggi (Korean Chess), our featured variant for December, 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

Jocly. An html-based web platform for playing 2-player abstract stategy games.[All Comments] [Add Comment or Rating]
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.