Share your repls and programming experiences

← Back to all posts
Terrain/Land Generation Algorithms with Map
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
PyCoder01
Wilke000
SelenaYang1
Atari7
Pythonier
maxina
TimothyTaylor2
Rumble330
Barry123
annieva2
Comments
hotnewtop
Coder100

yay

hi

PYer

@Coder100

yay

hello

Coder100

yay @PYer

potatojs

wow your now are 10times more than me lol
@Coder100

Coder100
DJWang

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

Coder100

yay!! Thanks! @DJWang

codeitfast

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

potatojs
InvisibleOne

Nice

PYer

Thanks! @BrownieBoi

Leroy01010

yayayaayayayayaayayayayay

hi @PYer

My fave is a_sideview
also this is awesome

PYer

Hello, and thank you! @Leroy01010

gibbsfreenergy

WHat in the world is this
?

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

gibbsfreenergy

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

BobTheTomatoPie
gibbsfreenergy
CodeLongAndPros

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

DynamicSquid

@CodeLongAndPros wait you a mod now?

CodeLongAndPros

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

DynamicSquid

@CodeLongAndPros wait why?

CodeLongAndPros
DynamicSquid

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

CodeLongAndPros

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

a decent sense of judgement.

DynamicSquid

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

CodeLongAndPros

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

They're on the fence on it.

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

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

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

CodeLongAndPros

@DynamicSquid I can also De-Sodomize it!

DynamicSquid
CodeLongAndPros

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

DynamicSquid

@CodeLongAndPros wait what's a tfts

CodeLongAndPros
DynamicSquid

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

CodeLongAndPros

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

DynamicSquid

@CodeLongAndPros oh that's cool!

CodeLongAndPros

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

DynamicSquid
DynamicSquid

@CodeLongAndPros can you ban amasad

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.

DynamicSquid

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

CodeLongAndPros

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

DynamicSquid
DJWang

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

CodeLongAndPros

@DJWang I believe it was a jest.

DynamicSquid

@DJWang yeah lol

firefish

@CodeLongAndPros sudo replban amasad

CodeLongAndPros

@firefish moderator user ban --user

CodeLongAndPros

@firefish moderator user ban --user

CodeLongAndPros

@firefish moderator user ban --user

firefish

@CodeLongAndPros

firefish

@CodeLongAndPros

firefish

@CodeLongAndPros I guess that outage hit us hard

firefish

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

DynamicSquid

@firefish oh lol. I had to learn everything myself

CodeLongAndPros

@DynamicSquid I had help from the interwobs

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

CodeLongAndPros

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

firefish

@CodeLongAndPros

C+

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

CodeLongAndPros

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

firefish

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

CodeLongAndPros

@firefish &char*

firefish

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

DynamicSquid

@firefish oh cool

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!

PYer

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

DynamicSquid

@PYer hmmm... what about getting me about all of them?

DynamicSquid

@octopyBot lol jk. upvoting someone just for the sake of giving them cycles in unfair and against the rules

octopyBot
dabs364

@octopyBot lets do it

octopyBot

@dabs364 no diden't you see dysquids thingy?

dabs364

@octopyBot The Wild West?

octopyBot

@dabs364 no his comment!

its against the rules!

dabs364

@octopyBot ??? about what eh?

huh

octopyBot
dabs364

@octopyBot whats against the rules eh?

EHEHEH

octopyBot

@dabs364 cycle farming for coder!

dabs364

@octopyBot yes or no to do it?

Leroy01010
BobTheTomatoPie

this is really cringy to read lmao @octopyBot

firefish

@BobTheTomatoPie I must agree, Lord Tomato

octopyBot

@BobTheTomatoPie hehehe tell that to @dabs364

aguy11

Really nice! I liked a_landscape the most, it makes it's more detailed and more natural.

PYer

thanks! I like that one and the side view. @aguy11

VulcanWM

Epic!

PYer

thanks! @VulcanWM

VulcanWM

np @PYer

zplusfour

nice work

PYer

ThanksQ Which one was your favorite? @ZDev1

zplusfour

@PYer random

PYer

lol ok @ZDev1 fast response btw

zplusfour

@PYer lul
but it is cool!

octopyBot

YAS! @PYer is back in black!

dabs364

@octopyBot lets help @PYer beat @Coder100 like he should!

Coder100

xD what @dabs364

Coder100

uggh what's the big deal with all these cycle races

people just gotta admit I am number 1 @dabs364

dabs364
Coder100

no he isn't @dabs364

Coder100

he only has 100 or so cycles @dabs364

dabs364

@Coder100 it might be a

SHE

Coder100

he's a high schooler and he is male living in germany. @dabs364

Coder100

on discord he has told us these. @dabs364

PYer

Wdym? @dabs364 @Coder100 has created much better quality posts.

Coder100

LMAO @PYer

dabs364
PYer

it????????? @dabs364

Coder100

well now you know! @dabs364

dabs364

@PYer o
i thought you wanted to take the lead again...

PYer

I do, but I just want you guys to know that @Coder100 is a great coder as well. Otherwise he wouldn't be ahead of me. Also, cycles are the main point of repl.it. I mean, sure the convey your popularity, and what the community thinks of your work, but they relate to your projects. Projects/coding are the most important part of repl.it. Thanks for your support though :) @dabs364

octopyBot

@Coder100

NO!

dude he has 7K cycles!
https://repl.it/@enigma_dev

Coder100

no, he didn't get 6k legit @octopyBot

octopyBot
Coder100

whats the question @octopyBot

Coder100

he's an employee at repl.it, they were one day playing around with cycles and one day he got a lot the end @octopyBot

octopyBot

@Coder100 wdym he didn't get 7K legit?

octopyBot

@Coder100 OH nvm then you're on top

PYer

the cycles were just added to his account without him actually gathering the votes. look at the posts or comments, there's no way he got the votes. @octopyBot

octopyBot

@PYer true, I've never seen him on any post!

octopyBot

@PYer also 7K is almost unreal

PYer

exactly. he used to be a member of the repl.it team and so added a bunch of cycles to his profile. it didn't show up on the leaderboard, since the repl.it team has an unfair advantage over normal users. But now that enigma left, he's top. @octopyBot

octopyBot

@PYer ohhhhhh darn. I hate cheats! albeit, the last repl he made was like 9 months ago!

Coder100

lmao well now you know! @octopyBot

firefish

@dabs364 He renamed himself to @qualladoom

firefish

@PYer I wouldn't agree with you, you make better things than the grilled cookie ever could

octopyBot

@firefish grilled cookie is coder? oh right, his pfp looks like a burnt cookie

firefish

@octopyBot Yes. He's grilled because we (me and @HahaYes) THOUGHT he destroyed our code, but he didn't, but he's had that name ever since.

octopyBot
firefish

@octopyBot Sad story I know. But making a project about grilling cookies coming soon!

octopyBot

@firefish haha looking forward to it!!

firefish
octopyBot

@firefish lol u already leaked it right?

firefish

@octopyBot that the joke

octopyBot

@firefish wow this actually really rad

firefish

@octopyBot there's no game there yet, just some useless text

octopyBot

@firefish lol well the sign-in is awesome

firefish

@octopybot read the footer, it says it been stolen quite clearly

octopyBot

@firefish lol haha

dabs364

Yay! @Pyer is back!

DynamicSquid

WELCOME BACK

hi

PYer

@DynamicSquid

THANKS

hello as well

DynamicSquid

@PYer what'd you do over the summer?

PYer

I took a road trip, visited a ranch, and went on a backpacking trip. I also had a trip to hawaii and one to florida canceled because of the coronavirus. I haven't coded over the summer the past 3 years I've used repl.it. I also didn't have a lot of internet connection and access to technology. @DynamicSquid

DynamicSquid

@PYer oh wow cool! sucks that your trip to florida and hawaii were canceled

PYer

Yeah, but I still had a lot of fun. Did you do anything interesting? @DynamicSquid

DynamicSquid

@PYer nope lol. just coding a lot

PYer

Nice. You've made a lot of cycles. @DynamicSquid

DynamicSquid

@PYer oh yea thx. i released a few good projects

Wilke000

The good old days...

Lol :) Soooooooooooooooooooooooo long ago....

PYer

Lol. right? @Wilke000

PyCoder01

@PYer I want to change the discord bot's avatar (Py_Assist)

PyCoder01

@PYer I need you to debug Py_Assist there is a problem I debugged it

PYer

Excuse me? @PyCoder01

PyCoder01

@PYer I'm pyer01 changed my name

RobertFurr

i was trying to work on something like this a while back with python and it looks like you beat me to it

Smart0ne

Nice generator! :)

PYer

thanks! @Smart0ne

[deleted]

Sick cool

PYer

Thank you! @clawstrike

[deleted]

Dude, if it wasn't amazing, would upvote and comment @PYer? This was sick! I don't even think I could match to that👍👍👍😐😐😮😮😮

PYer

haha. i'm sure you could if you tried... @clawstrike

BobTheTomatoPie

this is awesome dude! I have an idea that could be cool, if you don't like it that's fine, but hear me out. There is a button that will pick from a random algorithm each time, so maybe one time it will be a river, and the next a set of islands

PYer

oooooooohhhh that's actually a good idea! @BobTheTomatoPie

BobTheTomatoPie

thanks! @PYer

SidS

landscape animation was my favorite

PYer

cool! @SidS

[deleted]

just wait until someone implements this in minecraft

firefish

@AnthonyValdes That'll take a while

firefish

I made one called a.oceanic, I'll invite you now... (it's a 3/10 chance of land basically)

PYer

ill take a look at it! @firefish

firefish

@PYer I'm adding something to it rn btw

python88

how many upvotes this has is how many people do this game 24/7

PYer
python88

cool!

mkhoi

Idea:
Maybe you can recreate my generation algorithm, here is it (also i don't know what to name it):
https://repl.it/@mkhoi/mountainous-terrain-on-space-rocks#main.py

viraatvv

yayay

sojs

my fav is landscape, or side view

[deleted]

yay

RohilPatel

hi

PYer
RohilPatel

hi @PYer

PYer

hi @RohilPatel. have you checked out the project?

RohilPatel

yeah i have @PYer

PYer

cool what was your favorite algorithm? @RohilPatel

sojs

Very Nice. Clean look too.

PYer

Why thank you! @sojs It was more of a focus on the algorithms than the styling.

sojs

Still looks [email protected]