stockpanda
- 24 Devlogs
- 23 Total hours
open source chess engine
open source chess engine
did a final run-through of the app, tweaked some settings, deployed, and created a banner in Figma!
implemented two pieces of polish:
these changes were not too difficult, but I did run into a couple of bugs. i think i’m ready to ship! not much i think i can add at this point.
implemented difficulty levels! they just adjust the search depth and the maximum time spent. pretty simple to implement!
made the move history travel-able! now, you can go backwards and forwards through the game’s history. there were bugs with this feature, but it works perfectly now!
added more customization! there are now more options for customizing the time, board, piece, and now sound themes. this wasn’t too difficult; just tedious.
deployed this on Vercel! had to change a couple of things and vercel had some issues with the build, but i got it figured out! go to stockpanda.vercel.app!
implemented premoves! now you can make moves before the engine makes a move; similar to chess.com and lichess.org. i couldn’t get a screenshot cause it takes some time, so try it out yourself!
added board annotations! if you’ve ever used chess.com or lichess, you would know you can highlight squares and draw arrows. now, you can do that on stock panda! implementing this was a lot easier than i thought, ngl. pretty smooth sailing.
made it responsive on mobile! i came across a lot of bugs with it not working but i eventually got through the bugs. to accomplish this, i also ended up adding functionality to make moves by clicking instead of dragging. some people like it that way.
implemented a notation system on the side, similar to how chess.com andlichess.org do it. pretty simple, other than visual bugs with weird scrolling problems. super clean tho!
implemented custom themes! now you can fully customize the look and feel of your chess game against Stock Panda! I love how intuitive the UI/UX is
implemented a clock! now you can play rapid, blitz, and bullet games with my chess engine!
transformed the UI of the application. added extremely satisfying sounds that im genuniely so proud of. made it look like chess.com cause people recognize that. also, you can choose to play as black or white, which is really cool! finally, there are now animations for the computer’s moves.
implemented phase-based evaluation!
essentially, the engine changes based on the phase of the game (opening, middlegame, endgame). for example, you want to have your king active in the endgame but safe in the opening. thats what this change does!
implemented endgame tablebases!
essentially, chess is solved with 7 pieces or fewer. so instead of trying to calculate the perfect move in a complicated position, we can just look it up in a precomputed database of all positions with 7 pieces or fewer. this is a huge boost for endgame play, and also lets the engine play perfectly in those positions instead of relying on heuristics. the syzygy tablebases are the standard in the chess programming community, so i used them!
implemented an opening book!
essentially, for common openings, the engine has a file of the best moves in those common positions. this makes it a lot better (and faster) at the opening stage.
implementing it was pretty difficult because of some issues with the book file, but it eventually worked!
implemented transition tables!
essentially, transition tables cache evaluations to reuse if the position is achieved through a different set of moves (transposition).
implemented quiessence search!
basically, the engine keeps searching until the position becomes stable. for example, lets say the user can trade queens on move 5. it would see that and think that line is winning, but fails to see past move 5 where the opponent can recapture the queen. this 5-depth barrier is known as the horizon effect!
creating logo for stockpanda! it looks pretty cool to me, ngl. made in Figma. pretty simple but straight to the point. modeled after stockfish logo
added iterative deepening!
essentially, it has a max thinking time and thinks as much as possible in that time. this makes it way faster!
added alpha-beta pruning! basically, if a branch in the tree is already bad, then my engine stops looking at the line (ex: blunders queen on move one, no need to look at that line).
only 26 lines changed, but it was difficult to implement and i kept facing errors.
basic minimax algorithm implemented with piece values and piece square tables to make it decently accurate
created the board and legal move logic!
took notes on chess engine design and created a course of action