New engine release - Wukong JS

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
maksimKorzh
Posts: 724
Joined: Sat Sep 08, 2018 3:37 pm
Location: Ukraine
Full name: Maksim Korzh
Contact:

New engine release - Wukong JS

Post by maksimKorzh » Mon Dec 21, 2020 6:02 pm

Hi guys, for some reason my previous post wen silently,
so I've added these magic words: "new engine release" to attract the attention.

So here's the link: https://github.com/maksimKorzh/wukongJS
Play online: https://maksimkorzh.github.io/wukongJS/wukong.html

You can open developer tools and play around with API

Features:
- Javascript chess engine
- UCI (nodejs) and browser interfaces
- public API, so it can me embedded into sites or used as back-end library

Strength is around 1400 Elo
- material, PST eval, opening/endgame distinguishing for pawns, kings and rooks, no tapered eval though
- fully handcrafted PSTs (no copy paste, only my original weird ideas)
- very basic move ordering, so it goes no deeper than 5-6 plies within 1 second on my laptop

I just didn't yet work on search/eval/strength at all yet, it's just a placeholder.
I put the most effort into interfaces and API.

Nothing much to get feedback for regarding playing strength, but I'd like you to have a look at the
source code and give a feedback regarding architecture and interface interactions.

Thanks in advance!

P.S. UI is originally handcrafted as well - no third party libraries, even like bootstrap or jquery.

Pi4Chess
Posts: 253
Joined: Mon Nov 16, 2020 11:13 am
Full name: Manuel Rivera

Re: New engine release - Wukong JS

Post by Pi4Chess » Mon Dec 21, 2020 6:49 pm

Nice job !

A question : why your prefer going the javascript way rather than developping your UCI engine in C ?

User avatar
maksimKorzh
Posts: 724
Joined: Sat Sep 08, 2018 3:37 pm
Location: Ukraine
Full name: Maksim Korzh
Contact:

Re: New engine release - Wukong JS

Post by maksimKorzh » Mon Dec 21, 2020 8:32 pm

Pi4Chess wrote:
Mon Dec 21, 2020 6:49 pm
Nice job !

A question : why your prefer going the javascript way rather than developping your UCI engine in C ?
Thanks) first feedback)

I already have an engine in C: https://github.com/maksimKorzh/bbc
I've realized that I would never be smart enough to compete with strong engines - I'm just too dumb for that)
So i've tried something that can bring use for other people, so here're the reasons to consider javascript:
1. Easy to use, even non-programmers can run it in browser easily
2. Having two interfaces (UCI and Browser) but single code base.
3. Having same strength in browser and UCI mode (chrome is as fast as nodejs)
4. Providing possibility of reusing engine's features via API for custom purposes, e.g. one can make tactics solver or PGN viewer with it (API needs some work though)
5. Javascript makes it easier to work with dynamic memory - I can manipulate the move stack by saying arr.push() and arr.pop()
6. In future things like PGN parsing or converting PGN to set of FENs or string manipulations are much easier in javascript

In simple words all the reasons why you would consider high level language over low level.
The only issue of JS is performance obviously, but without a need to compete with strong engines
I just set a goal of RELATIVE improvements - make search searching several plies deeper, relative elo gains after experiments with eval.
Also when I saw strong JS engines (2500+) like tomitank I've realized that even in JS it takes ages to get to 2500 for me)

I was making lot's of didactic materials, now I just want to go deeper and understand techniques better, enjoy the development process
and not being much bothered with the end result. Just a small explanation - I made 95 video series in how to make a bitboard chess engine
in C and then copypasted SF NNUE and got 2937 ELO - but that's not my achievement. Now I'm not looking for high Elos anymore but
rather for working out existing search optimization techniques. Also maybe I'll master Texel's or similar tuning one day)

op12no2
Posts: 404
Joined: Tue Feb 04, 2014 11:25 am
Location: Wales
Full name: Colin Jenkins
Contact:

Re: New engine release - Wukong JS

Post by op12no2 » Mon Dec 21, 2020 8:47 pm

Hi Maksim,

Very nice. I agree with your reasons. My thinking was very similar.

User avatar
maksimKorzh
Posts: 724
Joined: Sat Sep 08, 2018 3:37 pm
Location: Ukraine
Full name: Maksim Korzh
Contact:

Re: New engine release - Wukong JS

Post by maksimKorzh » Mon Dec 21, 2020 8:51 pm

op12no2 wrote:
Mon Dec 21, 2020 8:47 pm
Hi Maksim,

Very nice. I agree with your reasons. My thinking was very similar.
Thanks you, do you have somewhat a similar project to share? I'd love to have a look!

op12no2
Posts: 404
Joined: Tue Feb 04, 2014 11:25 am
Location: Wales
Full name: Colin Jenkins
Contact:

Re: New engine release - Wukong JS

Post by op12no2 » Mon Dec 21, 2020 9:34 pm

maksimKorzh wrote:
Mon Dec 21, 2020 8:51 pm

Thanks you, do you have somewhat a similar project to share? I'd love to have a look!
Yes and I have found javascript a lot of fun as you suggest.

https://github.com/op12no2/lozza
https://github.com/op12no2/lozza-ui

You may also be interested in Tamás Kuzmics's Tomitank https://github.com/tomitank/tomitankChess which is bitboard based now and a lot stronger than Lozza.

User avatar
maksimKorzh
Posts: 724
Joined: Sat Sep 08, 2018 3:37 pm
Location: Ukraine
Full name: Maksim Korzh
Contact:

Re: New engine release - Wukong JS

Post by maksimKorzh » Mon Dec 21, 2020 10:38 pm

