Neural networks in chess programming

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

Moderator: Ras

User avatar
AdminX
Posts: 6363
Joined: Mon Mar 13, 2006 2:34 pm
Location: Acworth, GA

Neural networks in chess programming

Post by AdminX »

I think some here might find this a interesting read.
Roger Lorenz wrote:
Alpha Zero has revolutionised chess programming. The programme taught itself chess by playing against itself and storing its training knowledge in a neural network. All programmes have followed suit with this technique. Roger Lorenz uses a simple example to show how neural networks work and how they can be trained.
https://en.chessbase.com/post/neural-ne ... rogramming
"Good decisions come from experience, and experience comes from bad decisions."
__________________________________________________________________
Ted Summers
User avatar
towforce
Posts: 12661
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK
Full name: Graham Laight

Re: Neural networks in chess programming

Post by towforce »

Thank you. I took something of value from that article which should have been obvious, but which I hadn't realised: there are ready made chess libraries to do standard things like generating lists of legal moves. This is good news for anyone who wants to write a chess program: use one of these libraries, and you're already on your way!
Human chess is partly about tactics and strategy, but mostly about memory
User avatar
hgm
Posts: 28418
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Neural networks in chess programming

Post by hgm »

Yes, isn't it nice that you can simply download all components. Developing your own chess engine is really sped up by the fact that you don't have to write any code yourself.
chrisw
Posts: 4733
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Neural networks in chess programming

Post by chrisw »

hgm wrote: Thu Apr 04, 2024 6:18 pm Yes, isn't it nice that you can simply download all components. Developing your own chess engine is really sped up by the fact that you don't have to write any code yourself.
Yup, 6th form school kid project, be a "top engine programmer" in a few weeks.
User avatar
towforce
Posts: 12661
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK
Full name: Graham Laight

Re: Neural networks in chess programming

Post by towforce »

hgm wrote: Thu Apr 04, 2024 6:18 pm Yes, isn't it nice that you can simply download all components. Developing your own chess engine is really sped up by the fact that you don't have to write any code yourself.

:lol:

In the time of 8-bit CPUs and dedicated chess computers, some developers would have been obliged to use assembly language. With the advancement and availability of technology, it's not surprising that more help becomes available, and that things that used to be difficult became easier!

The real deal will be building a small, fast running and accurate evaluation function: very few people know how to do that at this time.
Human chess is partly about tactics and strategy, but mostly about memory
User avatar
hgm
Posts: 28418
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Neural networks in chess programming

Post by hgm »

Not really. The evaluation function of current top engines is just a sequence of matrix multiplications. Code that does it can be written in a single line, as I showed in a recent posting in the programmers section. (Of course you would have to program it in assembler to make it really fast, using AVX512 instructions. But I have no doubt that assembly routine can also be taken from a library, as it is basically the same for every engine.) The blessing of NNUE!
User avatar
towforce
Posts: 12661
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK
Full name: Graham Laight

Re: Neural networks in chess programming

Post by towforce »

hgm wrote: Thu Apr 04, 2024 8:05 pm Not really. The evaluation function of current top engines is just a sequence of matrix multiplications. Code that does it can be written in a single line, as I showed in a recent posting in the programmers section. (Of course you would have to program it in assembler to make it really fast, using AVX512 instructions. But I have no doubt that assembly routine can also be taken from a library, as it is basically the same for every engine.) The blessing of NNUE!

They might be unbeatable at correspondence time settings, but they still require search to be better than the top humans - and you cannot run them on a tiny computer.

The ULTIMATE chess computer will be a "chess calculator"! Enter a position, get the distance to mate instantly.

Btw - businesses are more and more using low-code and no-code solutions wherever they can. A "no-code" solution is basically a template - and if a template can run important parts of the business, then this is preferable to having a code base to build and maintain. For some businesses, though, their own software is their competitive advantage.
Human chess is partly about tactics and strategy, but mostly about memory
User avatar
hgm
Posts: 28418
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Neural networks in chess programming

Post by hgm »

I developed something like that for making a program that plays chess variants. It supports such a large variety of rules that it can be configured for most variants without writing any code. Just tell it which pieces (= images) participate, how they move, and where they start, and some key=value lines to enable special rules or define an alternative board size.

And for those who consider even that too much work, I created a kind of wizard (the 'Play-Test Applet') to create the definition of the variant. By simply dragging the pieces from a table to the board, ticking a few checkboxes and pressing a few buttons.
User avatar
towforce
Posts: 12661
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK
Full name: Graham Laight

Re: Neural networks in chess programming

Post by towforce »

hgm wrote: Thu Apr 04, 2024 8:47 pm I developed something like that for making a program that plays chess variants. It supports such a large variety of rules that it can be configured for most variants without writing any code. Just tell it which pieces (= images) participate, how they move, and where they start, and some key=value lines to enable special rules or define an alternative board size.

And for those who consider even that too much work, I created a kind of wizard (the 'Play-Test Applet') to create the definition of the variant. By simply dragging the pieces from a table to the board, ticking a few checkboxes and pressing a few buttons.

Impressive! 8-)

I'm glad about this little discussion about low-code development, or I wouldn't have seen that!
Human chess is partly about tactics and strategy, but mostly about memory
chesskobra
Posts: 358
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: Neural networks in chess programming

Post by chesskobra »

hgm wrote: Thu Apr 04, 2024 8:47 pm I developed something like that for making a program that plays chess variants. It supports such a large variety of rules that it can be configured for most variants without writing any code. Just tell it which pieces (= images) participate, how they move, and where they start, and some key=value lines to enable special rules or define an alternative board size.

And for those who consider even that too much work, I created a kind of wizard (the 'Play-Test Applet') to create the definition of the variant. By simply dragging the pieces from a table to the board, ticking a few checkboxes and pressing a few buttons.
This might interest you: https://en.wikipedia.org/wiki/Game_Description_Language The idea, if I am not mistaken, is to separate game description from the program that plays the game, so the program should be able to read the rules at run time, and play by the rules.