agarwal_siddharth_LandGeneration.cpp - world.cpp Ass3...

This preview shows page 1 - 3 out of 4 pages.

// // world.cpp // Ass3 // // Created by siddharth agarwal on 6/26/20. // Copyright © 2020 siddharth agarwal. All rights reserved. // #include<stdio.h> #include<time.h> #include<iostream> #include<math.h> #include "termcolor.hpp" #include "agarwal_siddharth_LandGeneration.h" char NewFromRuralLand() // generate a random no. between 1 to 100 { int rno=rand()%100+1; if(rno<=40)// 1 to 40 makes it 40% return 'R'; else if(rno<=65)// 41 to 65 makes it 65% return 'F'; else if(rno<=80)//66 to 80 makes it 80% return 'T'; else if(rno<=90)// 81 to 90 makes it 90% return 'W'; else// 91 to 1000 makes it 100% return 'M'; } char NewFromForest() // generate a random no. between 1 to 100 { int rno=rand()%100+1; if(rno<=20) return 'R'; else if(rno<=60) return 'F'; else if(rno<=65) return 'T'; else if(rno<=85) return 'W'; else return 'M'; } char NewFromTown() // generate a random no. between 1 to 100 { int rno=rand()%100+1; if(rno<=20) return 'R'; else if(rno<=25) return 'F'; else if(rno<=65) return 'T'; else if(rno<=75) return 'W'; else if(rno<=95) return 'C'; else return 'M'; } char NewFromWater() // generate a random no. between 1 to 100 {
int rno=rand()%100+1; if(rno<=15) return 'R'; else if(rno<=35) return 'F'; else if(rno<=40)

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture