Hey guys.
Like I said in the past, I program things when I get bored. So what I did was program a real time simulation of CC. It's still in the infancy stages.
Here's what needs to be done:
-Add data for all the buildings
-Incorporate player money
-Incorporate levels
Right now it is taking the buildings that have been added into the data. The buildings that I added into the data are "Laundromat", "Pizza Parlor", and "Gas Station". It calculates the best ROI of every possible upgrade and construction. If there is no upgrade going on, it does that upgrade. If there is no construction going on, it will do the construction with the best ROI. The entire program runs off an infinite loop which updates every building a lot of times per second.
Building collections run off milliseconds. The seconds for collection is multiplied by 1000 and added to the current time of the system. When the building is updated and the system time is equal to or greater than the collection time, the building is flagged for collection. When the update hits it again, the money is collected and a new collection time is calculated.
The system is perfect in the fact that there are no glaring logical or semantic errors right now. The only problem is the tiresome input of data.
Here is a string of data I use for defining a laundromat, and why it is so tiresome:
The array locations are as follows:Code:Laundromat 0 6 17 33 55 83 121 171 231 303 413 30 75 338 7200 21600 43200 64800 86400 172800 216000 100 167 278 465 777 1298 2169 3622 6049 10102 300
data[0] - name (String)
data[1] - unlock level (integer)
data[2-11] - payout (integer)
data[12-21] - upgrade time in seconds (integer)
data[22-31] - upgrade cost (integer)
data[32] - collection period in seconds (integer)
Every building is set into an array in java, 2 of each. A player is defined to have every building from the start, and buildings cannot be necessarily "removed" or "destroyed". The only way for them to make collection or be completed in any way is for the player to build them. This will increase their level to 1 instantly, allowing them to be seen by the update method which tracks if they're done or not.
The program current spits out only about a little bit of useful data at the moment. Most of the program is jargon that lets me know if the timers are working correctly and that there are no logical errors in the code (Code that is semantically correct, but doesn't perform the necessary actions that were intended).
The algorithm (as previously defined) is to pick the lowest construction/upgrade ROI and build/upgrade that particular building. While this is not a perfect simulation in that aspect, it will pick the lowest ROI and only pick the one that is the lowest. I am thinking of implementing a feature of only picking the lowest one that can be afforded at the time, or just saving up until the lowest ROI regardless becomes available.
Like I said, there still needs to be the implementation of more buildings, and other features. I worked long and hard on this just for the sake of it, but if anybody who wants to see the code wishes, just drop me a PM and I'll be glad to share it if you don't mind a million debug areas commented out. Don't worry, my code is very neat and has very good conventions.