SOURCE CODE
FILE world.h //03/21/2023
#define ELEMENTS 70
class world
{
public:
int map[ELEMENTS][ELEMENTS];
    world();
    ~world();
void print_x_y();
world& world_generate(int southsizeseed1, int westsizeseed2,int northsizeseed3, int Eastsizeseed4,int seed1a,int seed1b,int seed2a,int seed2b,int seed3a,int seed3b,int seed4a,int seed4b);
};
FILE world.cpp // 03/21/2023
#include "world.h"
#include < malloc.h >
#include < math.h >
#include < stdio.h >
#include < stdlib.h >
#include < stdarg.h >
#include < ctime >
#include < iostream >
#include < unistd.h >
#include < random >
using namespace std;
//LINKED MENU3
int num10;
int ghost_one=0;
world::world() {
map[ELEMENTS][ELEMENTS];
}
world& world::world_generate(int southsizeseed1, int westsizeseed2, int northsizeseed3, int eastsizeseed4, int seed1a, int seed1b, int seed2a, int seed2b, int seed3a, int seed3b, int seed4a, int seed4b){
//MAP MATRIX
   int x,y;
   srand(time(NULL));
for (int x=0; x
   for (int y=0; y
    map[x][y]=30;}}
// MAP MATRIX END
// procedural var
int rando, xx, yy, P=1;
static int ya, xa;
bool dex, six, down, up;
map[x=35][y=35]=num10;
num10=20;
xx=x;
yy=y;
xa=x;
ya=y;
int r, base3=0;
int n=1;//this increases by 1 each time
int h=3;// this increase by h+2 each time
int j=2;
int vb=20; // for bottom left, start vortex
int count=0;// for no check first element
int contatore;
printf("procedurale 100\n");
map[35][36]=num10;
for (y; y>yy-35; y-- ){x=xx; printf("procedurale 10x\n");;
   for (x=xx-P; x<=xx+P; x++){ printf("procedurale 10y\n");
   if (y==yy){map[x][y]=num10; continue;}
   if (y==yy-n){base3++; //count for trigger other 3 cicle for// this back 0 each time
   if (n==1){
    r=rand()%100;
    if(r>southsizeseed1){ map[x][y]=num10+1;}else{map[x][y]=num10;}}
   if(n>1){
   count++;
   int v; v=map[x][y+1];// map check
   r=rand()%100; if(r>southsizeseed1){if(v>=(num10+30))goto vortex; map[x][y]=v+1;}else{map[x][y]=v;}// check and horizontal creation
   if(count==1){ vb=map[x+1][y+1]; if(r>southsizeseed1){ map[x][y]=vb+1; continue; }else map[x][y]=vb; continue;}// tilted check and value setting
int vy;
   vy=map[x-1][y];
int vyv; vyv=v-vy;
   //blur parameters
   if (vyv>seed1a){ map[x][y]=v-1; }
   if (vyv>seed1b){ map[x][y]=v-1; }
   if (vyv<-seed1a){ map[x][y]=v+1; }
   if (vyv<-seed1b){ map[x][y]=v+1; }
  }
vortex:
   if (base3==h){// end cycle square base
/////////////////////////////////////////////////////////////////////////////////////////////
   contatore=0; //count for no check first vertical element
   // y right ascendant vortex
   for (int a=y; a<=y+j; a++){
    int v; v=map[x-1][a];//check map
   contatore++;
   r=rand()%100; if(r>westsizeseed2){ if(v>=(num10+30))continue; map[x][a]=v+1;}else{map[x][a]=v;}// check and vertical creation
   // equalizer vertical
   if(contatore==1)continue;
int vy;
   vy=map[x][a-1];
int vyv; vyv=v-vy;
  //blur parameters
   if (vyv>seed2a){ map[x][a]=v-1; }
   if (vyv>seed2b){ map[x][a]=v-1; }
   if (vyv<-seed2a){ map[x][a]=v+1; }
   if (vyv<-seed2b){ map[x][a]=v+1; }
   }//end ascendant vortex
////////////////////////////////////////////////////////////////////////////////
     contatore=0;
   // leftward vortex
   for (int a=x; a>=x-j; a--){
     contatore++;
   int v; v=map[a][y+j-1];// map check
   r=rand()%100; if(r>northsizeseed3){if(v>=(num10+30))continue; map[a][y+j]=v+1;}else{map[a][y+j]=v;}// check and horizontali creation
   if(contatore==1)continue;
int vy;
   vy=map[a+1][y+j];
int vyv; vyv=v-vy;
   //blur parameters
    if (vyv>seed3a){ map[a][y+j]=v-1; }
    if (vyv>seed3b){ map[a][y+j]=v-1; }
    if (vyv<-seed3a){ map[a][y+j]=v+1;}
    if (vyv<-seed3b){ map[a][y+j]=v+1;}
    }//end leftward vortex
    contatore=0;
////////////////////////////////////////////////////////////////////////////////
//
    // left vortex descending
    for (int a=y+j; a>=y; a--){
   contatore++;
    int v; v=map[x-j+1][a];// map check
    r=rand()%100; if(r>eastsizeseed4){if(v>=(num10+30))continue; map[x-j][a]=v+1;}else{map[x-j][a]=v;}// check and vertical creation
    if(contatore==1)continue;
int vy;
   vy=map[x-j][a+1];
int vyv; vyv=v-vy;
   // blur parameters
   if (vyv>seed4a){ map[x-j][a]=v-1;}
   if (vyv>seed4b){ map[x-j][a]=v-1;}
   if(vyv<-seed4a){ map[x-j][a]=v+1;}
   if(vyv<-seed4b){ map[x-j][a]=v+1;}
   }//end down vortex
contatore=0;
  /// parameters for procedural vortex
  base3=0;
  n++;
  h=h+2;
  j=j+2;
  }}
/////////////////////////
}// fine for x
count=0;
P=P+1;
printf("end cycle X\n");
}// fine for y
printf("matrix cells value 1-------------------------------------------------------------------------------");
for (int x=0; x
   for (int y=0; y
    if (map[x][y]>29||map[x][y]<20)map[x][y]=1;// delete all matrix value ( setting value 1)
   }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int x=0; x
   for (int y=0; y<1; y++){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int y=0; y
   for (int x=0; x<1; x++){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int y=0; y
   for (int x=69; x>68; x--){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int x=0; y
   for (int y=69; y>68; y--){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("check matrix cells vertical--------------------------------");
for (int x=0; x
   for (int y=0; y
   if (map[x][y]>=20 && map[x][y+1]==1 && map[x][y-1]==1)map[x][y]=1;// to cut the horizontal long branches
  }}
printf("check matrix cells vertical--------------------------------");
for (int y=0; y
  for (int x=0; x
   if (map[x][y]>=20 && map[x+1][y]==1 && map[x-1][y]==1)map[x][y]=1;// to cut the vertical long branches
}}
fine:
return *this;
}
//PRINT MAP'S ELEMENTS VALUE
void world::print_x_y(){
int x,y;
   for (x=0;x
    for(y=0;y
   printf("valore di map %i X-%i Y-%i\n",map[x][y],x,y);
  }
}}
FILE menu3.h
#include "SFML/Graphics.hpp"
#include "SFML/Network.hpp"
#define MAX_N 4
class menu3
{
public:
        menu3(float base, float altezza);
       void disegna_menu3(sf::RenderWindow &finestra);
       void Moveup();
       void Movedown();
       void Moveright();
       void Moveleft();
    sf::Font carattere1, carattere2, carattere3;
    sf::Text testo[MAX_N];
            int ritorna_contatore_menu3();
            int get_count1();
            int get_count2();
            void menu3a(float x, float y);
private:
int contatore=0;
int count1=35;
int count2=35;
};
FILE menu3.cpp
#include "menu3.h"
#include "world.h"
#include "SFML/Graphics.hpp"
sf::RectangleShape world_zone[ELEMENTS][ELEMENTS];//(sf::Vector2f(10.0,10.0));
extern world sic_mundus_creatus_est;
sf::Color grey(55,55,55,255);
sf::Color dark_green(50,120,30);
sf::Color rosso1(255,28,0), rosso2(255,56,0),rosso3(255,85,0),rosso4(255,113,0),rosso5(255,141,0),rosso6(255,170,0),
rosso7(255,198,0),rosso8(255,226,0),rosso9(255,255,0);
double x_vector=10.0, y_vector=10.0;
int x_position=300, y_position=690, x_ghost=0, y_ghost=0;
menu3::menu3(float base, float altezza) {
if (!carattere1.loadFromFile("font/Fipp.ttf") || !carattere2.loadFromFile("font/Pixeled.ttf") ||
!carattere3.loadFromFile("font/arcade.ttf")) {
printf("errore font non trovato");
}
// COSTRUTTO GRAFICA MAPPA
// CITTÀ DIAMETRO 70
//PRIMA RIGA - 24 PER PARTE
for (int x=0; x
for (int y=0; y
printf("ciclo numero %i\n",x);
world_zone[x][y].setSize(sf::Vector2f(x_vector,y_vector));
if (sic_mundus_creatus_est.map[x][y]==1){ world_zone[x][y].setFillColor(dark_green);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=10 && sic_mundus_creatus_est.map[x][y]<20){ world_zone[x][y].setFillColor(grey);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==20){ world_zone[x][y].setFillColor(sf::Color::Red);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==21){ world_zone[x][y].setFillColor(rosso1);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==22){ world_zone[x][y].setFillColor(rosso2);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==23){ world_zone[x][y].setFillColor(rosso3);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==24){ world_zone[x][y].setFillColor(rosso4);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==25){ world_zone[x][y].setFillColor(rosso5);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==26){ world_zone[x][y].setFillColor(rosso6);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==27){ world_zone[x][y].setFillColor(rosso7);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==28){ world_zone[x][y].setFillColor(rosso8);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==29){ world_zone[x][y].setFillColor(rosso9);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=30 && sic_mundus_creatus_est.map[x][y]<31)
{ world_zone[x][y].setFillColor(dark_green);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=31 && sic_mundus_creatus_est.map[x][y]<35)
{ world_zone[x][y].setFillColor(sf::Color::Green);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=70 && sic_mundus_creatus_est.map[x][y]<80)
{ world_zone[x][y].setFillColor(sf::Color::Magenta);goto
sotto;}
if (sic_mundus_creatus_est.map[x][y]>=90 && sic_mundus_creatus_est.map[x][y]<100)
{ world_zone[x][y].setFillColor(sf::Color::Cyan);goto
sotto;}
else world_zone[x][y].setFillColor(grey);
sotto:
world_zone[x][y].setPosition(x_position+(x*x_vector), y_position-(y*y_vector));
}//fine for y
printf("fine ciclo y");
}// fine for x
printf("fine ciclo x");
}// End
void menu3::disegna_menu3(sf::RenderWindow &finestra) {
for(int x=0; x
for(int y=0; y
finestra.draw(world_zone[x][y]);
}
}
};
// double x_vector=10.0, y_vector=10.0;
float thick=2.0;
//int x_position=300, y_position=690, x_ghost, y_ghost;
// int count1;
void menu3::Moveup() {
if (count2 + 1 < ELEMENTS) {
count2++;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f pos=world_zone[count1][count2].getPosition(); //cut off offset
world_zone[count1][count2-1].setOutlineThickness(0.0);
world_zone[count1][count2-1].setSize(sf::Vector2f(x_vector,y_vector));
// world_zone[count1][count2-1].setPosition(pos.x-thick,pos.y+thick*2); // cut the offset
world_zone[count1][count2-1].setPosition(x_position+(count1*x_vector),y_position-((count2-1)*y_vector));
}
}
void menu3::Movedown() {
if (count2 - 1 >= 0 ) {
count2--;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f pos=world_zone[count1][count2+1].getPosition();
world_zone[count1][count2+1].setOutlineThickness(0.0);
world_zone[count1][count2+1].setSize(sf::Vector2f(x_vector,y_vector));
world_zone[count1][count2+1].setPosition(x_position+(count1*x_vector),y_position-((count2+1)*y_vector));
}
}
void menu3::Moveright() {
if (count1 + 1
count1++;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f posD=world_zone[count1-1][count2].getPosition();
world_zone[count1-1][count2].setOutlineThickness(0.0);
world_zone[count1-1][count2].setSize(sf::Vector2f(x_vector,y_vector));
world_zone[count1-1][count2].setPosition(x_position+((count1-1)*x_vector),y_position-(count2*y_vector));
}
}
void menu3::Moveleft() {
if (count1 - 1 >= 0 ) {
count1--;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f posD=world_zone[count1+1][count2].getPosition();
world_zone[count1+1][count2].setOutlineThickness(0.0);
world_zone[count1+1][count2].setSize(sf::Vector2f(x_vector,y_vector));
world_zone[count1+1][count2].setPosition(x_position+((count1+1)*x_vector),y_position-(count2*y_vector));
}
}
int menu3::get_count1(){
return count1;
}
int menu3::get_count2(){
return count2;
}
void menu3::menu3a(float x, float y){
}
int menu3::ritorna_contatore_menu3() {
return contatore;
}