Skip to content
Sign upLog in
← Back to Community
Terrain/Land Generation Algorithms with Map
Profile icon
PYer

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.

ALGORITHMS:

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).

4 (a_islands):

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!

Voters
Profile icon
GustDemyttenaer
Profile icon
PyCoder01
Profile icon
Wilke000
Profile icon
SelenaYang1
Profile icon
Atari7
Profile icon
Pythonier
Profile icon
maxina
Profile icon
TimothyTaylor2
Profile icon
Rumble330
Profile icon
Barry123
Comments
hotnewtop
Profile icon
Coder100

yay

hi

Profile icon
PYer

@Coder100

yay

hello

Profile icon
Coder100
Profile icon
potatojs

wow your now are 10times more than me lol


@Coder100

Profile icon
Coder100
Profile icon
DJWang

@Coder100
Congrats on almost 5000 upvotes! You deserve it after countless hours of hard work.

Profile icon
Coder100

yay!! Thanks!

@DJWang

Profile icon
codeitfast

@potatojs
LOL. I've got, like, 10 chat numbers, so that is basically saying nothing XD

Profile icon
potatojs
Profile icon
InvisibleOne

Nice

Profile icon
PYer
Profile icon
Leroy01010

yayayaayayayayaayayayayay

hi

@PYer

My fave is a_sideview
also this is awesome

Profile icon
PYer

Hello, and thank you!

@Leroy01010

Profile icon
gibbsfreenergy

WHat in the world is this
?

Profile icon
sojs

It is land generator. Made to generate landscapes, the landscapes that

@pyer
has done are rivers, random - randomly generating every tile - landscape, Islands and a side view You can use this to create maps in games without a canvas.
@JosephSanthosh

Profile icon
gibbsfreenergy

@sojs
What? Well it's great to know
@PYer
is back!

Profile icon
BobTheTomatoPie
Profile icon
gibbsfreenergy
Profile icon
CodeLongAndPros

Idea:
a_game_of_life:
Starts with all water, places a R-pentomino in center (as land) and iterate for 2000 generations

Profile icon
DynamicSquid

@CodeLongAndPros
wait you a mod now?

Profile icon
CodeLongAndPros

@DynamicSquid
Yes, though I might have to hang it up soon, I don't know.

Profile icon
DynamicSquid
Profile icon
CodeLongAndPros
Profile icon
DynamicSquid

@CodeLongAndPros
oh. but how'd you become one in the first place?

Profile icon
CodeLongAndPros

@DynamicSquid
TheDrone7 emailed me asking about it, and I apparently have:

a decent sense of judgement.

Profile icon
DynamicSquid

@CodeLongAndPros
oh cool! well done. but your parents won't let you?

Profile icon
CodeLongAndPros

@DynamicSquid
They don't want me to see NSFW stuff...

They're on the fence on it.

Profile icon
DynamicSquid

@CodeLongAndPros
wait how does repl.it have nsfw stuff lol. but that really does suck... wish you could stay a mod! all my parents know is that their kid does cool stuff and makes games on the computer. they don't know anything about code lol

Profile icon
CodeLongAndPros

@DynamicSquid
I may stay a mod, I still have an appeal, I can point to the bans list... I still have htop hope. (I can't believe I mistyped that.)

Profile icon
DynamicSquid

@CodeLongAndPros
show your parents how you can reverse the polarity of the neutron flow to correct for the positron leak! and maybe they'll let you be a mod

Profile icon
CodeLongAndPros

@DynamicSquid
I can also De-Sodomize it!

Profile icon
DynamicSquid
Profile icon
CodeLongAndPros

@DynamicSquid
If TFTS taught me one thing:
CYB (Cover your back). I can point to the entire ban history.

Profile icon
DynamicSquid

@CodeLongAndPros
wait what's a tfts

Profile icon
CodeLongAndPros
Profile icon
DynamicSquid

@CodeLongAndPros
ah.. okay lol. so what can you do as a mod? what powers do you have and what can you see?

Profile icon
CodeLongAndPros

@DynamicSquid
I can edit / delete, unlink (inodes?), set answers, shadow bans...

Profile icon
DynamicSquid

@CodeLongAndPros
oh that's cool!

Profile icon
CodeLongAndPros

@DynamicSquid
Yeah.
But the report button is where the reply button was...
(Source: Reported HahaYes, don't worry, I undid it, I think)

Profile icon
DynamicSquid
Profile icon
DynamicSquid

@CodeLongAndPros
can you ban amasad

Profile icon
CodeLongAndPros

@DynamicSquid

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.

#2) Think before you type.

#3) With great power comes great responsibility.

Profile icon
DynamicSquid

@CodeLongAndPros
so that's a yes? oh okay. well congrats on mod!

Profile icon
CodeLongAndPros

@DynamicSquid
That's a no, and thanks.
Wait, I can't report myself? That's dumb...

Profile icon
DynamicSquid
Profile icon
DJWang

@DynamicSquid
@amasad
doesn't want to be banned and he won't be cause he the CEO of the whole community

Profile icon
CodeLongAndPros

@DJWang
I believe it was a jest.

Profile icon
DynamicSquid

@DJWang
yeah lol

Profile icon
firefish

@CodeLongAndPros
sudo replban amasad

Profile icon
CodeLongAndPros

@firefish
moderator user ban --user

Profile icon
CodeLongAndPros

@firefish
moderator user ban --user

Profile icon
CodeLongAndPros

@firefish
moderator user ban --user

Profile icon
firefish

@CodeLongAndPros

> su - Enter password for amasad: $> replit --delete-account:amasad Are you sure? (y/n) y Deleting [#################] 100% -bash: bash: command not found
Profile icon
firefish

@CodeLongAndPros

> su - Enter password for amasad: $> replit --delete-account:amasad Are you sure? (y/n) y Deleting [#################] 100% -bash: bash: command not found
Profile icon
firefish

@CodeLongAndPros
I guess that outage hit us hard

Profile icon
firefish

@DynamicSquid
Well... er you're lucky... because my parents were the ones that taught me coding lol

Profile icon
DynamicSquid

@firefish
oh lol. I had to learn everything myself

Profile icon
CodeLongAndPros

@DynamicSquid
I had help from the interwobs

Profile icon
firefish

@DynamicSquid
pf... well that's what I did after my Dad taught me python, and I went onto learn Visual Basic (myself), Then got so fed up with the awful syntax and switched to another .NET language: C# (myself).

Profile icon
CodeLongAndPros

@firefish
I did C+ first, for an arduino, then Python, then D.

Profile icon
firefish

@CodeLongAndPros

C+

actually true story: I used to think there was C, C++, and C+ and C#

Profile icon
CodeLongAndPros

@firefish
Well, Arduino has a weird thing going where String, char[], and char* are all valid.

Profile icon
firefish

@CodeLongAndPros
how about char**? I wonder...

Profile icon
CodeLongAndPros

@firefish
&char*

Profile icon
firefish

@CodeLongAndPros
Just a mess. Consistency down the plughole. (That's C++ in a nutshell)

Profile icon
DynamicSquid

@firefish
oh cool

Profile icon
octopyBot

@PYer
@DynamicSquid
@Coder100
@dabs364
I feel like we should help coder get higher than enigma! I know I don't like cheats! come one lets do this!

Profile icon
PYer

hmmm... what about getting me above them both?

@octopyBot

Profile icon
DynamicSquid