Skip to content

KemptonM/Terrain-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terrain-Generator

Final project for intro to programming (COS 125).

maillett_terrain.py was provided by my professor (with some of my modifications made). It generates two parallel matricies, one with different elevation values and the other blank, each cell to be assigned a color value based on the height value of the first matrix.

My first implementations were "ocean cells", which all held a height lower than the specified ocean level. Next, I added a river function that would randomly select cells, turn them blue, and recursively do the same for the lowest adjacent cell. Originally, the color matrix would assign a range of pre-defined gray values to all cells that qualified as "land cells".

computer generated terrain map with grayscale terrain

I modifed this so that it would assign an RGB value instead, either a darker or lighter shade of green depending on the magnitude of the height value. Since tkinter can't read RGB values, I used a small helper function for conversion. This modifcation creates a nice grassy gradient, instead of a grayscale terrain.

computer generated terrain map with large lake and green terrain computer generated terrain map with lots of ocean and green terrain

About

Final project for intro to programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages