Running The Simulator - AdamVD/Prisoners_Dilemma_Simulator GitHub Wiki

Getting Files Set Up

After cloning the repository to your desired location, there should be little or no set up required to get the simulator up and running. The unit testing class located in src/model/EvoTests.java requires the JUnit JARs to run. If you do not already have this in your Java library you may choose to download them from here. You may also choose to simply delete this testing class if you are only interested in running the simulator.

Running with the Text UI

Currently the only choice for running the evolutionary simulator is through a text user interface. A graphical UI will be released with version 2.0.0. This text UI relies on changing the simulator's parameters directly in the UI's source code. The text UI can be found in src/console_UI/EvolutionTUI.java. Open this file and reference the documentation accompanying each field to change the parameters of your simulation. More information is also provided below:

Adding Prisoners

You may add and remove prisoners to the simulation in the static block beneath the prisonerInitialization field. Follow the provided format for adding your own prisoners to the simulation. Your custom prisoner class must exist within the Strategies package. It must also contain a default constructor (no parameters). See Creating a Prisoner Strategy if your prisoner is not working properly.
final static HashMap<String, Integer> prisonerInitialization = new HashMap<>();
static{  // add values to the map with the format ("strategy_name", integer number of this type)
    prisonerInitialization.put("AlwaysExploit", 600);
    prisonerInitialization.put("AlwaysExploit", 500);  // only the second entry persists into the simulation
    prisonerInitialization.put("TitForTat", 950);
    prisonerInitialization.put("PermanentRetaliation", 0);  //zeroed entries are ignored
}

Once you change the fields contained in the class to your liking you are ready to go, run the main method and the simulation will begin! During simulation you will be prompted at the end of each generation to stop the simulator Q, move on to the next generation N, or simulate as fast as possible until you manually stop the program F. Keep in mind that most simulations end within only a few generations, and that the program will not automatically stop when one strategy wins (takes over the entirety of the population). Version 2.0.0 will introduce automatic stopping and minimum generation time.

⚠️ **GitHub.com Fallback** ⚠️