
Coding Adventure: Chess AI
Think you can beat it? Give it a go over here:
If you’d like to support the creation of more videos (and get early access to new content), I’d greatly appreciate the support here:
Project Source:
Learning Resources:
If you’re interested in a video about some weird and interesting chess strategies, I highly recommend taking a look at this video by suckerpinch (and all other videos on that channel too!)
Chapters:
00:00 The Board and Pieces
03:20 Generating Moves
06:54 A Random Adversary
07:52 Optimization and Testing
12:11 Search and Evaluation
17:43 Easy Endgames
20:00 The Transposition Table
23:03 Openings
25:09 Game One
26:06 Game Two
27:01 Game Three
28:05 Game Four
Music:
Devoted Mind by Wild Colors
Intuition by Lincoln Davis
Wonderland by Shimmer
Selfless by Eleven Tales
Floating Point by Roie Shpigler
Nobility by Wicked Cinema
A Quiet Place by Jordan White
Air by Assaf Ayalon
Heart Wide Open by Sounds Like Sander
Thoughts by Anbr
Deep Blue Sea by Sivan Talmor
Flight of the Inner Bird by Sivan Talmor
Kings and Queens by Wicked Cinema
can I ask what you used for coding, I'm new, can you recommend what to use?
i dont know what your saying magic man but i like the results
11:54 I think it’s time to start working on something a little more challenging.
cats jumps in keyboard oh no! Not that challenging, down genius coder kitty!! Down!
More more more !!!
Chess will most likely never be solved
As a beginner looking him code like this , I am jealous, excited, depressed and probably a lot of feelings…
Just how did you start your coding journey and how much experience do you have ?
"Completely random moves"
Plays the Sicillian
Loved the Danya shout out. Then immediately gets smother mated lol
3:22 are we all gonna ignore the fact that he started conting on 0?
Wait this isn’t code bullet
solution to the puzzle at 2:28 1. Nf7+ Kg8 2. Qe8+ Qf8 3. Qxf8#
I've long felt like Chess should have some chance to it. Pawn vs Pawn – slightly favors the attacker. Pawn vs Rook – not looking good for the pawn – either attacking or defending, but who knows… the battle isn't always to the strong.
That cat is a grandmaster, checkmating the king without even making a move, brilliant.
coding is the one science I find worse than math, programming just absorbs everything of the programmer leaving only an empty shell,,
..which is partly the reason it's intriguing
why use 2 bits to represent the color of the pieces?
is this python?
question: is it coded in C# or C++?
A simplier and faster way to deal with checks and pins: For every move someone makes, let the computer calculate if their king is on an from the enemy attacked square after the move. If it is, the move is illegal. This would spare you from tracking pinned pieces and therefore would speed up your code a tiny bit.
Edit: That's what I thought at first but after a bit more thinking: When you want to move and take a piece, you show all legal moves of that piece by painting the squares red. So instead of you making the move and then the computer saying "No", you actually calculate every move for every piece beforehand to show the player the legal ones. By tracking pinned pieces you can take a shortcut and say "You don't need to calculate every possible move for that piece, it's pinned, it can't move right now" and save resources, therefore time. This shortcut is probably what caused the bug at 11:15.
This was probably too complicated to explain to a general audience so you left that out of the video. I'm still really proud I was able to figure that out, I'm only at my first semester of my informatics study.
Also hats off to you for going the extra mile of making more code to make your version more chess beginner friendly.
Most amazing thing to me was how the AI suddenly became really good at simple endgames as soon as you added that endgame tweak.
I hope naroditaki sees this!
What was this coded in
7:01 somehow, the first 2 moves of the random engine were somewhat good. it's just that the 3rd one wasn't. but then, if you get unlucky enough, it could have defended the mate, and then played all the best moves and win/draw.
WHich Language is this
there is nothing funnier then being able to castle with an enemy knight
What's the software he's using??
Why did you set colour using 2 bits, when one bit would suffice. Guess I;ll keep watching, maybe there's a reason…..
Lowercase k for BLACK king and uppercase K for WHITE – that's racist!
i wish i knew how to do this
what if world start to exist by the rules rather and we are like a figures, im thinking:)
Amazing video!
27:50 yes the explanation made sense and it's fascinating, I still can't believe so much optimization comes from the extra pruning
You had me at: “I’m rapidly losing faith in my ability to code anything”.
finally, we see the developer of this game,
please buff the kings they are totally useless and can't do shit without other pieces!
and also there is should equality among colours, totally unfair that white always start.
should be 5050 chance
That binary encoding of pieces has just solved an issue I was stuck on for months with my masters project.
THANK YOU!
I became curious: what are the implications of using CC BY-SA graphics in a YouTube video? 🤔
God damn, this guy just appeared in my recommendation page at 12am
Ended up watching 15 minutes of coding I don't even understand but they sounded cool
How would you code the DrawSquare method?
How did you design the chess GUI, because I'm having some real difficulty starting from scratch and trying to build a chess application from UWP, WPF or Java Swing. Thanks.
This is not an AI but still, pretty cool.
Interesting is: playing random, computer choosed Scilian Defense 😂😂😂😂
@11:50 "I think its time to start working on a more challenging opponent." A WILD CAT APPEARS!
Dad
I don't even know what programming language you are using, but still I somehow understand.
3:10 🤣 that was hilarious
a lot of your personalty came threw in this video
His voice is too calm for me
Why is watching this so good?
Awesome
what language is it
Hey everyone, hope you enjoy the video! Quick note – I noticed some slightly distracting compression issues after uploading, where squares of the chess board would sometimes blur together and flicker a bit. The only solution I could find was upscaling to 4k, so if you have the bandwidth I'd recommend watching in 1440 or 2160p.
By the way if you'd like to play against the AI, you can find downloads here: https://sebastian.itch.io/chess-ai
And source code for the project is over here: https://github.com/SebLague/Chess-AI