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 ]

Comments by Michel Gutierrez

Earlier Reverse Order LaterLatest
Glinski's Hexagonal Chess. Chess on a board made out of hexagons. (Cells: 91) (Recognized!)[All Comments] [Add Comment or Rating]
Michel Gutierrez wrote on Sat, May 17, 2014 11:51 AM UTC:
I have updated the Glinski Chess implementation on Jocly to match rule 2. The Android and iPhone/iPad apps are still using rule 1 until the next upgrade.

Fairy-Max: an AI for playing user-defined Chess variants. A chess engine configurable for playing a wide variety of chess variants.[All Comments] [Add Comment or Rating]
Michel Gutierrez wrote on Wed, Dec 3, 2014 12:48 PM UTC:Excellent ★★★★★

For those interested, Fairy-Max is now being used as a remotely connected bot player on the Jocly platform. It offers regular orthodox Chess, Makruk, Capablanca, Cylinder Chess, Shatranj, and Courier. XiangQi is also available via the Max-Qi engine from the same author as Fairy-Max.

To play one of those variants, go to https://www.jocly.com/#/open-tables and click on an open table to start the game, or invite user HGMBot to play. Since the bot is connected to Jocly as a regular user, you'll need your own Jocly account (free) to play this AI.

Prefer Firefox, Chrome or Safari (with WebGL enabled) to get a 3D interface for playing. If 2D is good for you, any modern browser will work, including those from mobile devices.


Chess. Play Chess with Jocly.[All Comments] [Add Comment or Rating]
📝Michel Gutierrez wrote on Thu, Apr 7, 2016 09:42 AM UTC:
Thanks Fergus.

Chris: to castle, click the king then the rook. It's uncommon (one generally clicks on the king's target square), but this method allows to solve castling ambiguities with some variants.

📝Michel Gutierrez wrote on Thu, Apr 7, 2016 10:43 PM UTC:
<p>Fergus,</p> <p>No, you cannot do that using the standard castling declaration, with an object with keys matching king-position/rook-position. Note that having twice the same key won't work by nature of the javascript language.</p> <p>However, you should have a look at the Jocly implementation of Wildebeest. This is (almost?) exactly the same case. It has been solved by defining a "normal" castle by declaration, and adding other castle possibilities "manually". You should be able to copy/paste from wildebeest-model.js lines 188 to 326.</p>

