Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int mapHeight;
- int mapWidth;
- int mapDim;
- int bossLocation;
- void bossRoomGen(){
- bossLocation = rand()% (mapDim*mapDim);
- }
- int main()
- {
- int mapArray[mapDim*mapDim];
- int i;
- srand(time(NULL));
- printf("Enter your desired map size:\n");//Only works for 3 or 2 for some reason
- scanf(" %d", &mapDim);
- bossRoomGen();
- for(i = 0; i<(mapDim*mapDim); i++){
- if(bossLocation == i){
- mapArray[i] = 3;
- i++;
- }
- mapArray[i] = rand()%2 + 1;
- }
- for(i = 0; i< mapDim; i++){
- int x;
- for(x = 0; x<mapDim; x++){
- int currentVal = mapArray[(mapDim*(i+1)) - (mapDim - x)];
- printf(" %d\t", currentVal);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement