Posts

Showing posts from June, 2025

Chess Devlog: Huge Performance Improvements

Image
 I just released v2.0.3 of  https://github.com/brighamskarda/chess . And it has some huge improvements. It went from taking over 20 seconds to calculate perft 6 from the staring position to taking just 6.5 seconds with profile guided optimization enabled. Here are some of the changes I made. Performance Improvements Remove Square Validation There were three bitboard functions that had squares as parameters. Bitboard operations are meant to be low level and are called quite often. Removing the bit of code that checks if a square was valid in these functions was technically a breaking change, but it was reasonable tradeoff of speed vs correctness. Reducing Slice Growths This was definitely one of the biggest gains in performance. By pre-allocating all the memory a slice might need on creation I was able to eliminate a ton of expensive slice growths in the move generation sections of my code. Before Optimization moves := make ( [ ] Move , 0 ) moves = append ( moves , pawnMov...

Chess Devlog: Perft Testing

 Just wanted to give an update on a cool little thing I learned about recently.  phaul21  brought to my attention that I had no perft testing in my library. Perft testing is essentially generating a tree of positions based on all the legal moves that can be made. Then by counting the leaf nodes you can compare the results of your move generation to others. If they differ you have likely made a mistake as either too many, or too few moves are being generated. And when you are generating 6 or more moves deep you are looking at hundreds of millions of possibilities, so the chances of getting a false positive are fairly low. In my mind the big advantage of this new test was ensuring that my move generation did not generate too many moves. PGN parsing does a pretty good job of making sure I don't generate too few moves. The code itself was fairly simple to implement: func TestMovegenPerft ( t * testing . T ) { perftTesters , err := parsePerftFile ( ) if err != nil ...

Introducing Chess V2: A New Chess Library in Golang

This has been a project I've been working on for a good bit now, and I'm finally excited to announce version 2.0 of my chess library written in Golang. I've learned a ton from this project, and I'm excited to share it with the world. Repo -  https://github.com/brighamskarda/chess Docs -  https://pkg.go.dev/github.com/brighamskarda/chess/v2 Performance Version 2 was pretty much rebuilt from the ground up and is overall much more organized and performant. The best maintained chess library currently available in Golang is  CorentinGS/chess , and I am pleased to say that in most benchmarks my library equivalent in speed. In fact, the move generation (arguably the most important metric) in my library is up to 40% faster (sometimes even more)! Legal Move Generation Performance Postition brighamskarda CorentinGS Starting 2820ns 4448ns Midgame 6026ns 9987ns Endgame 2167ns 4468ns My library does use more heap allocations overall though, which may reduce performance in larger env...

Final Fantasy IX - Game Review

Image
 Recently I finished playing Final Fantasy IX and I wanted to share some of my thoughts. It's a game I've always wanted to play. Its art style and old-school fantasy theme are things that were always appealing to me. I wanted to see what the game was about and if it stood up to the online reviews. The first part of this review will be spoiler free. My thoughts are that it was a good game, though I am hesitant to give it the same praises I gave to  Final Fantasy VI . Let's start with what I liked. The Good The Battle System I honestly enjoyed the battle system in this game a lot. There's nothing too flashy about it, but it's consistently fun. There will be a lot of comparisons to Final Fantasy VI in this review, but in this case it is favorable. The Final Fantasy VI battle system was largely just spamming your most powerful spells over and over. Definitely one of the weaker points of that game. Final Fantasy IX adds a lot more nuance to the battles. First, attacks ta...

Ride Report - June 3, 2025: Little Salt Lake, Parowan Petroglyphs, and Frisco Kilns

Image
This was a bigger ride. I wanted to take the opportunity to ride to southern Utah before it got too hot. The weather was fantastic. It was 75 degrees and sunny pretty much everywhere. The original plan was just to see the Frisco Kilns, but the Parowan petroglyphs were so close I decided to extend my trip a little bit. In total it was just under 500 miles. I left at 9:40am and returned at 8:00pm. Map data ©2025 Google Little Salt Lake Just outside Parowan is the little salt lake. It was mostly fenced off. If you ever wonder what the great salt lake will look like in 30 years, here ya go. Parowan Gap Petroglyphs This was a neat little attraction. I was a little surprised by how nice the amenities were. There were many descriptive signs, a well-maintained path, benches with shade, and a vault toilet. I'm not complaining, but it seemed a little overkill considering there were only 4 or 5 good petroglyphs. It's not like every rock had carvings in it. Still, it was something fun to s...