I wrote a simple engine written in JavaScript, powering a demo page for Paco Shako ('Peace Chess'). It is intended to give Chess players who have never seen this game before an impression of how it is played.
I posted the page at http://hgm.nubati.net/paco .
Feedback is welcome!
JavaScript Peace-Chess engine
Moderators: hgm, Rebel, chrisw
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
JavaScript Peace-Chess engine
Last edited by hgm on Thu Sep 28, 2017 8:46 am, edited 2 times in total.
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: JavaScript Piece-Chess engine
Nice!
A presentation bug after e4 Nf6 e5 d5 ef6 e5:
A presentation bug after e4 Nf6 e5 d5 ef6 e5:
Daniel José - http://www.andscacs.com
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: JavaScript Piece-Chess engine
Wasn't the name of this game "Peace Chess"?hgm wrote:I wrote a simple engine written in JavaScript, powering a demo page for Paco Shako ('Piece Chess'). It is intended to give Chess players who have never seen this game before an impression of how it is played.
I posted the page at http://hgm.nubati.net/paco .
Feedback is welcome!
But anyway: thanks for the engine! I lost all games against it so far, as expected.
-
- Posts: 188
- Joined: Sun Dec 25, 2016 4:59 pm
Re: JavaScript Piece-Chess engine
I find this variant rather intriguing.
Tactics are pretty interesting. I've managed 1/3 so far, but I've spent a lot more time than the engine has
For now it doesn't seem like the game actually ends when you form a union with the king (i.e., you get to keep making moves even though the game is done); is that known/expected?
I haven't been able to reproduce these next reliably yet, but the very first game I played it was letting me move a pawn backwards after a union on the 6th or 7th rank.
I've also had it where it gives me the option to move non-unioned opposing pieces; in those cases the engine stopped moving altogether and let me make unlimited moves with its pieces:
https://ibb.co/b8ua8k
https://ibb.co/dX6Nok
Thanks for the engine! I had tried the puzzles at the pacosaco site and was curious for some more exercises, so this scratches that itch nicely
Tactics are pretty interesting. I've managed 1/3 so far, but I've spent a lot more time than the engine has
For now it doesn't seem like the game actually ends when you form a union with the king (i.e., you get to keep making moves even though the game is done); is that known/expected?
I haven't been able to reproduce these next reliably yet, but the very first game I played it was letting me move a pawn backwards after a union on the 6th or 7th rank.
I've also had it where it gives me the option to move non-unioned opposing pieces; in those cases the engine stopped moving altogether and let me make unlimited moves with its pieces:
https://ibb.co/b8ua8k
https://ibb.co/dX6Nok
Thanks for the engine! I had tried the puzzles at the pacosaco site and was curious for some more exercises, so this scratches that itch nicely
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: JavaScript Piece-Chess engine
Oops! I corrected that now, thx.Sven wrote:Wasn't the name of this game "Peace Chess"?
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: JavaScript Piece-Chess engine
Well, if you hug the King of the color the computer is playing, it should prirint "XXX wins" above the board. If the computer hugs your king, it would only report it when you make another move. I guess I should test for the mate score, and already print the message then. (But I was not yet completely sure the score would always be correct.)MonteCarlo wrote:For now it doesn't seem like the game actually ends when you form a union with the king (i.e., you get to keep making moves even though the game is done); is that known/expected?
This was probably a very temporary thing, because I was messing with the GUI script. When I first opened this thread, the GUI did not generate move highlights for the unions at all, and I though I could still quickly slip that in. But I made an error in the side-to-move detection, which took me a few minutes to correct.I haven't been able to reproduce these next reliably yet, but the very first game I played it was letting me move a pawn backwards after a union on the 6th or 7th rank.
The GUI allows you to cheat without limit. It does not enforce pseudo-legality of the moves, and not even turn order. It was derived from a fairy-diagram generator that was always in setup mode. So it had no concept of a turn, which was also useful for games that allowed double moves.I've also had it where it gives me the option to move non-unioned opposing pieces; in those cases the engine stopped moving altogether and let me make unlimited moves with its pieces:
But that made it somewhat difficult to know the the engine should move. I used the rule that a move with a piece of one color would imply the other color would then be on move. If the move did not release anything. But when a union is moved, you don't know to which side it belongs. So in that case, I just toggle the side.
So if the computer is set to play black, and you move a black piece, it thinks it is now white's turn, and so it would not move. It should oly move in reply to moving of white pieces or unions when it plays black.
Perhaps I should enforce turn order and pseudo-legality. But then you canot easily set up problems. And if there is a setup mode, people could switch to it to cheat. So I figured: "why just not leave it in setup mode all the time?".
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: JavaScript Piece-Chess engine
I confused the name. Now I understoodcdani wrote:Nice!
A presentation bug after e4 Nf6 e5 d5 ef6 e5:
Daniel José - http://www.andscacs.com
-
- Posts: 188
- Joined: Sun Dec 25, 2016 4:59 pm
Re: JavaScript Piece-Chess engine
Ah, that makes sense. Thanks!hgm wrote:Well, if you hug the King of the color the computer is playing, it should prirint "XXX wins" above the board. If the computer hugs your king, it would only report it when you make another move. I guess I should test for the mate score, and already print the message then. (But I was not yet completely sure the score would always be correct.)MonteCarlo wrote:For now it doesn't seem like the game actually ends when you form a union with the king (i.e., you get to keep making moves even though the game is done); is that known/expected?
This was probably a very temporary thing, because I was messing with the GUI script. When I first opened this thread, the GUI did not generate move highlights for the unions at all, and I though I could still quickly slip that in. But I made an error in the side-to-move detection, which took me a few minutes to correct.I haven't been able to reproduce these next reliably yet, but the very first game I played it was letting me move a pawn backwards after a union on the 6th or 7th rank.
The GUI allows you to cheat without limit. It does not enforce pseudo-legality of the moves, and not even turn order. It was derived from a fairy-diagram generator that was always in setup mode. So it had no concept of a turn, which was also useful for games that allowed double moves.I've also had it where it gives me the option to move non-unioned opposing pieces; in those cases the engine stopped moving altogether and let me make unlimited moves with its pieces:
But that made it somewhat difficult to know the the engine should move. I used the rule that a move with a piece of one color would imply the other color would then be on move. If the move did not release anything. But when a union is moved, you don't know to which side it belongs. So in that case, I just toggle the side.
So if the computer is set to play black, and you move a black piece, it thinks it is now white's turn, and so it would not move. It should oly move in reply to moving of white pieces or unions when it plays black.
Perhaps I should enforce turn order and pseudo-legality. But then you canot easily set up problems. And if there is a setup mode, people could switch to it to cheat. So I figured: "why just not leave it in setup mode all the time?".
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller