#include "PGMImage.h"
#include <cstdlib>
#include <ctime>
#include <cmath>
const double PI = 3.14159;
const int WIDTH = 513;
const int HEIGHT = 513;
const int PIXEL_VALUES = 256;
const int neighbors[][2] = {
{-1, -1}, {0, -1}, {1, -1},
{-1, 0}, {1, 0},
{-1, 1}, {0, 1}, {1, 1}
};
bool inBounds(int x, int y){
return x >= 0 && x < WIDTH && y >= 0 && y < HEIGHT;
}
void randomTerrain(PGMImage &img, int max_amt){
for(int y = 0; y < HEIGHT; y++){
for(int x = 0; x < WIDTH; x++){
int p = img.getPixel(x, y) + (rand() % max_amt) + 1;
if(p > 255){
p = 255;
}
img.setPixel(x, y, p);
}
}
}
void constantTerrain(PGMImage &img, int amt){
for(int y = 0; y < HEIGHT; y++){
for(int x = 0; x < WIDTH; x++){
img.setPixel(x, y, amt);
}
}
}
int main(){
srand(time(0));
PGMImage img (WIDTH, HEIGHT);
randomTerrain(img, PIXEL_VALUES);
img.writeToFile("height.pgm");
}