📝Michel Gutierrez wrote on Sat, Apr 9, 2016 11:03 PM UTC:
<p>Congratulations on your implementation !</p> <p>We have an API documentation of the model on the <a href="http://wiki.jocly.com/">Jocly wiki</a> but it's for the games in general. Unfortunately, we do not have something specific to the base chess implementation.</p> <p>I did not try this myself but i would see 2 different ways to solve the issue of having twice the same castle move defined (with my apologies if you trued that and it didn't work):</p> <p>1/ do not define the "normal" castling definition. You say when you leave it out there was no castling possible. Did you try to set "castle" as an empty object ( castle: {} ) or to just remove the "castle" key (the second might not work).</p> <p>2/ do not define, in the extra castle moves, the one that is already covered by the regular castle definition. That would certainly lead to (just focusing on white left castle):</p> <p><code> var extraCastle={ 0:{k:[2],r:[3]}, ... </code></p> <p>and</p> <p><code> Model.Game.wbExtraCastleRook={ 2:{r0:0,r:3}, ... </code></p>

📝Michel Gutierrez wrote on Sun, Apr 10, 2016 05:23 PM UTC:
<p>Ok, i can see in the code why disabling regular castle also prevents extra castle. In the extra castle move generation, we first search for a regular castle move (which ensures king and rook haven't moved and there are only empty squares between them) before generating extra castle moves. If no regular castle, there is no extra castle.<p> <p>Another approach would be to keep the regular + truncated extra method, but change the UI (by overwriting the view js file like you did for the model) to always highlight the king target square and not the rook in case of a castle. In your <code>grotesque-custom-view.js</code> file, copy function <code>View.Board.xdInput</code> from <code>base-view.js</code>, and replace the line:<p> <p><code>var target = move.cg===undefined?move.t:move.cg;</code></p> <p>by</p> <p><code>var target = move.t;</code></p> <p>This has reasonable chances to work.</p>

📝Michel Gutierrez wrote on Sun, Apr 10, 2016 10:59 PM UTC:
Excellent work !

📝Michel Gutierrez wrote on Mon, Apr 11, 2016 09:37 PM UTC:
Do you mean at <a href="http://play.chessvariants.com/jocly/grotesque.html">this page</a> for instance ? It works well for me.

📝Michel Gutierrez wrote on Mon, Apr 11, 2016 11:13 PM UTC:
Having a closer look, some pages work some don't.

My best guess is a jquery conflict between the version 1.10 you insert at the top of the page and version 1.6.2 that is inserted along with an ebay ad. I am not sure jquery.jocly.js would work with jquery 1.6.2.

📝Michel Gutierrez wrote on Thu, Apr 14, 2016 03:49 PM UTC:
<p>Fergus,</p> <p>I had a quick look at your Cavalier Chess implementation and i saw a problem which is likely to cause the issue you are experiencing.</p> <p>You define a piece type for white cavalier:</p> <p><code> pieceTypes: { 0: { name: 'cavalier-w', aspect: 'fr-knight', graph: Model.Game.cbHorseGraph(geometry), value: 2, abbrev: 'H', initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15},{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}], }, </code></p> <p>But you define initial position for both white and black, and you do the same for black cavalier. So basically there are 2 cavaliers at each 2nd second row, causing an exception in the code.</p> <p>I'm not sure about the Cavalier Chess rules but if the movements are the same for both sides, you should only have 1 piece type for the cavalier. If they don't have the same movement (like the regular pawns that go towards different directions), you must have 2 different piece types for black and white but ensure that the initial position is only defined for the corresponding side.</p> <p>Tip: when developing on Jocly, you should always have the browser console opened (F12) so that you can spot quickly when there is something wrong.</p>

📝Michel Gutierrez wrote on Fri, Apr 15, 2016 08:46 AM UTC:
Cavalier Chess looks very nice !

Just wondering, is it on purpose you set the knights and unicorns facing side instead of front ?

📝Michel Gutierrez wrote on Fri, Apr 15, 2016 04:49 PM UTC:
<p>Changing the board display shouldn't be too hard.</p> <p>Look at the customization of the Jocly implementation of courier chess. In file <code>courier-board-view.js</code>, you see an overwriting of the <code>colorFill</code> property. In a 3 colors board, you'll need to add a third symbol in addition to '.' and '#'. You'll also need to modify your existing <code>boardLayout</code> in <code>cavalier-custom-view.js</code> to place the cells as you wish using this third cell symbol.</p>

📝Michel Gutierrez wrote on Fri, Apr 15, 2016 05:11 PM UTC:
<p>Maybe i was not clear about where to do that in my previous comment. You should get something like:</p> <p><code> var orthoBoard3d = $.extend(true,{ 'colorFill' : { ".": "rgba(204,40,0,1)", "#": "rgba(180,180,0,1)", "%": "rgba(180,40,0,1)", }, },this.cbGridBoardClassic3DMargin,orthoBoardDelta); </code></p> <p>and a few lines below:</p> <p><code> boardLayout: [ ".#%.#%.#", "#%.#%.#%", "%.#%.#%.", ... </code></p>

📝Michel Gutierrez wrote on Fri, Apr 15, 2016 05:15 PM UTC:
<p>Giving it more thought, it should rather be:</p> <p><code> var orthoBoard3d = $.extend(true,{}, ,this.cbGridBoardClassic3DMargin,orthoBoardDelta,{ 'colorFill' : { ".": "rgba(204,40,0,1)", "#": "rgba(180,180,0,1)", "%": "rgba(180,40,0,1)", }}); </code> </p>

📝Michel Gutierrez wrote on Fri, Apr 15, 2016 10:09 PM UTC:
<p>Fergus,</p> <p>I just sent you by mail a version of <code>cavalier-custom-view.js</code> that implements the 3 colors board. I tested it successfully.</p> <p>Maybe the problem you were having was related to the cache. Since embedding Jocly works with an iframe, cache may act weirdly, particularly on Firefox. Chrome might work better for those developments. Or relaunching Firefox also works.</p>

📝Michel Gutierrez wrote on Fri, Apr 15, 2016 11:42 PM UTC:
<p>Because the mail has a javascript file in attachment, it may be filtered out by some malware trackers. Since the file is short, i copy it here.<p> <p><pre> (function() { View.Game.cbPromoSize = 1200; View.Game.cbDefineView = function() { var orthoBoardDelta = { // notationMode: 'in', // notationDebug: true, }; var threeColors = { 'colorFill' : { "+": "rgba(128,128,0,1)", // Added by Fergus Duniho ".": "rgba(189,183,107,1)", // "white" cells "#": "rgba(85,107,47,1)", // "black" cells } } var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta,threeColors); var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta,threeColors); return { coords: { "2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d), "3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d), }, boardLayout: [ ".#+.#+.#", "#+.#+.#+", "+.#+.#+.", ".#+.#+.#", "#+.#+.#+", "+.#+.#+.", ".#+.#+.#", "#+.#+.#+", ], board: { "2d": { draw: this.cbDrawBoardFn(orthoBoard2d), }, "3d": { display: this.cbDisplayBoardFn(orthoBoard3d), }, }, clicker: { "2d": { width: 1400, height: 1400, }, "3d": { scale: [.75,.75,.75], }, }, pieces: this.cbFairyPieceStyle({ "default": { "2d":{ width: 1300, height: 1300, }, "3d": { scale: [.5,.5,.5], }, }, "fr-knight": { "3d": { scale: [.4,.4,.4], rotate: 90, }, }, "fr-unicorn": { "3d" : { rotate: 90, }, }, }), }; } /* Make the knighted pieces jump when leaping */ View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) { var geometry = aGame.cbVar.geometry; var x0 = geometry.C(aMove.f); var x1 = geometry.C(aMove.t); var y0 = geometry.R(aMove.f); var y1 = geometry.R(aMove.t); if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0)) return (zFrom+zTo)/2; else return Math.max(zFrom,zTo)+1500; } })(); </pre></p>

📝Michel Gutierrez wrote on Sat, Apr 16, 2016 07:44 AM UTC:
Great !

In my opinion, you should differentiate a bit more the 2 3D dark colors. It took me 10 minutes to figure out why it was not working in 3D while it was, even using a high quality monitor.

📝Michel Gutierrez wrote on Sat, Apr 16, 2016 02:47 PM UTC:
In the view, just do something like <code>View.Game.cbTargetSelectColor = 0xff8800;</code>

📝Michel Gutierrez wrote on Mon, Apr 18, 2016 09:50 AM UTC:
<p>The documentation on the API is available on the <a href="http://wiki.jocly.com/index.php/Jocly_Basics">Wiki</a>.</p> <p>This being said, the documentation describes the general interface to put a game in Jocly, but your questions are more oriented towards the <i>chessbase</i> module implementation, which is one the 30 or 40 game modules available (but this is the biggest one in terms of code).</p> <p>We do not have a precise documentation on the <i>chessbase</i> module, most of it resides in the code and in the ~50 chess games that have been implemented. As you certainly found out, you can access all of the code from <a href="https://jocly.com/jocly/plazza/inspector">the jocly source code inspector</a>. You should have a close look at <code>base-model.js</code> which implements everything all the chess games have in common.</p> <p>To answer some of your questions:</p> <p>The <code>Move</code> object may have the following fields:</p> <ul> <li><code>f</code> the starting position of the piece</li> <li><code>t</code> the ending position</li> <li><code>c</code> the position of the piece being captured, if any</li> <li><code>pr</code> the piece type that is promoted to if any</li> <li><code>cg</code> the init position of the piece (other than the king) that is involved in a castle, if any</li> <li><code>ck</code> whether the move leads to a check</li> </ul> <p>The <code>Board</code> object have the following fields (not exhaustive):</p> <ul> <li><code>board</code> an array that maps positions to pieces</li> <li><code>pieces</code> an array containing all the pieces in the game</li> </ul> <p>Each element of the array <code>Board.pieces</code> implements the fields:</p> <ul> <li><code>s</code> the side of the piece, 1/-1 for white/black</li> <li><code>p</code> the position of the piece. If -1, the piece is not on the board (probably captured).</li> <li><code>t</code> the piece type</li> <li><code>i</code> a unique index for the piece</li> <li><code>m</code> whether that piece has already moved in the game</li> </ul> <p>It is very important that <code>Board.board</code> and <code>Board.pieces[xx].p</code> are always consistent. You can call <code>Board.cbIntegrity</code> during your development to ensure the whole board is consistent (remove it for production as it takes too much CPU). So you can add a piece by modifying both <code>Board.board</code> and <code>Board.pieces</code>.</p> <p>You can know whose turn it is from <code>Board.mWho</code> (1 or -1).</p> <p>You can know the last move from <code>Board.lastMove</code> but this is rarely used, like for instance to implement "en passant" capture.</p> <p>You can know a position is empty with <code>Board.board[pos]<0</code>.</p> <p>If you want to somehow remove some positions from the board, there are several approaches.<p> <ul> <li>You can overload GenerateMoves to remove from the legacy moves, the ones that end in a disabled position.</li> <li>You can define the piece move generation to "confine" to a number of acceptable positions.</li> </ul> <p>Have a look at the XiangQi implementation where some pieces are restrained to a part of the board.</p> <p>A few tips when you develop a game:</p> <ul> <li>do so in self vs self mode, otherwise the AI makes many calls that cannot really be controlled</li> <li>use the browser console and debugger. Adding instruction <code>debugger</code> in the code stops the execution and enters the debugger to examine the stack and data.</li> <li>do not lose faith, it always work in the end :)</li> </ul>

📝Michel Gutierrez wrote on Mon, Apr 18, 2016 01:57 PM UTC:
<p>By the way, we have implemented long ago a specific board geometry to play on a cube (in fact it's a NxMxP geometry where you can configure any of the 3 dimensions), but since we were lacking rules, no game has ever been released on this. As a consequence, the <a href="https://jocly.com/jocly/plazza/inspector#/">source inspector</a> does not offer the corresponding files (since you first select a game to access its source code). If anyone is interested in inventing rules, i can send the base source code.</p>

📝Michel Gutierrez wrote on Mon, Apr 18, 2016 09:52 PM UTC:
Carlos, thanks for the idea, those games look very interesting.

Unfortunately, we won't have time any more for implementing new games on our own for the foreseeable future. I hope we'll find chess variants enthusiasts developers to help there.

📝Michel Gutierrez wrote on Tue, Apr 19, 2016 04:35 PM UTC:
<p>The <code>Board.board[pos]</code> value is the index of the piece you will find in <code>Board.pieces</code>. For instance, if there is a piece at position <code>pos</code> (<code>board.board[pos] >= 0</code>), then <code>board.pieces[board.board[pos]].p</code> is always equal to <code>pos</code>.</p> <p>Regarding the promotion in Grand Chess, we indeed just verify there is a piece of the type that has been captured at some point. Whether we had promotions to that type is not considered. We should instead count the number of pieces in play for each type, and offer promotion to that type if this is not already the maximum. That should be easy to fix. Good catch !</p> <p>About <code>debugger;</code>, make sure the developer tools are open otherwise the instruction does not do anything.</p> <p>I'm afraid i cannot tell much about the three.js 3D generation, that was Jerome's area and he is currently busy with other stuff. I'll see with him if he can give some explanations.</p>

📝Michel Gutierrez wrote on Wed, Apr 20, 2016 12:50 AM UTC:
Very good, thanks !

📝Michel Gutierrez wrote on Fri, Apr 22, 2016 05:16 PM UTC:
<p>I'm not sure you are taking the right approach here.</p> <p>In Chess in general and in the Jocly implementation in particular, the king has a special status and has a lot of code associated to that status. Meaning, if your game defines the Queen has being the piece to checkmate, you should treat it as the King in the implementation. Believe me, you'll save yourself a lot of troubles.</p> <p><code>cbLongRangeGraph</code> is a function to calculate once for all (it's only done at the beginning of the game) a big array to store the general movement graph for each piece type. There is no way it takes into account dynamic situations like check.</p> <p>Functions are located in <code>Board</code> or <code>Game</code> for good reasons: they don't have the same visibility of the gaming situation and attempting to move a function from one class to another will almost always fail.</p> <p>When the page stays blank, this is generally a problem with the code syntax or top level execution. You should look at the console, there is a trace saying that <code>Board is undefined</code> somewhere.</p> <p>My recommandations:<p> <ul> <li>forget about the Queen from a programming point of view: this is definitely a King</li> <li>have a look at the XiangQi implementation, there is something about preventing Kings to face each other</li> </ul>

📝Michel Gutierrez wrote on Fri, Apr 22, 2016 11:34 PM UTC:
<p>Forget about <code>Model.Game.cbRoyalLongRangeGraph</code>, that's really not want you want to do. These <code>cb...RangeGraph</code> functions generate a static graph for a single piece on an empty board.</p> <p>The unusual move here is having the King (yeah, the Queen-dressed one) moving long range, but unable to pass through a check position.</p> <p>You should:</p> <ul> <li>define an empty graph for the king, so it does not make core-generated moves</li> <li>overwrite the <code>Board.GenerateMoves</code> function to <ol> <li>call the original <code>Board.GenerateMoves</code> to generate all (but King's) legacy moves</li> <li>add the King's moves manually</li> </ol> </li></ul> <p>To overwrite <code>Board.GenerateMoves</code>:</p> <p></p><pre>var SuperModelBoardGenerateMoves=Model.Board.GenerateMoves; Model.Board.GenerateMoves = function(aGame) { SuperModelBoardGenerateMoves.apply(this,arguments); // add extra moves with this.mMoves.push(...) } </pre><p></p> <p>To generate manually the king's moves, look at <code>base-model.js</code> function <code>Board.GeneratePseudoLegalMoves</code>, lines 798-850. This shows how to walk through the graph for long range movements, following <em>directions</em> (called <code>lines</code> here). This is where you can verify that each single position crossed is not in check (by calling <code>Board.cbGetAttackers</code>). If it is, just break out the loop to stop considering the line.</p> <p>Have a look at the Metamachy model file. The special castle implementation is not that far from what you want to achieve here.</p>

25 comments displayed

Earlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.