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
The most common C features in C GNU Chess that needed converting to Java:
- primitive typedefs
- better readability and type-checking by using
long. I started using Java classes for these typedefs, but
BitBoardoperations much be fast, and I’ve have to deal with translating between the different semantics for assignment of primitives and objects.
- most were just constants; I made functions for most of the others, except a few like
CLEARBITthat seemed easier to inline.
- primitive reference parameters
- I used the return value if possible; otherwise I passed the params in an array.
- only a few of these we hard to convert; Java 5’s
- something else that’s available in Java 5
- implicit bools
- I can’t count how many times I converted “
if (c)” to “
- Java doesn’t have
goto, but it does allow labels on
continue, which sometimes resulted in creating dummy loops just so I could use a labeled
breakinstead of a