Coding Adventure: building a strong Chess AI | Can it beat me?

Поділитися
Вставка
  • Опубліковано 15 лип 2023
  • I wanted to see if I could build a Chess AI, from scratch, that could beat me...
    This was a coding adventure.
    EQUIPMENT I USE
    ⌨️ Keyboard: amzn.to/3tgO0le
    🖱️ Mouse: amzn.to/45qLl5T
    🖥️ Monitor: amzn.to/3PzgWw7
    🎧 Headphones: amzn.to/3PE5C1S
    🎤 Mic: amzn.to/3EX9lCx
    🪑 Chair: amzn.to/3PDDlZ6
    BOOKS I RECOMMEND:
    📖 Clean Code: amzn.to/3rzjnqz
    📖 The Singularity is Near: amzn.to/3RGjfjO
    📖 Superintelligence: amzn.to/3M3Zz5R
    📖 Deep Work: amzn.to/3tdDZFi
    DISCLAIMER: Links might be affiliate links. As an Amazon Associate I earn from qualifying purchases. There is no additional charge to you, so thank you for supporting my channel!
    #programming #ai #chess
    Programming chess is a challenging and rewarding endeavor that combines the strategic and logical aspects of the centuries-old game with the creativity and precision of computer programming. At its core, chess programming involves encoding the rules and strategies of chess into a software program that can play the game either against human players or other programs.
    Creating a chess program starts with designing the basic framework, a digital representation of the chess board, and all the pieces with their respective moves. Each piece needs to follow the specific rules of movement in chess - for instance, rooks move horizontally or vertically, bishops diagonally, knights in an L-shape, etc. Enforcing rules such as castling or en passant also add complexity to the programming.
    One critical component is implementing the game's logic, which includes not only validating moves but also designing an algorithm capable of deciding the best move given a certain board state. This is usually accomplished using a search algorithm, like Minimax, which involves evaluating all possible future moves to a certain depth and selecting the one that maximizes the program's advantage while minimizing the opponent's potential gains. This often includes implementing an evaluation function to assign scores to different board states based on factors such as piece material, board control, king safety, pawn structure, and more.
    Advanced chess programs use techniques like alpha-beta pruning to optimize the search process, cutting off branches of the search tree that are not likely to influence the final decision. They may also use opening libraries (a collection of established high-quality moves in the early stage of the game) and endgame tables (precalculated optimal moves for endgame scenarios) to improve performance.
    Some modern chess engines, such as AlphaZero, use machine learning techniques, specifically reinforcement learning, to train themselves to improve over time. They play thousands or millions of games against themselves, learning from their mistakes and successes to constantly evolve their strategies.
    Programming chess is not just about making a computer play chess; it's about problem-solving, optimizing algorithms, and potentially even contributing to the advancement of AI research. It requires a strong understanding of both the game of chess and various computer programming concepts, making it an intellectually stimulating project for any coder.
  • Наука та технологія

КОМЕНТАРІ • 18

  • @먹힌사과
    @먹힌사과 Місяць тому +4

    "from scratch"
    *proceeds to use the whole chess library*
    still nice work thou i just found this a lil funny

  • @eboatwright_
    @eboatwright_ 5 місяців тому +5

    Very cool! I've been working on my own Chess engine in Rust for a couple months now, right now it's about 2000 on Lichess, but I'm currently re-writing the entire search function so we'll see how it improves 😄

    • @eboatwright_
      @eboatwright_ 4 місяці тому +4

      Update: I just put out the new version, and now it's up to 2120!

    • @manheevak
      @manheevak 3 місяці тому

      @@eboatwright_ can you share repo link

    • @MVCS_SpandanMN
      @MVCS_SpandanMN 3 місяці тому

      ​@@eboatwright_ actually i was build a chess app similar to chess online app ,using flutter need a ai model to support player vs computer ,could you guide me
      Thank you

    • @namansachdeva1378
      @namansachdeva1378 2 місяці тому

      @@eboatwright_ Can I check it out? If yes, how?

    • @Morningnice12
      @Morningnice12 Місяць тому

      ​@@eboatwright_ what's the name of your chess engine on lichess?

  • @eliascotrim51
    @eliascotrim51 11 місяців тому +1

    Fun video! Hope to see more from you. Some tips, try to make the video longer. I would love to see 4 or 5 more improvements to try to get it to god level.
    If after beating you there were more chapters on trying to get it to beat other AIs and final chapter trying to get it to rival Stockfish, I would watch 10-15-20 minutes of it

    • @leetcoderyt
      @leetcoderyt  11 місяців тому +1

      Thanks so much! I've been thinking about how I can improve the AI from here. If I do that, I'll create another video on it! Would be really cool to see it rival Stockfish.

  • @KewIsIncrediblyTired
    @KewIsIncrediblyTired 8 місяців тому +1

    very cool

  • @aleksantoniak5448
    @aleksantoniak5448 29 днів тому

    Hello. IS there any possibility for code sharing?

  • @Hixell
    @Hixell 9 місяців тому

    Is there a way to get in touch you like discord server or something?

    • @leetcoderyt
      @leetcoderyt  9 місяців тому

      Hey! I don't have a discord (maybe I'll make one if there's demand), but for now you can message me on twitter: @leetcoderyt

  • @rpraver1
    @rpraver1 11 місяців тому +2

    No, code?

    • @leetcoderyt
      @leetcoderyt  11 місяців тому +1

      I initially had a lot of code in the video but ultimately thought it would be more interesting to focus on the concepts. Let me know if you'd want to see code instead!

    • @BPGHchess
      @BPGHchess 8 місяців тому

      @@leetcoderyt Yes please :)

    • @adamassfoor1297
      @adamassfoor1297 6 місяців тому

      ​@@leetcoderytdrop the github