-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.cpp
3839 lines (3487 loc) · 160 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include <vector>
#include <array>
#include <cstdlib>
#include <string>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <unistd.h> //Import the sleep function (only works with linux compiler)
#include <thread>
#include <chrono>
#include <functional>
#include <future>
#include <numeric>
#include "libsqlite.hpp"
//#include<Windows.h>
//#include<MMSystem.h>
using namespace std::chrono;
class Star
{
friend class Spaceship;
private:
float _starssurface;
int _starsheat;
int _starsradius;
protected:
char _startype;
int _starsradiation;
int _starsgravitationalforce;
public:
int random_number_generator();
int randRange(int, int);
int getstarsheat();
int getstarsradiation();
int getstartype();
void display_stars_data(std::string);
void define_type_of_star();
void stars_generator();
Star();
};
int Star::random_number_generator(){
int n;
n = (rand()%4 + 1);
return n;
}
void Star::display_stars_data(std::string star_name){
std::string startype;
if(_startype == 1){
startype = "Neutron star";
}
else if(_startype == 2){
startype = "Blue giant";
}
else if(_startype == 3){
startype = "Yellow star";
}
else if(_startype == 4){
startype = "Red giant";
}
std::cout<<"|--"<<star_name<<"--|"<<"\n"
<<"Type of star: "<<startype<<"\n"
<<"Star's temperature: "<<_starsheat<<" celcius"<<"\n"
<<"Star's surface :"<<_starssurface<<" millions of square km"<<"\n"
<<"Star's radiaton level :"<<_starsradiation<<std::endl;
}
int Star::randRange(int low, int high)
{
return rand() % (high - low + 1) + low;
}
void Star::define_type_of_star()
{
_starsradius = randRange(1,800); //In millions of kilometers
if(_starsradius >= 1 && _starsradius <= 250)
_startype = 1;
else if(_starsradius >= 260 && _starsradius <= 500)
_startype = 2;
else if(_starsradius >= 510 && _starsradius <= 750)
_startype = 3;
else if(_starsradius >= 760 && _starsradius <= 800)
_startype = 4;
_starssurface = randRange(100000, 1000000);
}
void Star::stars_generator()
{
define_type_of_star();
//We are going to start by defining the stars heat, this is set in relation to its radius (which in turn determines the kind of star)
if(_startype == 1)
_starsheat = randRange(100000, 200000 ); //We are defining the heat of a white dwarf here in celcius
else if(_startype == 2)
_starsheat = randRange(10000, 20000); //We are defining the heat of a blue giant here in celcius
else if(_startype == 3)
_starsheat = randRange(5000, 7000); //We are defining the heat of a yellow star here in celcius
else if(_startype == 4)
_starsheat = randRange(1000, 5000); //We are defining the heat of a red giant here in celcius
//We proceed with the radiation definition, this is set in relation to its heat
if(_starsheat >= 3000 && _starsheat <= 4000)
_starsradiation = randRange(8, 10); //We are defining the radiation of a white dwarf here
else if(_starsheat >= 2000 && _starsheat <= 3000)
_starsradiation = randRange(6, 7); //We are defining the radiation of a blue giant here
else if(_starsheat >= 1000 && _starsheat <= 2000)
_starsradiation = randRange(3, 5); //We are defining the radiation of a yellow star here
else if(_starsheat >= 0 && _starsheat <= 1000)
_starsradiation = randRange(2, 3); //We are defining the radiation of a red giant here
}
Star::Star(){
_starsradiation = randRange(1, 10);
define_type_of_star();
stars_generator();
}
class Planet: public Star
{
friend class Spaceship;
private:
int _planetsradius;
int _gravitationalforce;
int _planetstemperature;
float _planetssurface;
char _planettype;
bool _rockyorgas;
bool _defeated = false;
std::string _atmospherecomposition;
bool _breathableatmosphere;
bool _magneticprotection;
int _magneticfieldintensity;
int _magneticfieldvsradiation;
int _distancefromstar;
bool _habitable;
bool _potentiallyhabitable = false;
int _rotationangle; //From 90 to 180
std::string _planetname;
int _diamonds; //Diamonds is given as a currency automatically
int _mercury; //It is given in megatons of fuel
int _gas; //It is also given in megatons, along with antimatter it will power the WARP drive
int _metal; //Metal can be classified at will to define the weaponery, space ships and
int _bacteria; //Bacteria will be classified by the game itself in order to determine what kind of bacteria there is
int _humans; //Humans can be classified at will to define the crew
int _antimatter; //Mixed with the gas you can power the WARP drive
int _protozoo; //Amount of protozoo to strengthen the army
int _staphillococcus; //
int _pseudomona;
public:
int random_number_generator();
int random_percentage_generator();
int randRangep(int, int);
int gethabitability();
bool getpotentialhabitability();
char getplanettype();
int getmetal();
int getdiamonds();
int getmercury();
int gethumans();
std::vector<int> getbacteriae();
int getgas();
int gettemperature();
int getplanetsdistance();
int getmagneticfieldvsradiation();
bool getbreathableatmosphere();
int getstaphilloccocus();
int getdistancefromstar();
int getprotozoo();
int getpseudomona();
void turn_into_habitable();
void setmetal(int);
void setdiamonds(int);
void setmercury(int);
void sethumans(int);
void setbacteriae(int, int, int);
void setgas(int);
void defeat();
bool getdefeat();
std::string getplanetsname();
bool element_finder();
void define_type_of_planet();
void define_planetstemperature();
float determine_orbit_eccentricity();
void define_atmosphere_composition();
void define_planets_orbit();
void determine_magnetic_field();
void determine_type_of_bacteria();
void determine_amount_of_resources();
void determine_habitability();
void display_planets_data(std::string, int);
Planet();
};
int Planet::random_number_generator(){
int n;
n = (rand()%4 + 1);
return n;
}
int Planet::random_percentage_generator(){
int n;
n = (rand()%100 + 1);
return n;
}
int Planet::randRangep(int low, int high)
{
return rand() % (high - low + 1) + low;
}
int Planet::gethabitability(){
return _habitable;
}
int Planet::getplanetsdistance(){
return _distancefromstar;
}
bool Planet::getbreathableatmosphere(){
return _breathableatmosphere;
}
int Planet::getmetal(){
return _metal;
}
int Planet::gettemperature(){
return _planetstemperature;
}
int Planet::getdiamonds(){
return _diamonds;
}
int Planet::getmercury(){
return _mercury;
}
int Planet::gethumans(){
return _humans;
}
int Planet::getstaphilloccocus(){
return _staphillococcus;
}
int Planet::getprotozoo(){
return _protozoo;
}
int Planet::getpseudomona(){
return _pseudomona;
}
std::vector<int> Planet::getbacteriae(){
std::vector<int> bacteriae = {_protozoo, _staphillococcus, _pseudomona};
return bacteriae;
}
int Planet::getgas(){
return _gas;
}
int Planet::getmagneticfieldvsradiation(){
return _magneticfieldvsradiation;
}
void Planet::turn_into_habitable(){
_habitable = true;
}
void Planet::setmetal(int n){
_metal += n;
}
void Planet::setdiamonds(int n){
_diamonds += n;
}
void Planet::setmercury(int n){
_mercury += n;
}
void Planet::sethumans(int n){
_humans += n;
}
void Planet::setgas(int n){
_gas += n;
}
void Planet::defeat(){
_defeated = true;
}
bool Planet::getdefeat(){
return _defeated;
}
void Planet::setbacteriae(int x, int y, int z){
_protozoo += x;
_staphillococcus += y;
_pseudomona += z;
}
void Planet::define_type_of_planet()
{
int random_event = random_number_generator();
//It will randomly predetermine the radius of our planet
if(random_event == 0){
_planetsradius = randRangep(10000, 30000); //This should be size of a small rocky planet like pluto
_rockyorgas = true;
}
else if(random_event == 1){
_planetsradius = randRangep(10000, 30000); //This should be size of a small rocky planet like pluto
_rockyorgas = true;
}
else if(random_event == 2){
_planetsradius = randRangep(40000, 100000); //This should be size of a normal rocky planet like earth
_rockyorgas = true;
}
else if(random_event == 3){
_planetsradius = randRangep(60000, 170000); //This should be the size of a gigantic rocky planet
_rockyorgas = true;
}
else if(random_event == 4){
_planetsradius = randRangep(60000, 170000); //This is the expected size of a gas giant
_rockyorgas = false;
}
float pi = 3.14;
_planetssurface = (4*pi*_planetsradius) / 3;
}
void Planet::define_planetstemperature()
{
int _distancefromstar = randRange(100, 4000);
define_type_of_planet();
if(_startype == 1){
if(_rockyorgas){
if(_distancefromstar <= 1300){
_planetstemperature = randRange(1000, 1500);
_planettype = 2; //Diamond planet you can use it to trade with other civilisations and make money
}
else if(_distancefromstar >= 1300){
_planetstemperature = randRange(500, 1000); //Just for the sake of realism
_planettype = 1; //It will be considered a lava planet, you can get metal for weapons and technology
}
}
else
_planettype = 6; //It is a gas planet, can be used to power light-speed travel mode
_planetstemperature = randRange(200, 1000);
} //If the star is a white dwarf
else if(_startype == 2){ //If the star is a blue giant
if(_rockyorgas){
if(_distancefromstar <= 1300){
_planetstemperature = randRange(1000, 1500);
_planettype = 1; //It will be considered a lava planet, you can get metal for weapons and technology
}
else if(_distancefromstar >= 1300){
_planetstemperature = randRange(200, 350);
_planettype = 2; // Diamond planet you can use it to purchase points
}
}
else
_planettype = 6;
_planetstemperature = randRange(200, 1000); //It is a gas planet, can be used to power light-speed travel mode
}
else if(_startype == 3){ //If it is a yellow star
if(_rockyorgas){
if(_distancefromstar <= 1300){
_planetstemperature = randRange(100, 500);
_planettype = 3; //Mercury planet can be used to extract minerals and process fuel
} else if(_distancefromstar >= 1300){
_planetstemperature = randRange(20, 40);
_planettype = 4; //This planet is likely to be habitable if it has people you can increase your space ship crew to colonise other planets depending how advanced their civilisation is
}
} else
_planettype = 6;
_planetstemperature = randRange(200, 1000); //It is a gas planet, can be used to power light-speed travel mode
}
else if(_startype == 4){ //If it is a red giant
if(_rockyorgas){
if(_distancefromstar <= 1300){
_planetstemperature = randRange(20, 40);
_planettype = 4; //This planet is likely to be habitable if it has people you can increase your space ship crew t
} else if(_distancefromstar >= 1300){
_planetstemperature = randRange(-500, 0);
_planettype = 5; //This is a frozen planet, you can extract water molecules and bacteria to perform genetical modifications on your enslaved humans
}
}
else
_planettype = 6;
_planetstemperature = randRange(0, 1000); //It is a gas planet, can be used to power light-speed travel mode
}
}
char Planet::getplanettype(){
return _planettype;
}
bool Planet::getpotentialhabitability(){
return _potentiallyhabitable;
}
void Planet::define_atmosphere_composition(){
if(_planettype == 1)
_atmospherecomposition = "Carbon dioxide";
else if(_planettype == 2)
_atmospherecomposition ="Cosmic rays";
else if(_planettype == 3)
_atmospherecomposition ="Cyanide";
else if(_planettype == 4)
_atmospherecomposition ="Oxygen";
else if(_planettype == 5)
_atmospherecomposition = "Kriptonite";
else if(_planettype == 6)
_atmospherecomposition = "Nitrogen";
}
float Planet::determine_orbit_eccentricity(){
float r = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
return r;
}
void Planet::determine_magnetic_field(){
if(_breathableatmosphere){
int random_constant = randRange(1, 2);
switch(random_constant){
case 1: _magneticfieldintensity = randRange(5, 7);
if(_magneticfieldintensity >= _starsradiation)
_magneticprotection = true;
else if(_magneticfieldintensity <= _starsradiation);
_magneticprotection = false;
_magneticfieldvsradiation = randRange(3, 5); //This variable will let the user the amount of resources that will have to be put into the creation of a magnetic field
case 2: _magneticfieldintensity = randRange(0, 5);
if(_magneticfieldintensity >= _starsradiation)
_magneticprotection = true;
else if(_magneticfieldintensity <= _starsradiation)
_magneticprotection = false;
_magneticfieldvsradiation = randRange(5, 7); //This variable will let the user know the amount of technology that will be needed for a stronger magnetic field
}
}
else
;
}
void Planet::determine_habitability(){
if(_planettype == 4){
if(_magneticprotection && _breathableatmosphere){
_habitable = true;
_humans = randRange(1000000, 7000000);
}
else if(_breathableatmosphere){
_habitable = false;
_potentiallyhabitable = true;
}
else
_habitable = false;
}
else
_habitable = false;
}
void Planet::determine_amount_of_resources(){
switch(_planettype){
case 1: _metal = randRange(1000, 10000); //measured in kg
case 2: _diamonds = randRange(1000, 10000); //measured in kg
case 3: _mercury = randRange(1000, 10000); //Given in megatons
case 5: _protozoo = randRange(10000, 60000);
_staphillococcus = randRange(10000, 60000);
_pseudomona = randRange(10000, 60000);
//Given in thousands of millions
case 6: _gas = randRange(1000, 10000); //Given in megatons
}
}
std::string Planet::getplanetsname(){
return _planetname;
}
void Planet::display_planets_data(std::string planetsname, int distancefromstar){
std::string planettype;
if(_planettype == 1)
planettype = "Lava rivers and lakes";
else if(_planettype == 2)
planettype = "Diamond surface";
else if(_planettype == 3)
planettype = "Mercury oceans";
else if(_planettype == 4){
if(_habitable){
planettype = "Fully habitable planet";
}
else if(!_habitable){
if(_breathableatmosphere){
planettype ="Potentially habitable planet";
}
else
planettype = "Post apocaliptyc planet full of nuclear radiation";
_atmospherecomposition = "Uranium";
}
}
else if(_planettype == 5){
planettype = "Frozen planet, contains ice and primitive uni-cellular forms of life";
}
else if(_planettype == 6){
planettype = "Gas giant";
}
_distancefromstar = distancefromstar; //This way we will be able to access the variable with a getter before inserting it in a database
std::cout<<"|--"<<planetsname<<"--|"<<"\n"
<<"Planet type: "<< planettype<<"\n"
<<"Average temperature: "<<_planetstemperature<<" Celcius"<<"\n"
<<"Surface in square km: "<<_planetssurface<<"\n"
<<"Atmosphere's composition: "<<_atmospherecomposition<<"\n"
<<"Intensity of magnetic field: "<<_magneticfieldintensity<<"\n"
<<"Distance from its star: "<<distancefromstar<<" million kilometers"<<"\n"
<<"Orbit's eccentricity: "<<determine_orbit_eccentricity()<<"\n"
<<"Rotation angle: "<<randRange(90, 180)<<std::endl;
if(_planettype == 1)
std::cout<<"Amount of metal to be processed: "<<_metal<<" kg"<<std::endl;
else if(_planettype == 2)
std::cout<<"Amount of diamonds: "<<_diamonds<<" kg"<<std::endl;
else if(_planettype == 3)
std::cout<<"Amount of mercury: "<<_mercury<<" megatons"<<std::endl;
else if(_planettype == 4){
if(_habitable)
std::cout<<"Alien population: "<<_humans<<" specimens"<<std::endl;
else if(!_habitable){
if(_breathableatmosphere)
std::cout<<"Can be turned into a habitable planet by intensifying its magnetic field by "<<_magneticfieldvsradiation<<" magneto units"<<std::endl;
else
std::cout<<"Post apocalyptic planet full of radiation, it was destroyed by nukes approximately 10000000 years ago, nothing can be done with it"<<std::endl;
}
}
else if(_planettype == 5){
std::cout<<"These are the bacteriae contained in our deposits along with the different types "<<"\n"
<<"Protozoo: "<<_protozoo<<"\n"
<<"Staphilococcus: "<<_staphillococcus<<"\n"
<<"Pseudomonae: "<<_pseudomona<<std::endl;
}
else if(_planettype == 6){
planettype = "Gas giant";
std::cout<<"This is the amount of fuel you can use to power your WARP drive: "<<_gas<<std::endl;
}
}
Planet::Planet(){
//PLANET CLASS METHOD
define_planetstemperature();
define_atmosphere_composition();
determine_magnetic_field();
_magneticfieldintensity = randRange(1, 10);
determine_amount_of_resources();
determine_habitability();
}
class Spaceship
{
static std::vector<std::string> planetnames;
static std::vector<std::string> starnames;
static std::vector<std::string> planetnamesbuffer;
static std::vector<std::string> starnamesbuffer;
static int starsnumber;
static int outcome_calculator(int, int, bool, int);
static void casualties(int, int, bool, int);
static void battle_processor(std::vector<std::string>, long, long, long, long, int, int, int);
static int _drones;
static int _armors;
static int _missiles;
static int _bombs;
static long _metalamount;
static int _soldierslevel;
static int _slaveslevel;
static long _specimens;
static void battle_reports(int, int, int, int, int, int, bool, int);
static void battle_preparation(int, int, long, long, long, int);
static void damage_calculation(std::vector<std::string>, std::string, int, float, int, long, int, int);
static void AI_weaponery_store(long, std::string, long, long);
static void AI_gradual_spend_reduction(long, int);
static int randRange(int, int);
static void metallurgy();
static int efficiency_calculation(int, int, bool);
static float soldiers_fate(float);
static long random_victim_assignment(int);
static bool turn_assignment(int);
static void AI(std::vector<int>, int, long, int, int, int, int, bool, bool);
static void decision_maker(int, long, long, long, long, float, float, bool, bool, bool);
static void balance_counter(std::vector<std::string>, bool, bool);
static void check_victory(std::vector<std::string>, long, long, long, bool, int);
static void update_energy(int, int, int);
static void update_morale(std::vector<std::string>, int, int);
static void battle_end(int, std::string);
static std::vector<int> ORgate(bool, bool, bool);
private:
int _diamondsamount = 1234257463; //This is the amount that will be spent on manufacturing processes
int _fuelcapacity = 134135; //This will be used to refill fuel tanks
int _WARPdrive = 10000; //This is going to be used to power the interstellar travelling mode
int _antimatterweapon; //Planetdestroyer
int _soldiers = 12335; //Soldiers to subjugate other civilisations
int _scientists = 12334; //Scientists to perfom experiments on subyugated civilisations
int _slaves = 12345; //Slaves are going to be used to extract minerals from other planets
int _protozoolevels = 0; //In theory only WARP drive and fuel should be set
int _staphilococcuslevels = 200;
int _pseudomonalevels = 0;
int _evolutionexpressaccelerator = 0;
int _soldierspoints = 0;
int _scientistspoints = 0;
int _slavespoints = 5;
int _scientistslevel = 5;
int _colonies = 3;
int _points = 300;
int _defeats;
int _victories;
int _overalllevel;
public:
void welcome();
void civilisation_interaction(int, int);
void planet_interaction();
std::vector<Star> stars_interaction();
void interstellar_travel();
int cabin();
void classify_specimens();
void assign_points(int, std::string);
void laboratory();
int genetical_modification(int, std::vector<char>, std::vector<int>, bool);
void check_bacteriae_deposits(bool, bool, bool);
void setlevel(int, std::string, int, int, int, int, int, bool, std::vector<int>, std::vector<int>);
void purchasepoints(int);
void pointstransaction(int);
std::string define_stars_name();
std::string define_planets_name();
void planet_destroyer(int);
void civilisation_history(std::string, std::string, int);
void surrender_treaty(std::string, std::string);
void refill_vector(std::string);
void to_planet(std::string, std::string, int, int, int);
void genetical_modification_database(std::string, std::string, int, int);
void to_solar_system();
void generate_colonies_database();
void display_planets_database();
void generate_solar_data_base(std::string, std::string, int, std::string, int, std::vector<int>, int, bool, bool, bool, bool, int);
void display_colonies();
std::string show_title();
void read_story();
void load_game();
void save_game();
void game_over();
};
std::vector<std::string> Spaceship::planetnames = {"Lok", "Erinar", "Golrath", "Imrooso", "Maryx Minor", "Qat Chrystac", "RZ7-6113-23", "Taspir III", "55 Cancri e", "Zachayphus", "Iewhoutis", "Foclillon", "Weplov", "Reter", "Crevugan", "Obloethea", "Ethuetera", "Asnypso", "Ciocury", "Glabuwei", "Spiri 29N4", "Grypso Y1J", "Slequhiri", "Tasloaclite", "Dragatan", "Sethurilia", "Hadrion", "Geuliv","Celaris", "Adrara", "Upruna", "Fraxetis", "Cuprillon", "Woilara", "Stuzaria", "Xiotune", "Hafloth", "Pludaphus", "Glarvis 10", "Vespin", "Oclore", "Oaphus", "Clugonus", "Veskaiter", "Godriuturn"};
std::vector<std::string> Spaceship::planetnamesbuffer;
std::vector<std::string> Spaceship::starnames = {"Acamar", "Adhafera", "Kornephoros", "Hoedus II", "Miaplacidus", "Procyon", "Pleione", "Rastaban", "Rotanev", "Sarir", "Cassiopeia", "Sterope", "Tabit", "Veritate", "Zaurak", "Sceptrum", "Sadachbia", "Rukbat", "Cygnus", "Capricorni", "Rotanev", "Ceasar 43", "Zeus", "Colossus", "Dranicus", "Rimbokhan", "Tiranuslae", "Criptilocus"};
std::vector<std::string> Spaceship::starnamesbuffer;
long Spaceship::_metalamount = 150000;
int Spaceship::_drones = 100000;
int Spaceship::_armors = 10000;
int Spaceship::_bombs = 10000;
int Spaceship:: _missiles = 10000;
long Spaceship::_specimens = 19482109;
int Spaceship::_slaveslevel = 1;
int Spaceship::_soldierslevel = 1;
int Spaceship::randRange(int low, int high)
{
return rand() % (high - low + 1) + low;
}
std::string Spaceship::define_stars_name(){
auto name = starnames.begin() + (rand()%starnames.size());
starnamesbuffer.emplace_back(*name);
starnames.erase(name);
return *name;
}
std::vector<Star> Spaceship::stars_interaction(){
while(1){
if(starnames.size() <= 8){
refill_vector("Stars");
}
else
break;
}
std::string starsname;
int stars_number = randRange(5, 10);
std::vector<Star> stars(stars_number);
std::cout<<"\n"
<<"\n"
<<"<<<STARS>>>"<<"\n"
<<"\n"
<<"\n"<<std::endl;
for(int i = 0; i < stars_number; i++){
starsname = define_stars_name();
std::cout<<"\n"
<<"Type "<<i + 1<<" to explore this solar system"<<"\n"
<<"\n"<<std::endl;
stars[i].display_stars_data(starsname);
std::cout<<std::endl;
}
return stars;
}
std::string Spaceship::define_planets_name(){
auto it = planetnames.begin() + (rand()%planetnames.size());
planetnamesbuffer.emplace_back(*it);
planetnames.erase(it);
return *it;
}
std::vector<int> Spaceship::ORgate(bool protozoo, bool staphilloccocus, bool pseudomona){
std::vector<bool> booleanvalues;
std::vector<int> missingindeces;
booleanvalues.push_back(protozoo);
booleanvalues.push_back(staphilloccocus);
booleanvalues.push_back(pseudomona);
for(int i = 0; i < 3; i++){
if(booleanvalues[i] == true){
missingindeces.push_back(i + 1);
}
else
missingindeces.push_back(0);
}
return missingindeces;
}
int Spaceship::genetical_modification(int choice, std::vector<char> planetsavailable, std::vector<int> planetstemperatures, bool missing_elements){
int desired_amount;
std::string atmosphere;
std::string desired_atmosphere;
int temperature;
int slaves_number = 0;
int radiation;
int slaves_temperature_resistance = 0;
std::string slaves_atmosphere_resistance;
int slaves_radiation_resistance = 0;
if(planetsavailable[choice - 1] == 1){
temperature = randRange(300, 1000);
atmosphere = "Carbon dioxide";
}
else if(planetsavailable[choice - 1] == 2){
temperature = randRange(300, 1000);
atmosphere = "Cosmic rays";
}
else if(planetsavailable[choice - 1] == 3){
temperature = randRange(300, 1000);
atmosphere = "Cyanide";
}
else if(planetsavailable[choice - 1] == 5){
temperature = randRange(300, 1000);
atmosphere = "Kriptonite";
}
else if(planetsavailable[choice - 1] == 6){
temperature = randRange(300, 1000);
atmosphere = "Nitrogen";
}
radiation = rand() % 4 + 1;
planetsavailable.empty();
std::cout<<"We will have to adapt to the following conditions"<<"\n"
<<"Temperature: "<<temperature<<"\n"
<<"Atmosphere: "<<atmosphere<<"\n"
<<"Radiation: "<<radiation<<"\n"
<<"Let's go to the laboratory to modify our specimens accordingly"<<"\n"
<<"\n"
<<"<<<LABORATORY>>>"<<"\n"
<<"\n"
<<"This is how many specimens you have at disposal my lord"<<"\n"
<<_specimens<<"\n"
<<"Please choose how many you would like to send to this planet"<<std::endl;
std::cin>>desired_amount;
if(desired_amount > _specimens){
std::cout<<"My lord, I must inform you that we still do not have that many specimens left"<<std::endl;
}
else if(desired_amount <= _specimens){
_specimens -= desired_amount;
slaves_number = desired_amount;
std::cout<<"The following number of specimens are ready to become your slaves my lord: "<<desired_amount<<"\n"
<<"Please, choose what variables you want to modify"<<"\n"
<<"What is the temperature level your slaves will have to resist?"<<std::endl;
std::cin>>desired_amount;
slaves_temperature_resistance += desired_amount;
std::cout<<std::endl;
std::cout<<"Perfect my lord, now just give us the level of radiation they will be exposed to"<<std::endl;
std::cin>>desired_amount;
slaves_radiation_resistance = desired_amount;
std::cout<<"Now we just need to know the atmosphere composition to perform our experiments my lord"<<std::endl;
std::getline(std::cin, desired_atmosphere);
if(_protozoolevels < 200 || _staphilococcuslevels < 200 || _pseudomonalevels < 100){
check_bacteriae_deposits(true, true, false);
slaves_number = 0;
}
else{
std::cout<<"Your genetical modifications are being performed on these specimens lord..."<<std::endl;
sleep(4);
std::cout<<"This is your legion of slaves"<<"\n"
<<"1. Number: "<<slaves_number<<"\n"
<<"2. Temperature resistance: "<<slaves_temperature_resistance<<"\n"
<<"3. Radiation resistance: "<<slaves_radiation_resistance<<"\n"
<<"4. Atmosphere resistance: "<<atmosphere<<"\n"
<<"\n"
<<"We are ready to send our slaves and extract the minerals my lord!"<<std::endl;
slaves_radiation_resistance = 0;
slaves_temperature_resistance = 0;
}
}
return slaves_number;
}
void Spaceship::civilisation_history(std::string social_structure, std::string civilisationname, int enemies_level){
//Reads the civilisations' stories from text files
if(social_structure == "Techno fascist regime"){
std::cout<<civilisationname<<"\n"
<<"Level: "<<enemies_level<<std::endl;
std::ifstream Technofascist;
std::string line;
Technofascist.open("Technofascistregime.txt");
if( !Technofascist.is_open() ){
std::cout<<"Could not open file"<<"\n";
}
while(getline(Technofascist, line)){
std::cout<<line<<std::endl;
}
Technofascist.close();
}
else if(social_structure == "Liberal democracy"){
std::cout<<civilisationname<<"\n"
<<"Level: "<<enemies_level<<std::endl;
std::ifstream Liberaldemocracy;
std::string line;
Liberaldemocracy.open("Liberaldemocraticregime.txt");
if( !Liberaldemocracy.is_open()){
std::cout<<"Could not open file"<<"\n";
}
while(getline(Liberaldemocracy, line)){
std::cout<<line<<std::endl;
}
Liberaldemocracy.close();
}
else if(social_structure == "Techno-utopian anarchy"){
std::cout<<civilisationname<<"\n"
<<"Level: "<<enemies_level<<std::endl;
std::ifstream Technoutopian;
std::string line;
Technoutopian.open("Technoutopiananarchistregime.txt");
if( !Technoutopian.is_open()){
std::cout<<"Could not open file"<<std::endl;
}
while(getline(Technoutopian, line)){
std::cout<<line<<std::endl;
}
Technoutopian.close();
}
else if(social_structure == "AI-ruled planetary nation"){
std::cout<<civilisationname<<"\n"
<<"Level: "<<enemies_level<<std::endl;
std::ifstream AIruled;
std::string line;
AIruled.open("AI-ruledregime.txt");
if(! AIruled.is_open()){
std::cout<<"Could not open file"<<std::endl;
}
while(getline(AIruled, line)){
std::cout<<line<<std::endl;
}
AIruled.close();
}
}
void Spaceship::surrender_treaty(std::string social_structure, std::string civilisationname){
//Reads the surrender treaties from text files
if(social_structure == "Techno fascist regime"){