Rhododendron Bluffs at Duke Forest

Duke Forest Trail

Rhododendron Bluffs at Duke ForestThe rhododendrons at the Rhododendron Bluffs at Duke Forest off Whitfield Rd. are in bloom these days. It was hard to get a decent photo since the plants are scattered along the hillside and they don’t get enough sunlight to have spectacular flowers. The trails, bluffs and the creek are plenty to make the trip worthwhile, and having the rhododendrons in bloom is just a bonus.

To get to the bluffs take the first Duke Forest entrance on Whitfield if you’re coming from Old Erwin. Then go left when the trail forks, and you’ll come out at the top of the bluffs. Google satellite map

Rhododendron at Duke Forest

Chess Tourney Round 3

I got very lucky in this game yesterday. I started out well, I thought, with a strong center and plenty of room for my pieces. If only I knew how to turn those advantages into something tangible. Black soon challenged my center with d5, and the center stayed fairly tense throughout the middle game. Computer analysis showed many suboptimal moves which resulted in slight advantages that swung from one player to the other.

Black traded a knight for my two central pawns, which I thought was to my advantage though the computer shows it was a good trade for Black. He probably needed to work on advancing his passed pawns to make the trade worthwhile, though. At left, is a typical position of the middle game. I thought for a while and moved Bf3, but the computer suggests f4 instead. Eventually I figured out I should use my extra piece to try to win trailing pawns and got into a decent position, but was very short on time. Black kindly dropped a rook with my clock under two minutes, and I barely had enough time to mate him–only four seconds to spare. Very lucky.

GNU Chess/Java Starts to Run

I decided to go ahead and convert the remaining printf() calls (too chicken to try switching to Java 5 at this point) and ignore the signal() calls so I could try running GNU Chess/Java. The signal() calls are only used for handling control-C to allow interupting of the think process. Not sure what the Java equivalent would be.

For a while, I would get early crashes when trying to run. Usually these were NullPointerExceptions due to uninitialized array members. IndexOutOfBounds errors were a little trickier to fix, and for one of them I had to actually run the C version to compare values. Turns out the array index was -1 there, too! I’ve already marked a half dozen or so places where the C code looks suspicious, so I think this effort will unearth a few problems in the original source.

There were a couple of errors to get around when trying to build the C version, which I’m guessing are due to different versions of the developer tools on Mac OS X 10.4. There is also a problem running the C version. It seems to process one command and then get a bus error. Coincidentally, the Java version has a similar problem. After processing one command, it gets lost trying to look for more input — there’s some threading issue going on.

The program has some self-test commands that I was able to use to compare speeds. The Java version appears to be about half the speed of the C version. Some results

Test C Java
movegen 34M moves/sec 16M moves/sec
eval 217K evals/sec 110K evals/sec

Not bad.

Other tests, which actually try to find the best moves, are crashing …. If I can get past that, I may need a catchy name for this project. Jnuchess?

Cannabilistic Blue Jay

Killer Blue JayI knew blue jays were agressive but didn’t know they ate other birds! I saw this jay snatch something off the ground that I thought looked like a small critter or maybe a baby jay being rescued. Then it landed on a branch and proceeded to pick at the prey, and I could see the feathers falling to the ground. He wouldn’t let me get too close (flying off with its prey to another tree), but I managed to get a half-decent photo, as shown on the right. You can see the silhouette of the dead bird hanging below the blue jay. (Thanks to Anli for enhancements to original photo.)

Tiger Installed

After two delayed attempts, I got Mac OS X 10.4 “Tiger” installed tonight. On the first attempt I was slowed by Apple’s lame back-up application, creatively called “Backup”. It seemed to re-scan everything whenever I added or removed a folder to back-up and then tried to solve a packing optimization problem to figure out how many discs I would need. After figuring out that I needed four DVDs and preparing the staging area for them, it turns out it couldn’t write to my DVD-R discs. There are so many DVD-xyz formats, I don’t know if it’s a legitimate failure or not. The next day, I realized I could just copy the critical files to an external hard drive as a back-up. D’oh.

Finally, I was ready to install, but the installer determined (after a long scan) that the installation DVD was bad. After several retries, troubleshooting using Apple’s support web site and a web search, I realized I my DVD belonged to the “bad batch” that had been sent out. I tried to call Apple for a replacement, but their phone support was closed for the night. Today I borrowed another install DVD from Michael, and it worked fine. I also called Apple about a replacement. After 20 minutes on hold and 30 minutes with a tech support person, I think I’m getting a replacement disc sent. At least that’s what he said before the connection was inadvertantly broken on my end. BTW, that was my first call to Apple tech support in 21 years of Mac ownership.

It occurs to me that Apple has really figured out how to make money. I already pay them $100/year for .Mac, which is of little benefit, and I still have to pay $130 for a minor OS upgrade. And my previous purchase of Quicktime 6 Pro gets wiped out with Quicktime 7–not sure if I’ll get the Pro upgrade again. To top it off, my main motivation for upgrading was to get Java 1.5, which Sun gives away for free for other platforms, so I’m paying Apple for Sun’s product.

C to Java

I’ve almost finished the mostly-mechanical first pass of converting the C GNU Chess code to Java syntax. I haven’t tried to compile yet, but there’s about six files out of thirty-plus that IDEA (world’s greatest IDE) says contain syntax errors. Most of them are complicated printf() calls that I put off, thinking I might just start using Java 5, which comes with a printf() of its own. Also remaining are some threading issues like the use of the signal() function.

The most common C features in C GNU Chess that needed converting to Java:

primitive typedefs
better readability and type-checking by using BitBoard instead of long. I started using Java classes for these typedefs, but BitBoard operations much be fast, and I’ve have to deal with translating between the different semantics for assignment of primitives and objects.
macros
most were just constants; I made functions for most of the others, except a few like CLEARBIT that seemed easier to inline.
primitive reference parameters
I used the return value if possible; otherwise I passed the params in an array.
printf and scanf
only a few of these we hard to convert; Java 5’s printf will help
enum
something else that’s available in Java 5
implicit bools
I can’t count how many times I converted “if (c)” to “if (c!=0)
goto
Java doesn’t have goto, but it does allow labels on break and continue, which sometimes resulted in creating dummy loops just so I could use a labeled break instead of a goto.