Check out Grant Acedrex, our featured variant for April, 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

Chess. Play Chess with Jocly.[All Comments] [Add Comment or Rating]
📝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>