New engine release - Wukong JS

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

Moderators: hgm, Rebel, chrisw

op12no2
Posts: 490
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: New engine release - Wukong JS

Post by op12no2 »

maksimKorzh wrote: Tue Dec 22, 2020 12:58 pm
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?
Not just me then :)

I think I may actually make her worse from an ELO point of view but better from a cognitive point of view (for me). The eval is from Fruit 2.1. I think I'd prefer to have my own ideas in eval so that she is unique and 'quirky' - even if lower ELO. It's hard to explain but the eval makes me feel 'untidy'...
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: New engine release - Wukong JS

Post by mvanthoor »

maksimKorzh wrote: Tue Dec 22, 2020 12:58 pm 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.
Why would you ever "drop" chess programming now that you have an engine?

I have many hobbies. In no particular order:

- Chess playing
- Chess programming
- Reading books
- Playing the piano
- Digital photography
- Playing RPG's and (old) adventures on the computer

I shift from one hobby to the next; sometimes one hobby is on the back burner for a year while another takes precedence.

I've always wanted to have my own chess engine, and now I have one. I intend to finish the XBoard protocol implementation in my Christmas vacation. (I haven't had much time to work on the engine the last few weeks.) After that, in 2021, I'll start writing the book/tutorial, and slowly improve the engine. Next to this, I also intend to update PicoChess to newer libraries where possible, start writing my own user interface, and try and lift the DGT-communication from Picochess and port it to Rust, so I can at some point rewrite a Picochess-like service in Rust.

All of that will take many years, but that's no problem. My day job is writing business software. I've often wanted to "program something" but never knew what this would be. For me, this has become chess programming. Later, this could turn into chess variant programming, Go programming, Shogi programming... whatever. I'll see. For me, it's just one of my hobbies now, and if I feel like "writing some code", I'll have a few projects to work on... just as a I have a thousand e-books lined up for when I feel like "I want to read something".
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: New engine release - Wukong JS

Post by maksimKorzh »

mvanthoor wrote: Tue Dec 22, 2020 1:17 pm
maksimKorzh wrote: Mon Dec 21, 2020 9:32 pm
Pi4Chess wrote: Mon Dec 21, 2020 7: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.
Well, actually tomitankChess is 2800+ and uses bitboards and lozza is 2400+ so writing at least 2400+ engine in javascript is possible.
And secondly - yes, this time it's not a tutorial series or something but really a project for a long-term improvements. Also assuming API and interfaces I will have lots of things to do apart from improving strength and speed) E.g. I want to make it easily embedded into third-party websites (now it's possible but not yet that trivial how I would like it to be)
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: New engine release - Wukong JS

Post by maksimKorzh »

op12no2 wrote: Tue Dec 22, 2020 1:19 pm
maksimKorzh wrote: Tue Dec 22, 2020 12:58 pm
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?
Not just me then :)

I think I may actually make her worse from an ELO point of view but better from a cognitive point of view (for me). The eval is from Fruit 2.1. I think I'd prefer to have my own ideas in eval so that she is unique and 'quirky' - even if lower ELO. It's hard to explain but the eval makes me feel 'untidy'...
Not just you! I've realized that we drop thing every time when the initial goal is satisfied, it's a result driven approach - we either succeed and drop or fail and drop. But I believe chess programming is good for PROCESS driven approach when your main goal is not to do something with engine but rather to do something with your own understanding. In this case you're right - engine would be dropping Elo points but it would become more and more YOURS.
It's rather easy to come up with 2500 engine if you understand basic search optimizations techniques good enough to steel them from strong engines but that doesn't satisfy in terms "I did it" for it's more like "I stole that".

So I totally understand your feelings about eval - I felt the same after copypasting SF NNUE into BBC - it works like a charm, but it's not mine at all, so now I'm doing literally the same - using my own handcrafted PSTs which are worse from Elo perspective compared to say PESTOs' PST that I used before NNUE (they were Texel tuned...) and generally I set a goal NOT to cheat by reusing someone else's code. Well on the other hand, let's say regarding PV move ordering - I tried some ideas before but they didn't work properly so one of my latest improvements was to flag the search if PV move of certain depth matches current move in move list then order it first. It turned out that it's exactly the way how it's done in TSCP! And before this insight I didn't understand why the hack TSCP collects PV in quiescence - but then I've suddenly realized - for PV move sorting purposes! So at the moment one might say that I've stolen PV move ordering from TSCP but on the real deal I came up with that implementation on my own believe it or not! And same thing should be done with all the other techniques. Now for instance I'm rediscovering null move pruning. So it's kinda like the matter of improving your own understanding/skills rather than an engine.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: New engine release - Wukong JS

Post by maksimKorzh »

