-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKnowledge.cpp
61 lines (49 loc) · 1.13 KB
/
Knowledge.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
51
52
53
54
55
56
57
58
59
60
61
#include "Knowledge.h"
#include <iostream>
#include <sstream>
#include <iterator>
#include <numeric>
int Knowledge::_currentAge = 0 ;
long long int Knowledge:: _currentTime = 0;
using namespace std;
/*
vector <string> Knowledge::names ;
long long int Knowledge::_currentTime = 0;
void Knowledge::nameFile()
{
srand(time(NULL));
ifstream file;
// Imiona
file.open("data/names_men.csv");
copy(istream_iterator<string>(file),
istream_iterator<string>(),
back_inserter(names));
file.close();
}
/*
string Knowledge::name()
{
printf("imie %s ", names[rand() % names.size()]); /// WTFFFFFFFFFFFFFFFFFFFFFFF
return names[rand() % names.size()];
}*/
float Knowledge::chanceToFailure( )
{
long long int time = currentTime();
if(time %10==0) return .002;
else return .002;
}
void Knowledge::newYear()
{
// Obliczanie roku odsiadki
long long int t = currentTime();
_currentAge = (t / YEAR + 1);
}
float Knowledge::chanceToDie()
{
int age = currentTime();
if(age < 5) return .002;
else if(age < 10) return .0002;
else if(age < 15) return .00002;
else if(age < 20) return .0002;
else return .002;
}