-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr_main.cpp
50 lines (35 loc) · 863 Bytes
/
r_main.cpp
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
39
40
41
42
43
44
45
46
47
48
49
50
#include "Tax_PGG.h"
#include <unistd.h>
using namespace std;
int do_once(double r, double beta, double T, double Gp){
printf("Now doing Tax_PGG with (r,beta,T,Gp) = (%f,%f,%f,%f)\n",
r,beta,T,Gp);
char file_n[100];
sprintf(file_n,"r_%04d_b_%04d_T_%04d_G_%04d.dat",
(int)((r + 0.000001) * 100),
(int)((beta + 0.000001) * 100), (int)((T + 0.000001) * 100),
(int)((Gp + 0.000001) * 100));
FILE *file;
file = fopen(file_n, "r");
if (file) {
fclose(file);
printf("file:'%s' exists\n",file_n);
usleep(100000);
return 0;
}
file = fopen(file_n, "w");
fclose(file);
Tax_PGG gameOBJ(r,beta,T,Gp);
gameOBJ.game(true);
return 0;
}
int main(int argc, char** argv){
srand(time(NULL));
double T = 0.2;
double beta = 0.9;
double Gp = 1;
for(double r = 3.0; r < 5.01; r += 0.02){
do_once(r,beta,T,Gp);
}
return 0;
}