mvanthoor wrote: Tue Dec 22, 2020 1:32 pm
maksimKorzh wrote: Tue Dec 22, 2020 12:58 pm 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.
Why would you ever "drop" chess programming now that you have an engine?

I have many hobbies. In no particular order:

- Chess playing
- Chess programming
- Reading books
- Playing the piano
- Digital photography
- Playing RPG's and (old) adventures on the computer

I shift from one hobby to the next; sometimes one hobby is on the back burner for a year while another takes precedence.

I've always wanted to have my own chess engine, and now I have one. I intend to finish the XBoard protocol implementation in my Christmas vacation. (I haven't had much time to work on the engine the last few weeks.) After that, in 2021, I'll start writing the book/tutorial, and slowly improve the engine. Next to this, I also intend to update PicoChess to newer libraries where possible, start writing my own user interface, and try and lift the DGT-communication from Picochess and port it to Rust, so I can at some point rewrite a Picochess-like service in Rust.

All of that will take many years, but that's no problem. My day job is writing business software. I've often wanted to "program something" but never knew what this would be. For me, this has become chess programming. Later, this could turn into chess variant programming, Go programming, Shogi programming... whatever. I'll see. For me, it's just one of my hobbies now, and if I feel like "writing some code", I'll have a few projects to work on... just as a I have a thousand e-books lined up for when I feel like "I want to read something".
That regards to the past - when I was so stupid that couldn't even implement Zobrist hashing for repetition detection)
For me chess programming is not the hobby - it's a challenge to fight my stupidity)
This is a very subjective stuff that can't be evaluated objectively but it means a lot to me.
The matter of dropping is the matter of admitting that stupidity is stronger than you)
But later on you're coming up with new powers and pushing your understanding one inch further.
Remember - I'm code monkey, hence becoming a "human" programmer is a good achievement to me)
And being a code monkey is not the matter of understanding best practices and following them, not the matter of how you write code -
your code might look professionally you might be getting paid very well for your code (like my case in web scraping) but this doesn't
change the fact that you're (me) just a code monkey.

The difference between human coder and code monkey IMO is the matter of consciousness - human coder first understands and then codes,
Code monkey first codes and then not obviously understands (despite the fact that code may work well even without being copypasted)
I can'ts change the fact of coding first and understanding next because it's my deep nature (see my new avatar on talkchess and github)
But what I can do is to UNDERSTAND what I code.

Understanding what I code is one of the implicit but very important goals of Wukong JS.
Btw Song Wukong, the character who gave a name to my engine, is an old Chinese... let's say super hero with super powers -
He can fly in the space without a suit like captain Marvel, hei's bullet proof (e.g. impossible to chop his head with a sword) etc.
So he can do TONS of things of fantastic power (can achieve whatever result in this world) but his consciousness is just at the level of monkey.
He can use his superpowers but he doesn't understand them.
If you don't understand something it can be taken away from you like it happened to Song Wukong (imprisoned under the mountain for 500 years)

