Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, May 5, 2008

A Long Overdue Update

A few days ago, I compiled and ran GRAY MATTER for the first time in months if not years. Thanks to Jonne, it compiled with only two warnings (unused variables) and soundly defeated me at a few quick games. On my plate for this week: fix those two warnings, then make the transposition table a singleton.

Sunday, September 23, 2007

Java?

After spending some time writing Ruby and Java code, I had a hard time crossing my eyes again to make heads or tails of GRAY MATTER’s C++ code. That got me thinking — is it time to migrate to a more modern programming language?

Ruby’s syntax is beautiful, but it can’t deliver the performance that a chess engine needs. But what about Java? I did some research, and a couple of things scare me:

  • Java doesn’t have an unsigned 64-bit integer type. We’d have to use signed 64-bit integers as BitBoards. Also, the farther we move up from the bare metal, the less we can rely on our low-level bit-twiddling hacks. Who knows what kind of bizarre problems may result.
  • The Java crowd seems a little bit too enthusiastic about Java’s performance, especially when compared to C++. I don’t trust the Java echo chamber.

I guess we’re sticking with C++. I’m discussing this with Doug, and he agrees that we should stay as close to the bare metal as possible.

Sunday, August 19, 2007

Opening Book

GRAY MATTER now uses an opening book. This improvement accounts for the greatest increase in strength since we moved from naive MiniMax to AlphaBeta.

Saturday, August 4, 2007

With a Little Help from My Friends

It must be chess programming season again. We’ve been progressing by leaps and bounds.

Doug schooled me, yet again, in object oriented programming. He split the search class into a base class and an MTD(f) sub-class. This makes for a much cleaner design (by separating the search framework from the actual search engine) and also gives us a nice way to add more implementations of different search engines (and even switch between them at runtime!). Following Doug’s lead, I split the board class into a base class (which includes board representation and move generation) and a heuristic sub-class (which includes current state evaluation).

A couple of days later, Dillon schooled me, yet again, in chess strategy. He explained the concept of tempo. That, combined with Sam’s dirty trick of hard-coding values into arrays, allowed me to quickly implement tempo evaluation as a method of the heuristic sub-class. And GRAY MATTER no longer does the Happy King Shuffle Dance™.

In other news, we’ve just committed our 1000th revision. Thanks for everything, guys. A celebration is in order. You’ve earned it.

Tuesday, June 19, 2007

Next Steps

GRAY MATTER finally plays a decent game, but she’s not quite ready to enter a tournament. To be tournament-worthy, she must:

  • avoid stalemate and pursue checkmate,
  • more intelligently allocate thinking time, and
  • use an opening book.

Tuesday, June 5, 2007

History Heuristic

I’ve re-implemented the history heuristic. It shouldn’t interfere with MTD(f).

Thursday, May 31, 2007

Illegal Moves

When GRAY MATTER knew she’d lost, she used to sometimes make illegal moves and leave herself in check. No longer! Now, in search::minimax(), at the move tree’s root node, she generates only legal moves.

Sunday, May 27, 2007

Remote Testing

I have a MacBook, and I don’t enjoy burning my CPU at 100% and scorching my testicles every time I test GRAY MATTER. I’ve discovered a cool (pun intended) way to run GRAY MATTER on my desktop remotely and XBoard on my laptop locally:

For this to work, you need GRAY MATTER and an SSH server installed on your desktop, and an SSH client and XBoard installed on your laptop. On your laptop, launch a terminal emulator and issue the following command:

xboard -rsh ssh -fh domain.com -ruser username -fcp gray-matter/bin/gray

But replace domain.com with your desktop’s domain name or IP address, username with your username, and gray-matter/bin/gray with the path (either absolute or relative to your home directory) to your GRAY MATTER executable.

Friday, May 11, 2007

One Negative Sign

I’d forgotten one negative sign, which caused GRAY MATTER to pursue draws instead of checkmates! One negative sign! I hate myself.

Thursday, May 10, 2007

Simpler Code

In the move search, I’ve abandoned NegaScout for MTD(f). This has forced several other changes in the code. I’ve discarded the null-move and history heuristics in favor of straight FailSoft AlphaBeta.

The increase in search depth is spectacular, but even better is how much simpler the code has become. Sadly, I don’t think that everything works properly just yet. I’ll keep hacking at it.