Engine In Javascript

Code, algorithms, languages, construction...
bluefever
Posts: 22
Joined: Wed Jul 10, 2013 8:23 am

Re: Engine In Javascript

Post by bluefever »

pgn4web wrote:Tried to play some other game at 10s per move, but in every game I sooner or later get to the point where the UI does not display a move from the engine anymore. However, if after a short while I hit the takeback button, a completely different position is shown. It looks as if at some point the UI stops updating the chessboard and the engine plays itself quickly.
I dont have an example because I could not reproduce the error systematically just by loading a given position, some historical preconditions seem required to trigger the fault.
Hi,

That's seems really odd. I'm playing cosntantly through 10s games at the moment to try and get the error, been going for 30mins now, not had it yet :roll:
bluefever
Posts: 22
Joined: Wed Jul 10, 2013 8:23 am

Re: Engine In Javascript

Post by bluefever »

pgn4web wrote:Tried to play some other game at 10s per move, but in every game I sooner or later get to the point where the UI does not display a move from the engine anymore. However, if after a short while I hit the takeback button, a completely different position is shown. It looks as if at some point the UI stops updating the chessboard and the engine plays itself quickly.
I dont have an example because I could not reproduce the error systematically just by loading a given position, some historical preconditions seem required to trigger the fault.
Found it :) (I hope)

It happens when the engine gets near positions with no pawns.

Should be fixed now!

Thanks again
glinscott
Posts: 8
Joined: Mon Jun 14, 2010 6:12 pm
Real Name: Gary Linscott

Re: Engine In Javascript

Post by glinscott »

Awesome job! Great to see another strong JS engine on the scene :).

I played them against each other at 2s a move, and Garbochess (http://forwardcoding.com/projects/ajaxchess/chess.html) barely prevailed, although it was a toss-up in the midgame for quite a while. My guess is that they are quite close in strength.

bluefever
Posts: 22
Joined: Wed Jul 10, 2013 8:23 am

Re: Engine In Javascript

Post by bluefever »

glinscott wrote:Awesome job! Great to see another strong JS engine on the scene :).

I played them against each other at 2s a move, and Garbochess (http://forwardcoding.com/projects/ajaxchess/chess.html) barely prevailed, although it was a toss-up in the midgame for quite a while. My guess is that they are quite close in strength.
Wow, your interface has a lot more features :)

I only did the GUI as a quick hack on top of the engine for the YouTube video series. Since then I've been adding features - I've grown quite fond of the project, it was my first JS program.

I MUST add the actual fen live you have, that is essential. ANd you even have the algebraic move notation. Argh!! :)

I think your engine is stronger though :)

Btw, I had a torrid time getting it to work in IE 9 and older. No const, no console, no typed Arrays..... terrible.
bluefever
Posts: 22
Joined: Wed Jul 10, 2013 8:23 am

Re: Engine In Javascript

Post by bluefever »

On thing I meant to ask, as I'm new to JS - do you have any tips on not blocking the GUI when the engine is thinking? I notice Garbochess does not. I couldn't find much info on doing this, apart from a webworker, which didn't seem right.

Thanks!
bluefever
Posts: 22
Joined: Wed Jul 10, 2013 8:23 am

Re: Engine In Javascript

Post by bluefever »

I found a small bug in GarboChess, nothing to do with the playing, but the UI. If I undo moves, it doesn't remove them from the movelist, and adds the new moves on 8-)

It's a great App, though. I added the "current FEN" also today :)
glinscott
Posts: 8
Joined: Mon Jun 14, 2010 6:12 pm
Real Name: Gary Linscott

Re: Engine In Javascript

Post by glinscott »

Yeah, sadly, webworkers are the only way to go really. You can also process the search in chunks, but that basically requires writing an iterative search, which is not as fun.
bluefever
Posts: 22
Joined: Wed Jul 10, 2013 8:23 am

Re: Engine In Javascript

Post by bluefever »

glinscott wrote:Yeah, sadly, webworkers are the only way to go really. You can also process the search in chunks, but that basically requires writing an iterative search, which is not as fun.
Yes, the search in chunks would be a PITA to program.

According to caniuse.com, IE 9 and older do not support webworkers, though :(

Thanks for the answer, I'll have a look into it today
Post Reply