Same with chess programming - if you're using superpower from SF it works but it's just not yours.
So I would rather consider 1800 Elo piece of crap engine but that I clearly understand how it works rather than copypasting snippets from CPW and having it much stronger.
I was doing that copypasting before for my youtube channel purposes, just to promote the channel.
E.g. for non-programmers 2900 chess engine created online despite the fact that 600 Elo points are coming from SF NNUE black box (many don't even understand it!) is impressive, hence worse following.
But only around 1800 Elo of those 2900 Elo are truly mine - the rest of Elo points belong to the sources I've used.

And this time Wukong JS is not a tutorial series (I do highlight some project progress, but that's different) - it's a completely personal project.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: New engine release - Wukong JS

Post by mvanthoor »

maksimKorzh wrote: Tue Dec 22, 2020 3:13 pm That regards to the past - when I was so stupid that couldn't even implement Zobrist hashing for repetition detection)
For me chess programming is not the hobby - it's a challenge to fight my stupidity)

... code monkey ...
In my opinion, you should stop referring to yourself as "stupid" and "code monkey".

Nothing in my engine is original at this point; it uses magic bitboards and alpha/beta search. I studied many writings and watched Bluefever's video's (and some of yours), and I read countless tutorials and watched video's about Rust to be able to write my chess engine as it is now.

You undoubtedly did similar things to be able to write your engine. That's not being stupid: that's called studying.

Before I started writing Rustic...
- I didn't know Rust. Nothing.
- Never used multi-threading in any language on a PC (only in micro-controllers and PLC's)
- My understanding of alpha/beta was very sketchy, because the first and only time I implemented it was during an Algorithms course in university... almost 20 (!) years ago.
- I knew about bitboards, but NOTHING about magic bitboards.

Does that make me stupid? No... but I did lack a huge amount of knowledge to be able to write a chess engine.

I'm sure the same thing is true for you: you lack knowledge. That doesn't make you stupid.

A few area's I still have big gaps in my knowledge:
- Neural networks (only understand the general principles; never implemented one)
- Texel tuning (know nothing about it)
- Many search optimizations (only general knowledge; never implemented them yet)
- User interface design / front-end coding (stuff like the Electron framework in combination with something like React)
- Python (I do my best to keep lacking knowledge. I refuse to admit this language exists.)
- Rust Macro's, and many other parts of the Rust language that I have not yet needed or used.

I will learn what I need to know in due time; as you will as well.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: New engine release - Wukong JS

Post by maksimKorzh »

mvanthoor wrote: Tue Dec 22, 2020 5:02 pm
maksimKorzh wrote: Tue Dec 22, 2020 3:13 pm That regards to the past - when I was so stupid that couldn't even implement Zobrist hashing for repetition detection)
For me chess programming is not the hobby - it's a challenge to fight my stupidity)

... code monkey ...
In my opinion, you should stop referring to yourself as "stupid" and "code monkey".

Nothing in my engine is original at this point; it uses magic bitboards and alpha/beta search. I studied many writings and watched Bluefever's video's (and some of yours), and I read countless tutorials and watched video's about Rust to be able to write my chess engine as it is now.

You undoubtedly did similar things to be able to write your engine. That's not being stupid: that's called studying.

Before I started writing Rustic...
- I didn't know Rust. Nothing.
- Never used multi-threading in any language on a PC (only in micro-controllers and PLC's)
- My understanding of alpha/beta was very sketchy, because the first and only time I implemented it was during an Algorithms course in university... almost 20 (!) years ago.
- I knew about bitboards, but NOTHING about magic bitboards.

Does that make me stupid? No... but I did lack a huge amount of knowledge to be able to write a chess engine.

I'm sure the same thing is true for you: you lack knowledge. That doesn't make you stupid.

A few area's I still have big gaps in my knowledge:
- Neural networks (only understand the general principles; never implemented one)
- Texel tuning (know nothing about it)
- Many search optimizations (only general knowledge; never implemented them yet)
- User interface design / front-end coding (stuff like the Electron framework in combination with something like React)
- Python (I do my best to keep lacking knowledge. I refuse to admit this language exists.)
- Rust Macro's, and many other parts of the Rust language that I have not yet needed or used.

I will learn what I need to know in due time; as you will as well.
Marcel, you're taking my words too close)
Referring myself as code monkey is how I personally feel it, trust me - I don't lie.
It's the matter of objective comparison with others.

For me being the code monkey is the matter of the state of my consciousness, nothing else)
But if you want some comparison - I'll give it - let's take minic by Vivien (forgot how to spell to his last name).
The guy started from Weini which was around 2200 Elo

https://www.computerchess.org.uk/ccrl/4 ... _24_64-bit

And than he started minic as single file minimalist bitboard chess engine.
And the progress he made is fantastic - minic 2.33 is 3100+ Elo

https://www.computerchess.org.uk/ccrl/4 ... 4-bit_4CPU

I believe his last version 3 would be even stronger. And if I could understand at least something in minic 1, the current version splitted into many files is
the same as to read SF's code - complete rocket science. And NNUE - he has trained his own net and is going to change NN's implementation to make it different from SF (read somewhere here, might be wrong though).

Now that's the example of being smart and definitely not a code monkey. Viven's example always reminds me who I am and where is my deserved place). I just like to compare myself with much better programmers than I am and consider myself to be noob compared to their skills instead of comparing myself to beginners or non-programmers who can't write a chess engine.

P.S. How do you like my new avatar? It's a part of Wukong's newly created logo)
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: New engine release - Wukong JS

Post by maksimKorzh »

A little gift from Code Monkey King for the New Year (marry Christmas to all of you guys as well - in my country Christmas is only about to come)
So I've made an intermediate release of WukongJS:
- added search very basic implementation of search optimization techniques: NMP, LMR, PVS, etc (now hits depth 7-8 in blitz without TT)
- switched to simplified evaluation (works better than weird crap I took from my head before)
- improved UI

Short video overview:


Source code:
https://github.com/maksimKorzh/wukongJS

New improved UI:
https://maksimkorzh.github.io/wukongJS/wukong.html
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: New engine release - Wukong JS

Post by maksimKorzh »

Version 1.2 has been released:
https://github.com/maksimKorzh/wukongJS

Happy new year to everyone!
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: New engine release - Wukong JS

Post by Gabor Szots »

mvanthoor wrote: Tue Dec 22, 2020 5:02 pm In my opinion, you should stop referring to yourself as "stupid" and "code monkey".
I agree.
Gabor Szots
CCRL testing group