I Created a Chess AI in Unity

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • I Created a Chess AI in Unity using Minimax algorithm and Alpha-Beta Pruning.
    Good BGM - shorturl.at/FHJZ1
    Good Chess Tutorial - shorturl.at/drHSU

Komentáře • 55

  • @iXabhay
    @iXabhay Před 4 lety +22

    It's quite fascinating, I was rooting for an underdog AI to win against the popular AI.

    • @TextGuy
      @TextGuy  Před 4 lety

      might wanna make a more advance AI in future,hopefully i could figure out a method to beat them.

  • @aitch_games
    @aitch_games Před 4 lety +22

    Please tutorial. Waiting for it

  • @cincaimusic241
    @cincaimusic241 Před 4 lety +2

    Nice, excited to see your next video!

    • @TextGuy
      @TextGuy  Před 4 lety

      thanks , stay tuned :)

  • @polygoncrafter
    @polygoncrafter Před 4 lety +11

    Please make a tutorial! Great video!

    • @TextGuy
      @TextGuy  Před 4 lety +1

      still researching to build a MORE PERFECT AI ,thanks for watching btw :)

    • @AF-ei5yi
      @AF-ei5yi Před 2 lety

      he didn't make a tutorial

  • @williamsimjianyang7595
    @williamsimjianyang7595 Před 4 lety +3

    Wow nice ai

  • @krissloo143
    @krissloo143 Před 4 lety +1

    Loved it and waiting to see more
    It's fun indeed and funny
    Keep it up

    • @TextGuy
      @TextGuy  Před 4 lety

      Thanks you , will try to make more videos 👌

  • @IshanBanerjee
    @IshanBanerjee Před rokem

    Yo thats amazing work ❤

  • @ab_lk
    @ab_lk Před 4 lety +2

    Some people promote to a knight rather than a queen because it may lead to checkmate

    • @shloopi5221
      @shloopi5221 Před 2 lety +1

      In some rare cases it's better to promote to a rook or to a bishop to prevent stalemate

  • @tristunalekzander5608
    @tristunalekzander5608 Před 3 lety +4

    This was really cool we had a lot of the same ideas. One piece of advice I could give is to make pawn values not by the total amount of moves, but by whether or not they have a friendly pawn diagonally or horizontal to them. Pawn structure is very important in chess.

    • @TextGuy
      @TextGuy  Před 3 lety +1

      Yup, actually after the video I found many good concepts being discussed in "Chess Programming Wiki", anyway that is a lot of information, maybe I will challenge myself to make a better AI in the future, idk :P

    • @tristunalekzander5608
      @tristunalekzander5608 Před 3 lety

      @@TextGuy Mine is just about done, I'll send you the GitHub link so you can check it out if you want! Please do, I'm very proud of it. It plays very similarly to yours, opening with e3 and then bringing the queen out followed by the Bishop, but mine has way better pawn structure as I explained, and never makes a mistake (unless such a mistake goes beyond its depth and is unpreventable when it is finally perceived).
      Also, I noticed some odd behavior at 5:32, unless it is looking only 2 moves ahead, it should have actually taken the bishop with its rook, because the queen protecting it is "overloaded." Meaning your AI would have been trading one rook for both a bishop and a knight, so that move is +1 in its favor. I obsessed over bugs like this with mine.
      Though from what I can tell, we both have like the best homebrew chess AIs on YT lol (well mines not on YT but its better than others that are). Other peoples' sucked and they didn't even notice or just didn't admit it. Like, CodeBullet's chess AI was a buggy mess that couldn't even beat a monkey.

    • @TextGuy
      @TextGuy  Před 3 lety

      @@tristunalekzander5608
      @Tristun Alekzander that would be great to see yours, I recently have some other project to do, making chess AI are quite time comsuming, especially when I need to explain the concept in video. I recently dont have that much time to make a video about a more advance chess AI.
      I think the reason why that odd move is occurs is because my bad evaluation function that consider every pm(possible moves) as 0.5f , so...
      Black Knight = 3 + (3pm * 0.5f)
      Black Bishop = 3 + (4pm * 0.5f)
      White Rook = 5 + (9pm * 0.5f)
      So it negates the value of both piece.
      B = 4.5 + 5
      W = 9.5
      also after the queen move he gain 4 more pm. Which make the result actually a -2.
      I've a concept of decreasing the value of pm according to piece left on board to avoid this kind of situation where pm is more valuable than capturing piece.
      Thanks for your appreciation, there's is actually not much people did chess AI on YT, most of them just did the minimax then gave up. There's actually bunch of stuff that could be implement though.

  • @mrlitty8330
    @mrlitty8330 Před 2 lety

    You coded the king and queen on the wrong squares and now my brain hurts

    • @mrlitty8330
      @mrlitty8330 Před 2 lety

      unless.... orange was white and white was blackXD

  • @seangrabowski2276
    @seangrabowski2276 Před 3 lety +5

    You made a great video, I would love it if you explain your algorithm with the code!

    • @TextGuy
      @TextGuy  Před 3 lety +1

      because it would take too long to explain the codes, and it's my first chess project it is not the best way of making chess AI, maybe I would make a pseudo-code example for tutorials :)

  • @bsdrago
    @bsdrago Před 4 lety +4

    Id like a tutorial about it

  • @amroulouay6819
    @amroulouay6819 Před 9 měsíci +1

    I can't access the URLs in the description, could you send me the appropriate links?

  • @cancermemestv4819
    @cancermemestv4819 Před 4 lety +1

    It’s a good video, very informative

    • @TextGuy
      @TextGuy  Před 4 lety

      glad that you liked it! :)

  • @lt2206
    @lt2206 Před rokem

    Make tutorial pls.Nice video

  • @opensystem7968
    @opensystem7968 Před 4 lety

    good video,please make more videos!

    • @TextGuy
      @TextGuy  Před 4 lety

      thanks ,still researching for some interesting project,stay tuned :)

  • @niko587
    @niko587 Před 2 lety

    "yo i got my pawn to ur base , give me a pawn"
    - Einstein

  • @kaos3375
    @kaos3375 Před 4 lety +3

    Still waiting for the tutorial...

  • @anime_neet_4421
    @anime_neet_4421 Před 2 lety

    Yes I want to know

  • @markoknezhevikj4144
    @markoknezhevikj4144 Před 3 lety

    White queen starts on a light square. :(

  • @AF-ei5yi
    @AF-ei5yi Před 2 lety

    It would be better if it was a tutorial

  • @lxy1312
    @lxy1312 Před 3 lety

    T H E R E T A R D M O V E
    i felt that

  • @HollowNeko
    @HollowNeko Před 2 lety

    Are there still any plans for a tutorial o chess ai? :D

  • @vpascu
    @vpascu Před 3 lety

    Can u do a tutorial for this even if it's not perfect? I have a project using this and idk how to implement...it would be a good start for me

    • @TextGuy
      @TextGuy  Před 3 lety

      I've tried to make a tutorial, but since making a Chess AI required intermediate knowledge of coding, so it's hard to make a tutorial than just talking about the algorithm I used, here's a video explaining the algorithm in my video.
      czcams.com/video/l-hh51ncgDI/video.html
      ...
      and there's a wiki that include everything of Chess AI too here.
      www.chessprogramming.org/Main_Page

  • @dashingmlg601
    @dashingmlg601 Před rokem

    Tutorial please

  • @tobiasgorgen7592
    @tobiasgorgen7592 Před 3 lety

    Quite unexpected that the ai, giving such high value to its kind would sacrifice it to capture yours And a piece. Would not have thought of that

    • @TextGuy
      @TextGuy  Před 3 lety +1

      because I've never consider the move generation to stop after someone lost, so it will still choose the move that would lead to a best advantage after 3 turn, even that both kings are captured.

    • @tobiasgorgen7592
      @tobiasgorgen7592 Před 3 lety

      @@TextGuy fair enough. Probably that is why Id not think of that. Because we humans, with out fleshy human brain implicitly expect the game to end

  • @reversev9778
    @reversev9778 Před 4 lety

    I just want to know how to implement alpha beta pruning, I’ve figured out minimax by myself, but I just can’t do pruning

    • @TextGuy
      @TextGuy  Před 4 lety +3

      I think i might do a explaination video soon , since there's some people wants to know.

  • @user-sw8zy4yr5r
    @user-sw8zy4yr5r Před 2 měsíci

    So no tutorial?

  • @ShutUpAndDanceSe
    @ShutUpAndDanceSe Před 3 lety +1

    Why the Queen and King are placed wrongly... :D

    • @TextGuy
      @TextGuy  Před 3 lety

      it's because I want to test my AI with chess.com, and their Queen and King are placed like that D:

    • @ShutUpAndDanceSe
      @ShutUpAndDanceSe Před 3 lety

      @@TextGuy In a match against chess.com. White is your red and black is your white.. but when u played first matches it was white = white and red = black and the queen and king are in a wrong position in this situation. White king has to be always on a black square. Blacks should be on e8 on a white square.

    • @cannotfigureoutaname
      @cannotfigureoutaname Před rokem

      Yeah, he made red as white and white as black

  • @BastabyYT
    @BastabyYT Před rokem

    Its a fun experiment but you clearly need to know chess and how every piece can move AND capture, you clearly dont know much about chess if you think king has more lets say points than all of the chess pieces combined, in order to make that ai work you need to consider everything for it, including the fact that pawns can do a move called en passant

  • @mroemmi6232
    @mroemmi6232 Před 3 lety

    dude. you switched up king and queen... white King always starts at black square e1. Maybe first learn the rules exactly before doing something like this...

  • @strahd7864
    @strahd7864 Před 3 lety +1

    2:54 pawns cant attack like that, they can only move on the vetrical axis and can only attack on a diagnal