op12no2 wrote:
Mon Dec 21, 2020 9:34 pm
maksimKorzh wrote:
Mon Dec 21, 2020 8:51 pm

Thanks you, do you have somewhat a similar project to share? I'd love to have a look!
Yes and I have found javascript a lot of fun as you suggest.

https://github.com/op12no2/lozza
https://github.com/op12no2/lozza-ui

You may also be interested in Tamás Kuzmics's Tomitank https://github.com/tomitank/tomitankChess which is bitboard based now and a lot stronger than Lozza.
You're lozza author?? Wow! I love lozza! And of course I'm aware of that) Also aware of tomitank - amazing JS engine.

op12no2
Posts: 404
Joined: Tue Feb 04, 2014 11:25 am
Location: Wales
Full name: Colin Jenkins
Contact:

Re: New engine release - Wukong JS

Post by op12no2 » Tue Dec 22, 2020 9:15 am

maksimKorzh wrote:
Mon Dec 21, 2020 10:38 pm
You're lozza author?? Wow! I love lozza! And of course I'm aware of that) Also aware of tomitank - amazing JS engine.
Yes, cheers :) She has not had much love recently but today I suddenly found some interest again - weird how that works.

User avatar
maksimKorzh
Posts: 724
Joined: Sat Sep 08, 2018 3:37 pm
Location: Ukraine
Full name: Maksim Korzh
Contact:

Re: New engine release - Wukong JS

Post by maksimKorzh » Tue Dec 22, 2020 11:58 am

op12no2 wrote:
Tue Dec 22, 2020 9:15 am
maksimKorzh wrote:
Mon Dec 21, 2020 10:38 pm
You're lozza author?? Wow! I love lozza! And of course I'm aware of that) Also aware of tomitank - amazing JS engine.
Yes, cheers :) She has not had much love recently but today I suddenly found some interest again - weird how that works.
I've been dropping chess programming 'forever' countless number of times but than returned every time) so it's really cool that your interest has come back. Btw I was using bootstrap/jquery/chessboardjs libs before (for my bbc engine) but this time found lots of fun creating chess board view completely from scratch.

So how are you planning to improve lozza?

User avatar
mvanthoor
Posts: 1283
Joined: Wed Jul 03, 2019 2:42 pm
Location: Netherlands
Full name: Marcel Vanthoor
Contact:

Re: New engine release - Wukong JS

Post by mvanthoor » Tue Dec 22, 2020 12:17 pm

maksimKorzh wrote:
Mon Dec 21, 2020 8:32 pm
Pi4Chess wrote:
Mon Dec 21, 2020 6:49 pm
Nice job !

A question : why your prefer going the javascript way rather than developping your UCI engine in C ?
Thanks) first feedback)

I already have an engine in C: https://github.com/maksimKorzh/bbc
I've realized that I would never be smart enough to compete with strong engines - I'm just too dumb for that)
So i've tried something that can bring use for other people, so here're the reasons to consider javascript:
1. Easy to use, even non-programmers can run it in browser easily
2. Having two interfaces (UCI and Browser) but single code base.
3. Having same strength in browser and UCI mode (chrome is as fast as nodejs)
4. Providing possibility of reusing engine's features via API for custom purposes, e.g. one can make tactics solver or PGN viewer with it (API needs some work though)
5. Javascript makes it easier to work with dynamic memory - I can manipulate the move stack by saying arr.push() and arr.pop()
6. In future things like PGN parsing or converting PGN to set of FENs or string manipulations are much easier in javascript

In simple words all the reasons why you would consider high level language over low level.
The only issue of JS is performance obviously, but without a need to compete with strong engines
I just set a goal of RELATIVE improvements - make search searching several plies deeper, relative elo gains after experiments with eval.
Also when I saw strong JS engines (2500+) like tomitank I've realized that even in JS it takes ages to get to 2500 for me)

I was making lot's of didactic materials, now I just want to go deeper and understand techniques better, enjoy the development process
and not being much bothered with the end result. Just a small explanation - I made 95 video series in how to make a bitboard chess engine
in C and then copypasted SF NNUE and got 2937 ELO - but that's not my achievement. Now I'm not looking for high Elos anymore but
rather for working out existing search optimization techniques. Also maybe I'll master Texel's or similar tuning one day)
Cool :) If you enjoy developing an engine in Javascript more than in C, then you should use Javascript. If possible, I'd actually recommend TypeScript, because it basically is "JavaScript with types"; it makes writing complex programs less error-prone.

There are many goals you could set:

- Strength over everything: Some people want to write the strongest engine they can, and use the fastest programming language and any trick in the book to speed up the code, maintainability and readability be damned.

- Future-proof / maintainable, and still being as fast as C without using C: that is my goal, and therefore I use Rust. I intend to write this engine for the long haul. (I intend for this engine to still exist in another 25 years, as it is also going to become my own sparring partner, using a Level function.) Therefore I try to make the code as perfect, readable, and maintainable as possible, and at the same time, as fast as I can with my current knowledge. Then I can surmise that, if another engine is stronger, it has more features for move generation, search and evaluation.

- Choose the language you like best without regard to performance, and then see how far you can take the engine in that language. Java is often derided, but it is possible to write a strong chess engine in it. See CuckooChess ( https://en.wikipedia.org/wiki/CuckooChess ), written by Peter Österlund; the same author as Texel, and the inventor of Texel Tuning. CuckooChess is around 2600 ELO. (I don't know how far developed it is with regard to features. Maybe it could have been even stronger.)

It would be cool if you'd be able to write a 2400+ ELO chess engine in Javascript. That would prove that, at least up to ~2400 ELO, the programming language hardly matters.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL

Post Reply