comp-b-cw1/mainDLA.cpp

56 lines
1.4 KiB
C++

#include <iostream>
#include <stdio.h>
#include <vector>
#include <math.h>
#include <string>
#include "DLASystem.h"
using std::cout;
using std::endl;
// this is a global pointer, which is how we access the system itself
DLASystem *sys;
Config::Config(int argc, char **argv) {
if (argc != 4) {
exit(1);
} else {
this->seed = std::stoi(argv[1]);
this->stickProbability = std::stod(argv[2]);
this->maxParticles = std::stoi(argv[3]);
if (stickProbability <= 0 || stickProbability > 1) {
exit(1);
}
std::stringstream str;
// Ensure the output file name contains all information required to replicate data
str << "./out-" << seed << '-' << stickProbability << "-" << maxParticles << ".csv";
std::ofstream csv_out(str.str());
this->csv = std::move(csv_out);
this->csv << "frame" << "," << "x" << "," << "y" << std::endl;
}
}
int main(int argc, char **argv) {
Config config(argc, argv);
cout << "Seed: " << config.seed << ", Stick P: " << config.stickProbability << endl;
// create the system
sys = new DLASystem(std::move(config));
sys->setRunning();
/*
* NOTE: We run at max speed as rendering is handled by a different engine so we simply want to hjand
* */
while (sys->running) {
sys->Update();
}
cout << "hey" << endl;
return 0;
}