} // end of loadFilesInGame /* * save the tables in text files */ void saveFilesInGame() { if (coadapt) { //save both files fileManager.writeFile(relativePath + "/Results/Prey/coadapt/Qtable/", "preycoadaptQ", preyQlearning.printQTable()); fileManager.writeFile(relativePath + "/Results/Prey/coadapt/states/", "preycoadaptStates", preyStateArray.printStates()); fileManager.writeFile(relativePath + "/Results/Prey/coadapt/reward/", "preycoadaptreward", preyQlearning.printRewardList()); fileManager.writeFile(relativePath + "/Results/Prey/coadapt/timer/", "preycoadapttimer", timerToString(timePrey)); fileManager.writeFile(relativePath + "/Results/Predator/coadapt/Qtable/", "predatorcoadaptQ", predatorQlearning.printQTable()); fileManager.writeFile(relativePath + "/Results/Predator/coadapt/states/", "predatorcoadaptStates", predatorStateArray.printStates()); fileManager.writeFile(relativePath + "/Results/Predator/coadapt/reward/", "predatorcoadaptreward", predatorQlearning.printRewardList()); fileManager.writeFile(relativePath + "/Results/Predator/coadapt/timer/", "predatorcoadapttimer", timerToString(timePredator)); } else if (preysolo) { // save prey files fileManager.writeFile(relativePath + "/Results/Prey/solotrain/Qtable/", "preysoloQ", preyQlearning.printQTable()); fileManager.writeFile(relativePath + "/Results/Prey/solotrain/states/", "preysoloStates", preyStateArray.printStates()); fileManager.writeFile(relativePath + "/Results/Prey/solotrain/reward/", "preysoloreward", preyQlearning.printRewardList()); fileManager.writeFile(relativePath + "/Results/Prey/solotrain/timer/", "preysolotimer", timerToString(timePrey)); } else if (predatorsolo) { //save predator files fileManager.writeFile(relativePath + "/Results/Predator/solotrain/Qtable/", "predatorsoloQ", predatorQlearning.printQTable()); fileManager.writeFile(relativePath + "/Results/Predator/solotrain/states/", "predatorsoloStates", predatorStateArray.printStates()); fileManager.writeFile(relativePath + "/Results/Predator/solotrain/reward/", "predatorsoloreward", predatorQlearning.printRewardList()); fileManager.writeFile(relativePath + "/Results/Predator/solotrain/timer/", "predatorsolotimer", timerToString(timePredator)); } } // end of save files
} // end of resetAgents void saveFiles() { // save prey files fileManager.writeFile(relativePath + "/Results/Prey/solotrain/Qtable/", "preysoloQ", preyQlearning.printQTable()); fileManager.writeFile(relativePath + "/Results/Prey/solotrain/states/", "preysoloStates", preyStateArray.printStates()); fileManager.writeFile(relativePath + "/Results/Prey/solotrain/reward/", "preysoloreward", preyQlearning.printRewardList()); fileManager.writeFile(relativePath + "/Results/Prey/solotrain/timer/", "preysolotimer", timerToString(timePrey)); }