2D Procedural Terrain Generation
I built a UI that procedurally generates different types of terrain based on user input. This was created in Processing, a Java-like language for visual programming. The UI had several options for the user to choose for their terrain:
- Square or Hexagon Step - I implemented a random walk algorithm for both shapes 
- Step Size - Slider where user can control the size of the step 
- Step Rate - How far apart each step was 
- Constrain Step - Constrain steps to be within the blue viewport 
- Simulate Terrain - The more a single location is stepped on, color it accordingly to simulate terrain elevation (green - low elevation, brown - slightly higher elevation, gray - even higher elevation, black - highest elevation) 
- Use Stroke - Draw a stroke around each step 
- Use Random Seed - Initiate random number generator for step start point 
Refactoring
I first built this in college, and I’ve learned a lot since then. I decided to refactor this project, and extend its functionality. I’m still in the process of refactoring, and the latest is on my GitHub. Some of the changes I’ve made include:
- Removed the two big functions in Main that basically did the same thing but for each shape. I consolidated them into one function that takes in a shape and a HashMap as parameters. 
- Renamed variables throughout to be more descriptive (for example, terrainColorToggle instead of tog2) 
- Moving all the UI creation into a separate function 
- Replacing if/else blocks with switch statements 
- Removing shared variables from Square and Hex classes and moving them into Base 
 
            