Chazzla - Playable Chess AI

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
Azzla
Prole
Posts: 43
Joined: Sun Mar 29, 2020 2:23 am

Chazzla - Playable Chess AI

Post by Azzla »

After a few months of work, I've finished v1 of my playable Chess engine. The whole project was written from scratch using Lua/Love2d, though heavily inspired by Sebastian Lague's Chess Programming Video. Download and try your hand at defeating it! :3

Image

Repo: https://github.com/Azzla/chess-engine
Download Release Build: https://github.com/Azzla/chess-engine/r ... hazzla.zip

This was really a fun and interesting challenge. Here are some of the features included at the moment in the engine:
  • Alpha/Beta Negamax Search
  • Quiescence Search
  • Iterative Deepening + Principal Variation
  • Move-Ordering
  • Piece-Square + Mop-Up Eval Bonus
  • Perft Testing Suite
  • Multi-Threading
Things the engine doesn't currently have but I hope to eventually include:
  • Zobrist Hashing
  • Transposition Table
  • Search Extensions
  • Bitboard Move Generation (possible in LuaJIT with FFI+BitOp maybe?)
One caveat is that at the moment player pawn promotions are automatically queens. I need to re-implement the UI aspect for selecting other pieces. The engine can promote to anything but picks queen 99% of the time anyway. There may be a lingering issue with the mop-up eval because in certain theoretical endgame positions the engine can sometimes end up repeating indefinitely. I haven't seen it occur from a normal starting position.

The code is a huge mess and needs desperately to be cleaned up, but well, I was just excited to finally have a working and bug-free version of the engine. Move generation was extensively tested via this perft testing suite up to a depth of 6; there shouldn't be any illegal moves possible, nor edge-case positions where the game breaks.

My ultimate goal was to have the engine defeat me most of the time. At the moment it can beat me something like 80-90% of the time! :awesome:
Last edited by Azzla on Sat Sep 28, 2024 7:56 pm, edited 1 time in total.
libraries: Stalkpile
electronic music stuff: https://soundcloud.com/azzlamusic
User avatar
Roland Chastain
Prole
Posts: 41
Joined: Sat Feb 07, 2015 2:30 pm
Location: France
Contact:

Re: Chazzla - Playable Chess AI

Post by Roland Chastain »

Looks great! Congratulations.

Two small things:
  • Under Linux, I had to rename CHEQ_TT.TTF to CHEQ_TT.ttf.
  • The game doesn't fit to my (little) screen.
capture-chazz.png
capture-chazz.png (54.42 KiB) Viewed 9074 times
User avatar
Azzla
Prole
Posts: 43
Joined: Sun Mar 29, 2020 2:23 am

Re: Chazzla - Playable Chess AI

Post by Azzla »

Roland Chastain wrote: Sat Sep 28, 2024 6:08 am Looks great! Congratulations.
  • Under Linux, I had to rename CHEQ_TT.TTF to CHEQ_TT.ttf.
  • The game doesn't fit to my (little) screen.
Fixed the font! The game window is also now resizable and launches at a smaller size - updated release build is available.

Also thank you! :ultrahappy:
libraries: Stalkpile
electronic music stuff: https://soundcloud.com/azzlamusic
User avatar
Roland Chastain
Prole
Posts: 41
Joined: Sat Feb 07, 2015 2:30 pm
Location: France
Contact:

Re: Chazzla - Playable Chess AI

Post by Roland Chastain »

You are welcome.

I have just cloned again the git repository. The window size issue has been fixed, but the font issue is still here!
glitchapp
Party member
Posts: 257
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Chazzla - Playable Chess AI

Post by glitchapp »

hi, I find this very interesting, I forked a chess engine to port it for my mobile but you can't play against the cpu like this, I may fork it and port it to mobile if you don't mind.
User avatar
Azzla
Prole
Posts: 43
Joined: Sun Mar 29, 2020 2:23 am

Re: Chazzla - Playable Chess AI

Post by Azzla »

Roland Chastain wrote: Sun Sep 29, 2024 10:12 am You are welcome.

I have just cloned again the git repository. The window size issue has been fixed, but the font issue is still here!
That's very strange - Git didn't recognize the filename change from ".TTF" to ".ttf" and so ignored the push to repository. I had to manually delete and reupload it. :monocle: In any case, the release binary should be fine and the repo now has that change.
glitchapp wrote: Sun Sep 29, 2024 10:13 am hi, I find this very interesting, I forked a chess engine to port it for my mobile but you can't play against the cpu like this, I may fork it and port it to mobile if you don't mind.
You are welcome to try, but I have my doubts about the feasibility for my particular engine (in its current state). You'd probably need to make it single-threaded as a start. Also, LuaJIT will not work on iOS (maybe Android?) - that in addition to the downgraded CPU performance means the engine will be really struggling on deeper searches without extra optimizations.
libraries: Stalkpile
electronic music stuff: https://soundcloud.com/azzlamusic
glitchapp
Party member
Posts: 257
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Chazzla - Playable Chess AI

Post by glitchapp »

Your chess engine is already in openrepos (an app repository for sailfish os) and it performs greatly.
Here is the repository: https://openrepos.net/content/glitchapp/chess-engine
It's not the first game I port to mobile but yours was quite easy because I did not have to add any touch controls, just resize the screen to make fit on modern mobile portrait screens.
Since the game has no shaders and no floating point calculations that I know, the game worked like a charm at first try and performs great, test it yourself (you can extract the love file out of the rpm if want to test on android or iOS.
* Actually I did not finish a game with the chess and I have no idea if after many moves the CPU would struggle, but at least during my first 5 minutes worked perfectly well, and I did not made it single threaded (there's no need and it surely performs worst like that).
User avatar
Roland Chastain
Prole
Posts: 41
Joined: Sat Feb 07, 2015 2:30 pm
Location: France
Contact:

Re: Chazzla - Playable Chess AI

Post by Roland Chastain »

Azzla wrote: Mon Sep 30, 2024 1:13 am That's very strange - Git didn't recognize the filename change from ".TTF" to ".ttf" and so ignored the push to repository. I had to manually delete and reupload it. :monocle: In any case, the release binary should be fine and the repo now has that change.
Thank you.

Now, a suggestion. What would you think about creating a UCI or XBoard interface, so that your engine can play tournaments against other engines? If ever you like the idea, you could take a look to my very simple UCI engine.
glitchapp
Party member
Posts: 257
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Chazzla - Playable Chess AI

Post by glitchapp »

I've just made a build of your game for postmarket os, even though both postmarket and sailfish are minority systems that few people use, maybe you are one of those fews.
The builds will be all on my repository.
Thanks for sharing! the chess engine is an amazing game!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests