1. simple land mass generator

Someone asked for a land-mass generator a while back. I have included with
this message a very simple land mass generator. The result tend to be a
little strange, but I find it OK most of the time. You can experiment a
little with the amount of area covered by each color and the amount of land
generated, and perhaps you find a solution that seems right to you. Then
again, maybe not.

If someone have comments or improvements, let me know! And be gentle, I'm
just an amateur.

Einar Mogen


-- <land.ex begins here>
include image.e

sequence landmass,colors
integer col,row,junk,area

area=10
colors={YELLOW,GREEN,BROWN}
junk=graphics_mode(19)

landmass=repeat(repeat(BLUE,320),200)
for tl=1 to 20 do
        row=rand(200)
        col=rand(320)
        for t=1 to 2500/area do
                junk=colors[rand(3)]
                for mm=1 to area do
                        landmass[row][col]=junk
                        row=row+rand(3)-2
                        col=col+rand(3)-2
                        if row=0 then row=200
                        elsif row=201 then row=1 end if
                        if col=0 then col=320
                        elsif col=321 then col=1 end if
                end for
        end for
end for

display_image({0,0},landmass)

while get_key()=-1 do end while
-- <eof>

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu