|Re: Stars! Nova 0.4.0 (developmental) Release
||Wed, 30 June 2010 13:09 |
Registered: March 2004
|I've finished the Java version. It's taken from the C version. I think my decompiled flash version had some bugs, or my implementation of it did. I have unit tests for this code testing it against Humanoids, Humanoids with all Immune, Rabbitoids and Insectoids. I could do more but I got bored entering in all that data. |
Rather than posting the whole thing I put up a couple files on my website:
The RacePointsCalculator class. It has one static method that takes a Race class instance, and returns the advantage points for that race.
// the Race class, has the planet habitability calc
// The Hab class, for storing planet and race habitability
// The ResearchCost class, used by the race
// Finally the Consts class used to store constants, in this case just the starting points
I've peppered the code with comments, though it could probably use a "overview" type comment on the algorithm. I've also changed the code around a bit to make it more readable. The C version was full of int arrays that I changed to Hab instances.
To convert it to C# you should just need a regex to convert get([A-Z]) to $1. Damn java and it's stupid get/set methods.
Anyway, let me know if you have any questions.
Report message to a moderator