Now database management proceeds to occur.
With new implementations, come new buttons in our GUI.
Our Score button has been removed, scoring is now automated with export, an image does not leave the program without being scored.
This leaves room for additional buttons
- View Cells: Which prints out the name of the cellular automata and the score given in the Eclipse console.
- Delete Bad: Which removes all automata with scores of zero from the database.
- Delete All: Which completely clears the Cells table and all values in it.
Below, we see how all these buttons can work together. We can see the automata that have been automatically exported to the database. Afterwards, we can purge the worst scores and view them again. Finally, we can delete everything altogether.
Now that things are in our database, and we understand how to manipulate them, I can move on to the next step, actually reading things from our database back in and mutating the rulesets.
This is going to be a complex process, so before I start, I will begin to map out the steps I will have to go through to make this work.
- Read in the file
Only read in the good scores, is there an SQLite Query for this?
- Parse the rules into a new Cell() object
A new parsing object will need to be created that will take in the fields of the chosen automata, and put them back into the dictionary formats that the program can understand.
Cell() will need to be modified to take in these dictionaries to create a new Cell() object.
- Mutate the new Cell() object
Call Cell.change() for our new cell. This pre-existing function will mutate it.
- Create the Cell() object as an image
This is potentially the most complex step, as a lot of things went into making cellular automata to appear on the screen.
MainController needs to set its global seeds and cells values to be the newly created cells.
drawColorAutomata() should be called.
Everything happening in the fetchButton() needs to happen, except where it gets iterations from the GUI. The iterations need to be the ones from our automata instead.
- Score said image
Scoring should not iterate through all the images, but only score the one on the screen.
- Put back in database with new name
This new score, and the new rules, should be put in the database with a new unique automata name.
This link looks helpful: http://www.sqlitetutorial.net/sqlite-java/select/