-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·227 lines (193 loc) · 5.71 KB
/
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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#include <iostream>
#include <limits.h>
#include "system.h"
unsigned int InputSeed ();
int main(int argc, char ** argv) {
//unsigned int seed = InputSeed ();
//System_Generator sg(seed);
//sg.show();
for(unsigned int i = 100; i < 200; i++) {
System_Generator *sg = new System_Generator(i);
sg->show();
std::cout << std::endl;
delete sg;
}
auto rg = Random_Generator(2);
int count[50] = {};
for (unsigned int i=0; i < 1000000; i+=1)
{
//double t = rg.get_composed_gaussian(0.5, 0.2);
double t = rg.gaussian(0.5, 0.2) * 50.0;
if (t < 0 or t >= 50)
continue;
count[(int)t] += 1;
}
int maxCount = 0;
for (unsigned int i = 0; i < 50; i++) {
if (count[i] > maxCount) {
maxCount = count[i];
}
}
std::cout << maxCount << std::endl;
double a = 50.0/maxCount;
for (unsigned int i = 0; i < 50; i++) {
//std::cout << count[i] << std::endl;
std::cout << i/50.0 << ": " << std::string(count[i] * a, '*') << std::endl;
}
return 0;
}
//#define DISPLAY_PLANETS_CARAC true //put the value to true and every planet characteristics get display
//#define DISPLAY_START_CARS true //true displays every planet characteristics
//
///*1: 27.9657 kPa O2 = Breathable oxygen.
// „1¤72: 13.98285 kPa O2 = Below allowed O2 pressure (16 kPa) and very close to hypoxia (13.3 kPa). Humans won't survive much time.
// „1¤73: 55.9314 kPa O2 = Above allowed O2 pressure (50 kPa), oxygen is toxic. Humans won't suvive much time.
// „1¤74: 139.8285 kPa O2 = Above allowed O2 pressure (50 kPa), oxygen is highly toxic. Human will die in some minutes (an hour?).*/
//
//
//using namespace std;
//
//enum {O0, I, II, III, IV, V};
//enum {O, B, A, F, G, K, M, D, INDETERMINE};
//
//
////wtf multi star brown dwarf etc 148
////11321 crash //repaired
////87731 crash //repaired
////109171 crash //repaired
//
////28004 Supergiant
////17111 Hypergiant
////close binary hypergiant 26218 (too close)
////19011 Hypergiant
//
////26527 Double giant habitable
////6984 Habitable moon 700 118501
////33606 Class O
////542 close double habited
////657 distant double habited
////7255 Extended double system
////70434 Big system
////87288 Habitable moon
////108356 Habitable puffy giant
////109928 6 jupiterian
//
////14369 outer limit in inner limit
//
////TODO : tidal locking -> system age
////TODO : atmosphere
////TODO : better moon generation
//
////TODO : correct crossing orbits
////5403 broken habitable zone WATAFUCK
//
//
//int main () {
// unsigned int Seed = time (NULL)%120000;
//
// srand (Seed);
// //srand(1047); //lot of crossing orbits
//
// printf ("Seed : %u\n", Seed);
// //876 <--> 906 spe
//
// Star NS = Star ();
// int multipleStars = RandomInt (0, 20);
//
// //multipleStars = 2;
//
// if (multipleStars <= 3)
// {
// CreateMultipleStarSystem (&NS);
// DisplayDoubleStar (NS, DISPLAY_START_CARS);
// }
// else
// {
// CreateStar (&NS);
// PopulatePlanets (&NS);
// DisplayStarCarac (NS);
//
// cout << "\n\n" << endl;
// vector<Planet> ThisSystem = NS.getSystem ();
// DisplaySystemsCaracteristics (NS); //display the system
// cout << "\n" << endl;
// if (DISPLAY_PLANETS_CARAC)
// for (unsigned int i = 0; i < ThisSystem.size (); i++)
// ThisSystem[i].DisplayPlanet (NS.getMass ());
// }
// cout << "\n\n" << endl;
//
// NS.getAsteroidBelt ().clear ();
// NS.getSystem ().clear ();
//
// printf ("Seed : %u\n", Seed);
// return 0;
//}
unsigned int InputSeed ()
{ //ask user to input a seed
unsigned int Seed = 0;
while (1) {
std::cout << "\nEnter Seed INT (positive) : ";
scanf ("%u", &Seed);
if ((std::cin) && (Seed >= 0) && (Seed <= INT_MAX))
break;
std::cin.clear ();
std::cin.ignore (1000, '\n');
std::cout << "Seed invalid, program terminated\n" << std::endl;
exit (-1);
}
return Seed;
}
/*
int* waveLengthToRGB(double Wavelength){
double factor;
double Red,Green,Blue;
if((Wavelength >= 380) && (Wavelength<440)){
Red = -(Wavelength - 440) / (440 - 380);
Green = 0.0;
Blue = 1.0;
}else if((Wavelength >= 440) && (Wavelength<490)){
Red = 0.0;
Green = (Wavelength - 440) / (490 - 440);
Blue = 1.0;
}else if((Wavelength >= 490) && (Wavelength<510)){
Red = 0.0;
Green = 1.0;
Blue = -(Wavelength - 510) / (510 - 490);
}else if((Wavelength >= 510) && (Wavelength<580)){
Red = (Wavelength - 510) / (580 - 510);
Green = 1.0;
Blue = 0.0;
}else if((Wavelength >= 580) && (Wavelength<645)){
Red = 1.0;
Green = -(Wavelength - 645) / (645 - 580);
Blue = 0.0;
}else if((Wavelength >= 645) && (Wavelength<781)){
Red = 1.0;
Green = 0.0;
Blue = 0.0;
}else{
Red = 0.0;
Green = 0.0;
Blue = 0.0;
};
// Let the intensity fall off near the vision limits
if((Wavelength >= 380) && (Wavelength<420)){
factor = 0.3 + 0.7*(Wavelength - 380) / (420 - 380);
}else if((Wavelength >= 420) && (Wavelength<701)){
factor = 1.0;
}else if((Wavelength >= 701) && (Wavelength<781)){
factor = 0.3 + 0.7*(780 - Wavelength) / (780 - 700);
}else{
factor = 0.0;
};
int* rgb = new int[3];
double Gamma = 0.80;
double IntensityMax = 255;
// Don't want 0^x = 1 for x <> 0
rgb[0] = Red==0.0 ? 0 : (int) round(IntensityMax * pow(Red * factor, Gamma));
rgb[1] = Green==0.0 ? 0 : (int) round(IntensityMax * pow(Green * factor, Gamma));
rgb[2] = Blue==0.0 ? 0 : (int) round(IntensityMax * pow(Blue * factor, Gamma));
return rgb;
}
*/