-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (31 loc) · 804 Bytes
/
Copy pathmain.cpp
File metadata and controls
38 lines (31 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <fstream>
#include <cstdint>
#include <cstring>
#include <cstdlib>
#include "parsingArg/parsingArg.h"
#include "bmp/bmp.h"
int main(int argc, char** argv){
Arguments arg = {};
bool d = ParseArguments(argc, argv, arg);
int count = 0;
if(!ParseArguments){
std::cout<<"ERROR";
}
SandPile sandpile = ParseFile(arg.input_file);
while(count!=arg.max_iterations){
scattering(sandpile);
if(stability(sandpile)){
break;
}
if(count % arg.frequency == 0){
saveBMP(arg.output_dir, sandpile);
}
count ++;
}
saveBMP(arg.output_dir, sandpile);
for(int i = 0; i < sandpile.height; ++i){
delete[] sandpile.field[i];
}
delete[] sandpile.field;
}