-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_functions.cpp
123 lines (112 loc) · 2.07 KB
/
game_functions.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "game_functions.h"
float calc_naucenost(long answer_time){
float points = 1.0;
if(answer_time < 3000){
float add = 3.0;
add *= 3000.0 - answer_time;
add /= 3000.0;
add *= 3000.0 - answer_time;
add /= 3000.0;
points += add;
}
if(answer_time > 3000){
points -= ((float)(answer_time - 3000)) / 20000.0;
}
if(answer_time > 23000){
points = 0.0;
}
return points;
}
int get_displayed_num(int mode, DataList next){
int res = 0;
if(next.multiplication){
switch(mode){
case 0:
res = (next.x + 1)*(next.y + 1);
break;
case 1:
res = ((next.x + 1)%10 +1)*(next.y + 1);
break;
case 2:
res = (next.x + 1)*((next.y + 1)%10 +1);
break;
case 3:
res = (next.x + 1)*((next.y - 1 + 10)%10 +1);
break;
case 4:
res = ((next.x - 1 + 10)%10 +1) * (next.y + 1);
break;
case 5:
res = (next.x + 1)*(next.y + 1) - 5 + random(10);
break;
case 6:
res = random(100);
break;
case 7:
res = (next.x + 1)*(next.y + 1) - 3 + random(7);
break;
case 8:
res = ((next.x + 1)%10 +1)*(next.y + 1) - 3 + random(7);
break;
case 9:
res = ((next.x - 1 + 10)%10 +1)*(next.y + 1) - 3 + random(7);
break;
}
if(res == (next.x + 1)*(next.y + 1) && mode != 0 || res < 0 || res > 100){
res = random(100);
}
}else{
int y = (next.y + 1);
switch(mode){
case 0:
res = y;
break;
case 1:
if(y - 1 > -1){
res = y -1;
}
break;
case 2:
if(y - 2 > -1){
res = y -2;
}
break;
case 3:
if(y - 3 > -1){
res = y -3;
}
break;
case 4:
if(y + 1 < 11){
res = y + 1;
}
break;
case 5:
if(y + 2 < 11){
res = y + 2;
}
break;
case 6:
if(y + 3 < 11){
res = y + 3;
}
break;
case 7:
if(y - 1 > -1){
res = y -1;
}
break;
case 8:
if(y + 1 < 11){
res = y + 1;
}
break;
case 9:
if(y + 2 < 11){
res = y + 2;
}
break;
}
}
return res;
}