int main(int argc, char** argv){ Parameters param(argc, argv); srand(param.seed); RAMFeatures ramFeatures; BPROFeatures bproFeatures(param.gameName); vector<vector<vector<float> > > w; loadWeights(param, &bproFeatures, w); ALEInterface ale(0); ale.setInt ("random_seed" , param.seed); ale.setInt ("max_num_frames_per_episode", 18000 ); ale.setBool ("color_averaging" , true ); ale.setFloat("frame_skip" , 1 ); ale.setFloat("repeat_action_probability" , 0.00 ); ale.loadROM(param.romPath.c_str()); for(int i = 0; i < 2 * NUM_BITS; i++){ frequency.push_back(0.0); } int totalNumFrames = 0; for(int episode = 0; totalNumFrames < MAX_NUM_FRAMES; episode++){ totalNumFrames = playGame(ale, &ramFeatures, &bproFeatures, w, param, totalNumFrames, episode); totalNumFrames += ale.getEpisodeFrameNumber(); } return 0; }
int main(int argc, char** argv){ //Reading parameters from file defined as input in the run command: Parameters param(argc, argv); srand(param.getSeed()); //Using Basic features: RedundantBPROFeatures features(¶m); //Reporting parameters read: printBasicInfo(param); ALEInterface ale(param.getDisplay()); ale.setFloat("repeat_action_probability", 0.00); ale.setInt("random_seed", param.getSeed()); ale.setFloat("frame_skip", param.getNumStepsPerAction()); ale.setInt("max_num_frames_per_episode", param.getEpisodeLength()); ale.loadROM(param.getRomPath().c_str()); //Instantiating the learning algorithm: SarsaLearner sarsaLearner(ale, &features, ¶m,param.getSeed()); //Learn a policy: sarsaLearner.learnPolicy(ale, &features); printf("\n\n== Evaluation without Learning == \n\n"); sarsaLearner.evaluatePolicy(ale, &features); return 0; }
int main(int argc, char** argv){ ALEInterface ale(1); if(argc != 4){ printf("Usage: %s rom_file path_to_save_bits seed\n", argv[0]); exit(1); } int seed = atoi(argv[3]); ale.setInt("frame_skip", 5); ale.setInt("random_seed", seed); ale.setInt("max_num_frames_per_episode", 18000); ale.setFloat("repeat_action_prob", 0.00); ale.loadROM(argv[1]); string outputFile = argv[2]; srand(seed); ActionVect actions = ale.getLegalActionSet(); RAMFeatures features; vector<bool> F; ofstream outFile; outFile.open(outputFile); int reward = 0; F.clear(); features.getCompleteFeatureVector(ale.getRAM(), F); for(int i = 0; i < F.size(); i++){ outFile << F[i] << ","; } outFile << endl; while(!ale.game_over()) { reward += ale.act(actions[rand() % actions.size()]); F.clear(); features.getCompleteFeatureVector(ale.getRAM(), F); for(int i = 0; i < F.size(); i++){ outFile << F[i] << ","; } outFile << endl; } printf("Episode ended with a score of %d points\n", reward); outFile.close(); return 0; }