Hey guys! It's been a long time since I've opened up repl.it and done some coding. (I took a break over the summer, my latest post being HyperTyper) So many new things. Teams, and the discord community has grown so much.
@Coder100 got 2K cycles and passed me...
This is a project I started before the summer and have finished today. If you can remember, @DynamicSquid developed a simple terrain generation algorithm. I was inspired by this project, and added a few features.
#1) I created an HTML, CSS, JS repl in order to make it easier to read the map.
#2) After creating a random algorithm and recreating Squid's classic one, I decided it wasn't enough. I went through and added a couple more.
1 (a_random): Iterates over every tile selecting water or land with a 50/50 chance.
2 (a_classic): Iterates over every tile selecting water or land. Then repeats over the map 4 times, checking if a water tile is surrounded by 4+ land tiles. If True, the water tile becomes a land tile.
3 (a_rivers): Iterates over every tile, with a 1/50 chance of a water tile. Repeats over the map 2 times finding the water tiles. Tries to build a water tile above, to the right, left, or below. (In order of attempts).
OKKKKKKKKKKKK... These are starting to get a little complicated. If you are curious look at the source code in the repl. I'm going to skip these.
If you want to toggle an animation, regenerating a new map every 1 second, click the animate button. Regenerating manually press regenerate. Don't get offended at my stylesheet, that's not the point of the page.
If you create another one, I might add it. Make sure it's in JS and follows the same structure as the other functions.
Thanks, and have fun expirementing!
PS: Comment your favorite algorithm!