The code was a mess, and the program was slow af, but it was an amazing learning experience.

  • @k_o_t
    link
    32 years ago

    that’s a cool project :)

    did you also build the machine learning component from scratch? like hand-built graph structures, autodiff, policy, reward functions etc?

    • @MarcellusDrumOP
      link
      1
      edit-2
      2 years ago

      Ohh and when I said that I shouldn’t have used my own solutions, I was talking about the way I handled computing legal moves, checking for “Checks”, and even the way I coded the board.

      A week before the deadline, I lost hope of making it any faster by myself, so I started searching for how other people did it, and I saw a ton of great optimization tricks that would require me to rewrite a huge chuck of the code, as it changes the underlying mechanics, so I couldn’t use them.

      I didn’t search before not out of laziness, but of stubbornness, insisting that I can figure it out on my own. Lesson learning the hard way.

      • @gun
        link
        22 years ago

        Yeah I wrote a chess game before and calculating legal moves was a nightmare. Especially with knights, castling, and en passant and other obscure rules. And I did not write that very cleanly, I think I had 1700 lines of code in that file.

    • @MarcellusDrumOP
      link
      12 years ago

      No machine learning. The AI is basically 2 functions:

      1. A function that determines the score of the position. A positive score is good for white, a negative one is for black. To do that, the function takes into consideration the number/value of pieces on the board, the position of the pieces(Knight in the center is worth more than a knight on the edge for example), and the safety of the king.

      2. Based on this score, I used Minimax to look multiple moves ahead, and determine the best outcome. Anything more than depth 3 makes the program take forever to compute though.

      • @k_o_t
        link
        22 years ago

        heh, that’s an… untraditional approach to chess algorithms :)

        i’m very curious what the elo score for such an algorithm would be? have you tried to pair it against another bot to measure the score?

        • @gun
          link
          2
          edit-2
          2 years ago

          It’s actually not. Minimax has been used lots of times for chess AI in the past. There are probably better techniques that are used these days though.

          Edit: when you search chess ai on YouTube, the top three videos are tutorials that use minimax, each with over a million views

  • @MarcellusDrumOP
    link
    12 years ago

    This was extremely hard, and like my advisor said, out of scope for me. The code was a mess, and the algorithm was extremely slow, but it worked. In hindsight, I could’ve done a lot a better if I didn’t insist on coming up with my own solution. I did end up getting an “A” though, and Godot was a pleasure to work with, simply because it didn’t get in the way. It allowed me to make a pretty GUI easily, and focus on writing algorithms.

    Wouldn’t recommend working on a project like this for your BS degree, unless you have a lot of free time to work on it, and very comfortable working with a lot data structures.