You are browsing as a guest. Sign up (or log in) to start making projects!

Leonhard

@Leonhard

Joined June 1st, 2026

  • 21Devlogs
  • 4Projects
  • 1Ships
  • 0Votes
I am a student, in austria at a tecknical school.
I like designing programs and real world hardware, mostly in low level programming languages.
Ship Pending review

I made a Chees-Engin in C. It only lets you play legal moves, and handles all edge chases with Pins, Checks, Chasteling and Blocking. Finding which moves are legal and which illegal, was probably the hardest part about this project, because I do not just use a normal 8 by 8 array for the field but instead a 64Bit int for each piecetype and color where each bit reprecents a square. The bitmanipulation was a nightmare to say the least. The actuall engin itself wasn't a walk in the park either, but by then I have allready gotten used to it. The projekt is on my Github, but only for LINUX. (Sorry, didn't really bother making a Windows version, because I personaly avoid using Windows at all cost)

  • 21 devlogs
  • 70h
Try project → See source code →
Open comments for this post

5h 5m 13s logged

I addet a negative maximum funktion, with some other optimizations. The time spent to make the engin better isn’t addjustivied. I am gona leave it just like it is. It is better than me and that is good enough.

0
0
4
Open comments for this post

4h 19m 24s logged

After some big optimizations, like moveordering and alpha-beta pruning, we are at a point where the engin actually beginns to get good. This engin is now comportable able to beat me. (I am about 1400 elo). It struggels a bit on endgames, and log-term development. I wasn’t really able to get a high depthed search, like other engins have it. I will have to take a good look why that might be. Thats gona be my next step.

0
0
1
Open comments for this post

6h 27m 54s logged

First test on the engin.
I use a recursive minimax funktion. Look a couple of moves into the futer and evaluate the positions. The bot already understands the idea of captures. But it has no positional play at all. It is also terreable at checkmating.

0
0
1
Open comments for this post

2h 9m 35s logged

I am not really sure how to structure my next few blogs. It will defenitly take 20h+ until the engin is somewhere playable. And I don’t want to log such a long time in on go. So I think I am just gona give small updates inbetween to show the inside of a chess engin.

The codepiece here is a basic evaluation funktion. It tells me exaclty which side is better at any given point. Although right now it is only counting material and not the quallity of the pieces that they contribute in the game.

0
0
1
Open comments for this post

47m 2s logged

Now with all of the groundlaying rules done, it is time to focus on the bot. I have already worked on the way the bot is gona be implemented. But the implementation itsself is still the biggest thing to work on. Right here you can see a bot that does a random legal move on the board. I didn’t even bother to check what elo this would be, but i would assume 150 to 250 elo. Next I will work on a evaluation funktion, which should be pretty easy.

0
0
1
Open comments for this post

6h 48m 28s logged

This was the most frustrating error jet. Took me forever to figur out what even was going on. And I took me even longer fixing it. So what keept happening was this:

  • Every time we look for a mate we simulate all of the opponents moves
  • If a pawn on the second or seventh rankt(one square away from queening) was just sitting idle the programm simulated the promotion
  • Because the promotion was just a simple scanf the complete programm came to a halt.

To fix this I have implemented a way to queen as user and also, one for the Bot, later down the line. Although the bot one only queens for now. I am not sure jet if it is even nessecery to programm it to promot to any other piece, because it is almost never really the only winning idea.

0
0
4
Open comments for this post

1h 52m 5s logged

Checkmate has been addet, also the ability to draw, by stalemate and the 50 move rule. I won’t do the draw for insuficient material jet, maybe later down the road. But while testing I found a terrific but with pawnpromotion, It sometimes giliches out and ask you for a piece even if your not on the first or eightest rang.

0
0
2
Open comments for this post

1h 11m 28s logged

I honestly expected the castling to be more complicated. But it is done now. With all rules implemented. No castling, afte moving the rook, the king, or if the king is in check, or if a rook has been taken. There is only one thing missing to make this game really playable, in a Player vs Player sense. Checkmate!

0
0
1
Open comments for this post

1h 40m 42s logged

Got it! Now blocks, checks, pins, and captures work. Everything works. The only missing thing is chastling wich might be a bit tricky to implement. The way the code works now, is the following:

  • Every possable move from a piece gets calculated
  • Every possition after the move gets looked at
  • If the king is attacked in any possition delet the move from the possable moves.

This may not ultimatle be the fasters way, but it’s fast enough for now. I might implement a even faster algorithem in the futur, but I like this one because it is just so clean and readable.

0
0
1
Open comments for this post

51m 3s logged

With the new logic it was a easy to add the legal moves for the king back in. Now lets get back at tackeling the blocking and check, and block mechanics.

0
0
3
Open comments for this post

1h 12m 27s logged

All pieces are back to the right way the shouldm except the king. I know have some super clean funktions, that should make position calculation extreamly fast. I also heard about some optimizations with shifting bit array, to make the movecalculation for a sigle piece even faster. Not really shure how that works jet, but I am planing on implementing that to in the futer. The faster my legal moves calculator is now, the better the engin is gona get later on.

0
0
1
Open comments for this post

7h 20m 4s logged

I realized that the way my current isKingInCheck funktion works, would just be way to slow, to make a powerfull engin later on. I did a quick search on the internet, and it turns out I need to split between legal and pseudo legal moves. Where the pseudo legal moves, disregard checks. So I started rewriting the last 400 lines of code. There is not much to show here.

0
0
2
Open comments for this post

24m 37s logged

Finally got the check logic on the king correctly. You are now unable to move a piece, if you are in check. Of course the blocking mecaniks are still missing. And I also should start working on the castlingmechaniks. But then I would me pretty much ready to start on the actual engin.

0
0
2
Open comments for this post

6h 4m logged

I am slowly getting the realization, how hard this actually gone be. Protected pieces now can’t be captured by the king. But I am still struggeling with the concept of check. It only works for pawns currently, there seems to be a big bug somewhere in the code. And pawns are able to capture from file a to h.

0
0
2
Open comments for this post

4h 45m 32s logged

Addet the complete movementlogic ecxept for the king. Even promotions and the sneaky en passant. The kings still proves to be a bit of a challange. But I will get it soon

0
0
1
Open comments for this post

2h 27m 52s logged

I started on some legal checks for the pawn, rook and knight for now. Everything moves as expected. Even with captures and pieces of the own color blocking you. I have also added the blue indecators witch squares are allowed and witch are blocked. The other pieces will come soon.

0
0
1
Open comments for this post

4h 50m 38s logged

The piece moving logic is now implemented. You could now theoreticly play the game(exept for promoting pawns). But there are still no legal checks, this will be the next thing to add.

0
0
1
Loading more…

Followers

Loading…