Updating recent changes...

This commit is contained in:
Ognjen Milan Robovic 2024-06-16 20:05:15 -04:00
parent 6a19026c28
commit 0652b07981

View File

@ -11,8 +11,7 @@ enum {
static int population = 0; static int population = 0;
static int reputation = 0; static int reputation = 0;
static int monthly_immigration = 0; static int migration = 0;
static int monthly_emigration = 0;
static int resource [resources] = { 0 }; static int resource [resources] = { 0 };
static int construction [constructions] = { 0 }; static int construction [constructions] = { 0 };
@ -117,8 +116,7 @@ static void print_constructions (void) {
static void print_statistics (void) { static void print_statistics (void) {
print ("Reputation = %i\n", reputation); print ("Reputation = %i\n", reputation);
print ("Monthly immigration = %i\n", monthly_immigration); print ("Migration = %i\n", migration);
print ("Monthly emigration = %i\n", monthly_emigration);
print ("Population = %i\n", population); print ("Population = %i\n", population);
separate (); separate ();
@ -179,6 +177,9 @@ static void compute_turn (void) {
int index; int index;
print ("Your strategy has been submitted to the council, now you can only wait...\n");
print ("One month later, your advisor brings your short report on activities in your fortress.\n");
for (index = 0; index < resources; ++index) { for (index = 0; index < resources; ++index) {
int gained = construction [index] * 20; int gained = construction [index] * 20;
int lost = random (1, 10); int lost = random (1, 10);
@ -188,7 +189,14 @@ static void compute_turn (void) {
print ("Your fortress gained /2%i/- units of %s, but lost /1%i/- due to %s.\n", gained, resource_name [index], lost, problem [index]); print ("Your fortress gained /2%i/- units of %s, but lost /1%i/- due to %s.\n", gained, resource_name [index], lost, problem [index]);
} }
print ("Your strategy has been submitted to the council, now you can only wait...\n"); reputation += random (-3, 3) + resource [gold] / 120 + resource [wheat] / 60;
migration = random (0, 6) - resource [wheat] / 120;
population += migration;
resource [wheat] -= population / 3;
resource [gold] -= ((reputation < 0) ? -reputation : reputation) / 3;
print ("Beside that, /1%i/- units of wheat was spent on feeding the people.\n", population / 3);
print ("Also, only /1%i/- gold was spent inside castle.\n", ((reputation < 0) ? -reputation : reputation) / 3);
separate (); separate ();
} }
@ -198,9 +206,8 @@ int main (void) {
int reply; int reply;
reputation = random (0, 10); reputation = random (0, 10);
monthly_immigration = random (0, 10); migration = random (0, 10);
monthly_emigration = random (0, 10); population = random (6, 12) * 20 + migration;
population = random (6, 12) * 20 + monthly_immigration - monthly_emigration;
for (index = 0; index < resources; ++index) { for (index = 0; index < resources; ++index) {
resource [index] = random (6, 12) * 20; resource [index] = random (6, 12) * 20;