euclidstellar's blog

By euclidstellar, history, 6 months ago, In English

Hi everyone,

I made a chess engine using an alpha-beta pruning / negamax algorithm along with a transposition table to optimise the pre-calculation of moves in a game tree.

please have a look and let me know how can i improve this chess engine and optimise its recursive calls(depth) to manage latency.

GitHub : https://github.com/EuclidStellar/Sepentia-ChessEngine ( if you find it good please do star it )

also if you are interested to know how i made this here's a medium article I wrote on it :https://medium.com/@euclidstellar_57634/creating-a-chess-engine-sepentia-835a86aa25da

  • Vote: I like it
  • +68
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by euclidstellar (previous revision, new revision, compare).

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm not good at chess engines but if I know Big Algo they must be using 1e9 different heuristics.

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

If you change the depth $$$4 \rightarrow 5$$$, will it be too slow?

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Btw it also depends on the CPU resources your PC and more importantly if I come up with better positional scores then maybe I can increase ELO without increasing depth which will be less costly in terms of CPU resources

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

https://www.youtube.com/watch?v=U4ogK0MIzqk This can help you, it has a lot of good techniques for making chess engines. If you want to make an even stonger bot, here is another video: https://www.youtube.com/watch?v=_vqlIPDR2TU

Hope this helps!

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by euclidstellar (previous revision, new revision, compare).

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by euclidstellar (previous revision, new revision, compare).

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

i used this against real player 1100 elon chess.com ... he lost lol ... i tried second time ..he was showing blunder moves ... need more depth ig

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You can manually increase the depth by changing the value of variable in chessai.py file but it has ELO of 1500 as I have tested in on over 100 games please make sure that nothing else is running on your PC in BG so that it get sufficient CPU Resources

    • »
      »
      »
      6 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i increased depth to 5 , it is not utilizing my cpu much for some reason i thought my cores will shoot up to 100% but they are at 1%-5% only...

      i played one more game ... again he lost ... he somewhere blunders one knight in whole game and have a major disadvantage .... and one more thing why he tend to remove knight firsts ... his knights keep dancing here and there for no reason... i think can you make something like to teach him some opening or make it adaptive as many games he play he learns type?..

      • »
        »
        »
        »
        6 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Hi ankit that seems a little bad lets connect on discord :

        euclid_41533

    • »
      »
      »
      6 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      for reference this the game i'm talking about game

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it
  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    That's really great content I'll surely implement it although i was also trying to use GPU instead of CPU for parallel processing and exploration of game tree

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

good work and keep going... wishing this new project a high level in the near future!

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Did you implement Zobrist hashing for the board state? Because Zobrist Hashing can make your code almost 4000 times faster.

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks, man i didn't know about it will definitely try to implement it if you also want to collaborate on this project then contributions are most welcome

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey, this looks very interesting.What do you think are the pre-requisite to building a chess engine are?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    prerequisite :

    a good knowledge of any language

    good knowledge of recursion, minimax , negamax and alpha beta algos and most importantly curiosity to learn and explore more

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Hey i kinda struggle with propely visualizing recursion,could you give some tips,resources and stuff to understand it deeply? i could write recursive codes 7/10 times,but i cant get a feel to it(the way i have with iterative codes).

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I used to be interested in making bots for chess-like 2-player zero-sum games too. I found this resource to be very useful: https://www.chessprogramming.org/Main_Page. Check it out.

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Sebastian Lague (Coding Adventure youtube channel) ran a chess tournament, check it out too

https://www.youtube.com/watch?v=Ne40a5LkK6A

the results are here:

https://github.com/SebLague/Tiny-Chess-Bot-Challenge-Results

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I wrote a chess engine after watching that Sebastian Lague video a year ago. Mine kinda sucked, I found this one though https://github.com/thomasahle/sunfish It is very good

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i actually used positional scores from sunfish to make it better

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey, that's great! I also made a chess engine using the same algorithm with other optimizations. You can check it out here: https://github.com/imranakki/OBSIDIAN. It plays well, but sometimes makes dumb moves when the time runs out.