The Fascinating Programming of a Chess Engine

Поделиться
HTML-код
  • Опубликовано: 20 сен 2024

Комментарии • 480

  • @dantheok1
    @dantheok1 11 месяцев назад +1010

    the fact that this channel has 17 subscribers is bewildering, perplexing, and puzzling for me

    • @nameyname1447
      @nameyname1447 10 месяцев назад +57

      the fact that this channel has 125 subscribers is bewildering, perplexing, and puzzling for me

    • @galactoman5503
      @galactoman5503 10 месяцев назад +39

      the fact that this channel has 212 subscribers is bewildering, perplexing, and puzzling for me

    • @animationgaming8539
      @animationgaming8539 10 месяцев назад +27

      the fact that this channel has 217 subscribers is bewildering, perplexing, and puzzling for me.

    • @khytron06
      @khytron06 10 месяцев назад +20

      the fact that this channel has 287 subscribers is bewildering, perplexing, and puzzling for me

    • @AverageBishop-
      @AverageBishop- 10 месяцев назад +19

      the fact that this channel has 313 subscribers is bewildering, perplexing, and puzzling for me

  • @theluvjain
    @theluvjain 10 месяцев назад +430

    As a developer and a lifelong chess lover, this video made me happy! Your pacing was simple, easy to understand and though the ideas were complex, you demonstrated and explained them in a neat and organized fashion. Cheers my friend - looking forward to the next one!

  • @Pi7on
    @Pi7on 10 месяцев назад +81

    Damn, I felt like the video had just started, and then boom, it's already over.
    If you keep up the style/quality, you definitely have a future among the greats of video essays on programming/CS

    • @andrewsarroyo
      @andrewsarroyo 10 месяцев назад +1

      Yes, this whole video was mesmerizing. I was expecting at least twenty minutes. So good.

    • @Pi7on
      @Pi7on 3 месяца назад

      @@ahmoin freya Holmer, Tsoding, Sebastian Lague, mattkc, no boilerplate, 3blue1brown, fasterthanlime
      And these are just the ones that came to mind first, there are many others

  • @espian6506
    @espian6506 11 месяцев назад +171

    I love how walked through implementing the minimax algorithm - the whole explanation felt very natural in the way you explained it, and the animation adding the bits of code was lovely because that's exactly how implementation unfolds. Great work!

    • @Ermude10
      @Ermude10 10 месяцев назад

      Fully agree! The code editing animations is great!

  • @Lycro.
    @Lycro. 10 месяцев назад +30

    This was a very well made video! I couldn't believe in the amount of subscribers you had because your production is top notch!

    • @artillerybeacon5324
      @artillerybeacon5324 10 месяцев назад +3

      A lot of obscure channels with high quality videos have been appearing in my feed, and I'm all for it.

  • @HansLemurson
    @HansLemurson 10 месяцев назад +12

    I give this video a high evaluation score for the youtube algorithm.

  • @Nicolas-sq4fj
    @Nicolas-sq4fj 10 месяцев назад +2

    After watching this video, so many "informative" programming related videos seem so over the top edited or cinematic. I don't want a dramatic intro or unnecessarily upbeat music. I want THIS

  • @diophantine1598
    @diophantine1598 10 месяцев назад +21

    I always enjoy hearing of new ways to apply bitwise operators.

  • @CalmaxFilm
    @CalmaxFilm 10 месяцев назад +11

    This video is ridiculously brillant... This is so clean, well explained, and the purpose is so exciting

  • @timsagichnicht
    @timsagichnicht 6 месяцев назад +6

    THIS VIDEO WAS LIKE THIS „!!“ BRILLIANT. As a chess lover and young programmer I found it amazing how you explained and visualized everything. Also the sound effects your voice and your explanation itself. I would love to see a continuation or a deeper analysis

  • @dhruvmishra1933
    @dhruvmishra1933 10 месяцев назад +1

    when i saw the length of the video, i thought to myself "alright what can he really teach me about chess programming in 6 mins lol lemme see" and these 6 mins felt like 1 min and 60 mins at the same time. So much info stuffed so precisely and explaining it in such calm and simplistic manner, kuddos man!🙌

  • @SpaghettiMonster0144
    @SpaghettiMonster0144 10 месяцев назад

    the fact that this channel has only 1.5k subscribers is bewildering, perplexing, and puzzling for me

  • @MattMcT
    @MattMcT 3 месяца назад

    Wow! Ok Bartek, just want to say thank you. Not just for the video but for the raw inspiration. I’ve got a learning engine to build, which like your chess engine, needs to be able to strategize on how to best position a learner for further strategic positions. So the challenge is to design the engine to provide the learner with a weighted numerical map of where they might want to head to learn more things. This way a learner can try to grasp the rabbit holes they can possibly traverse, prior to traversing them and strategize as they see fit for themselves. I have to do this in a more 3d type of board, but the principle is the same. So THANK YOU for the nudge I needed to just start building this as an engine. I owe you a beer/coffee/highFive!

  • @fuzzy-02
    @fuzzy-02 10 месяцев назад +5

    This is just amazing.
    I was fascinated most by how the board conveniently fit into an int64 and how from there everything just rolled as mathematics. Matrix multiplication in particular.

    • @Rexvideowow
      @Rexvideowow 10 месяцев назад +1

      Friendly reminder that certain kinds of matrix multiplications have become faster with AI recently finding a new method, a mathematician taking that to the next level, and then AI improving it once more.

  • @superuser8636
    @superuser8636 10 месяцев назад

    The fact this channel has only 4.27k subs is bewildering, perplexing, and puzzling for me

  • @bernardoalves3642
    @bernardoalves3642 10 месяцев назад +7

    There are a bunch of small computer science channels out there with really well-made videos that are ready to blow up, and I'm all for it.
    Best of luck, if that's your goal. Lovely video

  • @L-Coder
    @L-Coder 10 месяцев назад

    The fact that this channel has 1.62 k subscribers is bewildering, puzzling and perplexing for me😊

  • @harshnj
    @harshnj 4 месяца назад

    the fact that this channel has.... huh! wait, it was 17 just 6 months ago, and now, I see 11k subscribers! This fact is bewildering, perplexing, and puzzling and.... don't know what to say. Exponential growth like this 🤯

    • @NorthCalm
      @NorthCalm 4 месяца назад

      वास्तव में यह हैरान करने वाला, भ्रमित करने वाला और बहुत आश्चर्यजनक है।

  • @deivorous-3592
    @deivorous-3592 4 месяца назад

    The algorithm has blessed me today with this :') I was quite curious about how chess engines worked, and you explained with amazing clarity. Thank you.

  • @freedomofmusic2112
    @freedomofmusic2112 4 месяца назад

    your animations are beautiful and smooth! first time I've ever seen a video with more likes than the channel who made it. well done!

  • @Jejkobbb
    @Jejkobbb 10 месяцев назад +1

    Incredible visualizations, love this so much

  • @martinzokov
    @martinzokov 10 месяцев назад +3

    Dude! Really nice vid. You explain the concept in simple terms without all the unnecessary details. Looking forward to more of that!

  • @TheWanderingNeko
    @TheWanderingNeko 10 месяцев назад +3

    how do you only have 166 subscribers!? you have made the concept easily understandable and presented it better than channels with 100x-1000x your subs. amazing!!!!

  • @Realharshagarwal
    @Realharshagarwal 10 месяцев назад

    It feels so good to see this underappreciated video first being a developer and a chess fan.

  • @davidb6477
    @davidb6477 10 месяцев назад +41

    I was confused by the King placement evaluation since those values would quickly have the opposite gradation as pieces are traded off. This type of value assumption based on board placement would have to be dynamically evaluated and not taken as a static truth.

    • @crahs8
      @crahs8 10 месяцев назад +14

      This is usually solved by having two king placement tables: one for opening/middle game and one for the endgame. One then computes something like a number for "endgame-ness" (might be based on the number of pieces left) that smoothly interpolates between the two tables.

  • @applemirer3937
    @applemirer3937 10 месяцев назад

    Wow, I hadn't heard this song before. I love your taste in music.

  • @darnit006
    @darnit006 10 месяцев назад +21

    Wow. Im a software developer and hearing you explain something so complex in such a simple way is a freaking gift. Hats off to you sir.

  • @curlsalot91
    @curlsalot91 10 месяцев назад

    man i am half in the video and it's calm to hear you talk, chill to watch and interesting to understand. i like

  • @nilsfriman1555
    @nilsfriman1555 10 месяцев назад +2

    The video was very nice. Calming, informative, and inspiring. I love Sebastians videos too and i definitiely saw some of what i see in his videos in this one.

  • @manaskhanger
    @manaskhanger 4 месяца назад

    please continue making such fascinating programming videos brother!

  • @gandalfjackson1546
    @gandalfjackson1546 10 месяцев назад +9

    As a CS graduate, I love seeing the concepts we learned applied to real world things like chess.
    Fascinating stuff

  • @gabrieltellesm
    @gabrieltellesm 11 месяцев назад +5

    Very nice video, and it shows that a lot of effort went into it. Congrats!

  • @YassineSABRI00
    @YassineSABRI00 10 месяцев назад

    Just found your channel man and I can assure you, you have a beautiful interessting content,... 2 videos now and more to come.. keep the great work man :D - a word from a stranger java developer

  • @robbasgaming7044
    @robbasgaming7044 10 месяцев назад +1

    Beautiful video

  • @cydajock
    @cydajock 10 месяцев назад +3

    I think it would be interesting to go over how to make the min max processing multi-threaded and in a compiled language. Fundamentally this was a beautiful video, and python was an excellent choice to show the algorithm at a high level, but a practical engine would need to be scalable and take advantage of as many cpu cores as possible. Keep up the good work!

    • @ME0WMERE
      @ME0WMERE 10 месяцев назад +4

      Functionally, there's no difference to a compiled language - the executable would just be faster.
      Multithreading is, unsurprisngly, hard to implement - the current best chess engine (Stockfish) uses a method called lazy SMP, which starts each thread on the same start position but gives them all access to the same shared transposition table. Very slight deviations in CPU time that each thread will have (due to unpredictable kernel scheduling) will cause some threads to reach positions slightly earlier than others and write the result into the table. This means that the other threads that reach that position microseconds later will just take the value in the table instead of searching it. These slight differences in what positions each thread searches quickly add up, meaning the threads quickly start searching completely different parts of the whole possible minimax tree.

    • @cydajock
      @cydajock 10 месяцев назад +2

      Oh wow that’s actually really cool! Having a shared memory cache is actually quite nifty here. Thanks for sharing 🔥🔥🔥

  • @KakoriGames
    @KakoriGames 10 месяцев назад +1

    I once implemented a minmax algorithm for Tic Tac Toe in Python, its quite simple to implement, the hardest part of a program like this is making it efficient and implementing a good eval function, neither of which my Tic Tac Toe AI needed since it could simply exhaust all possible moves. The thing I've been more curious about is not necessarily the conceptual part of the engine, but rather how you would go about making a engine that could, potentially, work with programs like Chessbase and participate in competitions like TCEC. If you make your own Chess program, doing a working engine is relatively simple, but making a engine that can work with programs and APIs made by other people I don't really know much about.

    • @redbedhed
      @redbedhed 9 месяцев назад

      If interested, I can link you to a couple of Chess programming Discord servers with seasoned authors willing to help.
      Creating a good Chess engine can be hard--- much harder than writing minimax for tic-tac-toe. Even plain Minimax (with no optimization) can solve tic-tac-toe in seconds, building a table that maps positions to best moves. A tic-tac-toe AI doesn't even need to search the game tree more than once.
      However, the game tree complexity of Chess is so high that we will all be dead long before the game is solved. A Chess AI must search the game tree during the midgame, and optimization there is critical.

  • @lakshyachopra_
    @lakshyachopra_ 10 месяцев назад

    Such a well curated and informative video! I’m glad to be one of your early subscribers.

  • @NorthCalm
    @NorthCalm 4 месяца назад

    The fact that this channel has 11.1k subscribera only is indeed surprising.

  • @OmarMoBadr2
    @OmarMoBadr2 11 месяцев назад +4

    Great video thank you, I thought you would show a demo at the end of the video, but anyway keep up the excellent work.

  • @el_crego
    @el_crego 10 месяцев назад +1

    Really nicely produced video 👍 recently created chess in c++ and have been interested in engines, I realised how inefficient an array would be and had no idea about this method, I’d been using fen notation. Also, Well deserved channel growth 🎉 👏

  • @toofatforthat3861
    @toofatforthat3861 10 месяцев назад

    This is an amazing video! I have no idea about coding, but ur animations and the style of the video made me very invested. It seems to be a very intriguing process in which we developed a need for a chess computer and how incredible and unbeatable they are now.

  • @fadishadi8855
    @fadishadi8855 4 месяца назад

    your style is sooo good! frustrated to find only 4 videos in your channel

  • @brettbuchanan1878
    @brettbuchanan1878 10 месяцев назад

    I wish this video was much, much longer. Great content

  • @setu_s24
    @setu_s24 10 месяцев назад

    Wohhh, one of the best videos I have ever watched on RUclips.

  • @alaeifR
    @alaeifR 10 месяцев назад

    Beautiful graphic and motion design. Aesthetically very pleasing. Well explained.

  • @oro5421
    @oro5421 10 месяцев назад

    My prediction is that this channel is really going to blow up

  • @mike87364
    @mike87364 3 месяца назад

    This is beautifully done

  • @saru4L
    @saru4L 10 месяцев назад +1

    Subscribed! This intro to chess engine development was very interesting, and I loved how you implemented the minimax algorithm into it. Maybe next time you could use genetic algorithm for the engine, using optimized material as heuristics?

  • @A71098
    @A71098 11 месяцев назад +3

    underrated channel

  • @craz2580
    @craz2580 10 месяцев назад

    I know nothing about coding, not much about chess aside from the movement but this video came to my recommendations at random. It was interesting

  • @ahmedAltariqi
    @ahmedAltariqi 8 месяцев назад

    I should say your videos are pretty well edited and interesting!
    I'd love to see more videos like these ❤

  • @dhruvinvekariya975
    @dhruvinvekariya975 10 месяцев назад

    It is out of my mind that channel less than 1k subs has this insane presentation
    Kudos🔥✌

  • @presente9501
    @presente9501 10 месяцев назад +4

    Great video! It was in a style somewhat similar to Sebastian but with his personality. It would be interesting to see the game 2048 being dissected by the expectimax algorithm or monte carlo.

    • @BartekSpitza
      @BartekSpitza  10 месяцев назад +1

      Indeed.. 2048 is a fun game!

  • @SomeSnowman12
    @SomeSnowman12 10 месяцев назад +1

    Wonderful video. I loved how you walked through your processes in making this. Wished it was a bit longer/more in-depth, but that's just a personal preference.

  • @svxtn
    @svxtn 10 месяцев назад +1

    very elegant presentation, quite simplified yet intriguing. excellent video

  • @noggintube
    @noggintube 10 месяцев назад +1

    I had a ZX81 in the mid-80s and had a chess game on it that was only 1k in memory. It always amazed me how they managed to programme a chess game into such a tiny amount of memory. Modern programmers could probably learn a lot from those tiny memory constraints.

  • @jacokyle0160
    @jacokyle0160 10 месяцев назад +4

    man if this video was 10 hours long I would certainly watch it all 😂

  • @Pabocheoreom
    @Pabocheoreom 11 месяцев назад +2

    Informative video, really enjoyed it! Keep it up

  • @thornels
    @thornels 7 месяцев назад

    Reminds me of the Sebastian Lague video, great content :D

  • @_.-.-_.-.--.-_.-
    @_.-.-_.-.--.-_.- 10 месяцев назад +1

    May I ask what video editor are you using to make those animations?
    Love it, kudos to your whole effort. Peace.

  • @hoteltrivago9504
    @hoteltrivago9504 4 месяца назад

    absolute peach of a video. coding asmr

  • @marcolarthur
    @marcolarthur 10 месяцев назад

    Excelent quality here, congrats!!

  • @Spyaboo
    @Spyaboo 10 месяцев назад +2

    Best explanation and visualisation I've seen so far for bitboards, keep up the good work :)

  • @yelnurkean9298
    @yelnurkean9298 10 месяцев назад

    i am impressed by the video editing. It was really good!

  • @mxtafsa
    @mxtafsa 10 месяцев назад

    Amazing video, really enjoyed it

  • @dionito70
    @dionito70 10 месяцев назад

    You just got another subscriber. I hope you keep it up with the channel. This video is awesome! Simply explained, to the point and clear. Makes me want to get back into my chess engine, which I abandoned at a time of too much "real work". Thanks!

  • @esmondtheillusionmotsepe7656
    @esmondtheillusionmotsepe7656 10 месяцев назад

    You have earned my subscription.👊🏽 Chess lover and computer science enthusiast. Hoping for more.🤌🏽

  • @ward648
    @ward648 10 месяцев назад

    I'd love to see how the chess engine performs with different components enabled and different search depths. I've been thinking about getting into chess programming for a while, I wanted to see if I could make an engine that plays at a low-elo but making more human-ish mistakes, like forgetting about king safety, a distant bishop, en-passant or being over-biased towards captures or giving checks etc. It would be a really neat tool to help players learn and improve

  • @ThinkWithGames
    @ThinkWithGames 10 месяцев назад

    Awesome video! Satisfying animations, and great explanations!

  • @kishanparmar4010
    @kishanparmar4010 10 месяцев назад

    As someone who plays chess as well as studied minimax and such algos in computer science, i always find this topic interesting

  • @S4veMeBarry101
    @S4veMeBarry101 10 месяцев назад

    Phenomenal presentation and wonderfully narrated!

  • @coolestclipsontheinternet
    @coolestclipsontheinternet 10 месяцев назад

    The best video I've watched today

  • @maxivy
    @maxivy 10 месяцев назад

    This is the type of video a 250K+ subbed channel would make

  • @sisyfos101
    @sisyfos101 10 месяцев назад

    Honestly the most enjoyable programming experience I’ve ever had!

  • @findmehere
    @findmehere 10 месяцев назад

    this was very well demonstrated

  • @casualuser5527
    @casualuser5527 10 месяцев назад

    Great video. I want an hour long sequel.

  • @instagramsnapchat
    @instagramsnapchat 11 месяцев назад +2

    What a well produced video, your explanations are clear and the visuals really add to them. Fantastic work!

  • @gregorymorse8423
    @gregorymorse8423 10 месяцев назад +1

    The heuristic for evaluation is still primitive which is why neural networks have significantly improved modern engines. Also bishop pair, passed pawns, controling open files, etc should go into a strong heuristic. What is described here is primitive compared to state of the art. Also a position isn't merely 64 bits as having castling ability, move repetitions, 50 move rule, en pessante are also part of the game state. These nuances arent as important but they are amplified when engines play each other. Unless a mathematically perfect evaluation function is found such that chess is solved, maching learning is of course the most powerful modern statistical tool which is why it has become nearly universal in production engines. In general the strength of the eval function might be more important than efficient raw calculation as time is better spent. The interaction of pieces is more important than simple criterion. Its likely worth looking into how stockfish does the eval in non NNUE builds because it has one of the most nuanced heuristics imaginable.

  • @kabilasudhan8315
    @kabilasudhan8315 10 месяцев назад

    I always wondered how the chess engine works evaluating the positional advantage and material advantage! This gives some insight. 😌

  • @dungeonrobot
    @dungeonrobot 10 месяцев назад

    Fantastic video! Hope you manage to get the subscribers and views you deserve!

  • @AnthonySettergren
    @AnthonySettergren 10 месяцев назад

    I'm sitting here patiently waiting for a part 2. I need to see how it plays against you at various depths.

  • @Maheep_Infinity
    @Maheep_Infinity 10 месяцев назад

    U deserve more appreciation ❤🎉😊

  • @wsandst
    @wsandst 10 месяцев назад +1

    Really great video! I'd love to see another one explaining some more advanced concepts, such as move sorting, QSearch or transposition tables. And good shout-out to the chess programming wiki, what would chess programmers do without it? It's also one of the best references for obscure assembly instructions (pext, I'm looking at you!)

  • @Gsbansal
    @Gsbansal 10 месяцев назад +2

    This video deserves many more likes. You deserve all the appreciation for ur explanations and visuals. Btw, how did you do these animations? I have been trying to get into animation myself but can't seem to find a good starting point.

  • @maestroeragon
    @maestroeragon 10 месяцев назад

    very nice to watch and well done video, thanks for the great work!

  • @al3xj
    @al3xj 10 месяцев назад

    great share - interesting to hear the thought process - this thought process then can be applied to other different challenges, like optimising traffic in a unique environment, and so on

  • @sanjaykamath90210
    @sanjaykamath90210 10 месяцев назад

    Loved it : The method you describe is called alpha beta Pruning.
    This prevents unnecessary node evaluations 😮

  • @STS232323
    @STS232323 10 месяцев назад

    This is so well explained and interesting!

  • @murphleeman3347
    @murphleeman3347 10 месяцев назад +5

    Thank you for wishing me a happy day :) I also wish you and whoever reads this comment a happy day!

  • @sparshsharma5270
    @sparshsharma5270 10 месяцев назад

    While programming a computer/engine to evaluate chess, some things needs to be taken into consideration. One crucial factor is mobility of pieces. Stronger the piece is placed (depends on how many squares it controls), better is the position for that side. Also, though brute force algorithm would be required for evaluating the position, but to make the engine take lesser time, candidate moves can be programed via recursion. Surely not easy, but as a programmer, that can well be done.

  • @edouardcourty4267
    @edouardcourty4267 10 месяцев назад

    This was such a good explanation, thank you

  • @pedrohjleite
    @pedrohjleite 10 месяцев назад

    Amazing content man, keep it up

  • @FrixAnims
    @FrixAnims 10 месяцев назад

    Great video! I love how you presented this topic specifically. Im subbing looking for more :)

  • @mankifg
    @mankifg 10 месяцев назад

    good quality video like Sebastian Lague's chess adventure, +1 subscriber

  • @joshuasonnen5982
    @joshuasonnen5982 10 месяцев назад

    Phenomenal video 🎉❤

  • @2ndTony
    @2ndTony 10 месяцев назад

    Great video! Love the way you explain

  • @elifriedman317
    @elifriedman317 10 месяцев назад

    Great succinct video!

  • @dhruvgarg722
    @dhruvgarg722 10 месяцев назад

    this was awesome man

  • @panilyau
    @panilyau 3 месяца назад

    Amazing video!

  • @EcsMurphy
    @EcsMurphy 10 месяцев назад

    This was excellent. Subscribed ❤