Python Random Map Generation with Perlin Noise -


recently, i've been attempting defeat 1 of main weaknesses in programming in general, random generation. thought easy thing do, lack of simple information killing me on it. don't want sound dumb, feels me of information places this written mathematicians went college graduate in theoretical mathematics. don't understand i'm meant information in order apply programming in language such python.

i've been working few days staring @ equations , attempting attempt after attempt, still after days, after ripping code apart again , again, that's been working entire time noise generator generate basic noise:

import random import math  random.seed(0)  def generatewhitenoise(width,height):     noise = [[r r in range(width)] in range(height)]      in range(0,height):         j in range(0,width):             noise[i][j] = random.randint(0,1)      return noise  noise = generatewhitenoise(50,12)  in noise:     print()     o in i:         if(o == 0):             print('-',end='')         else:             print('#',end='') 

this code produces result:

##-######--#--#-#--##-###-###---#-##-#-----#--##-# #-#-##-##-#----##------##--#####-#-##---#--#-##--- -------#-#------#---#-#---###--#--#-###-----##-#-- ######--#-#-#--####-###---#---###-##--#-#-##--#### -#----###--------##--##--##-#-#--#----###-####--## ---####-#--#--###-#-#--#--#####--####-#-##-##--#-- ----#--####-#-#-#-#-#---#--###------###--#-######- --###--#-###-------#-##--###---#-####----###-##### #----##--##-#--##-###--#----#-#-##--##-#-##---###- ##---##----##--##--#--#--###-###-#--#-##---#------ -##----#-###---######---#-#---#---###---#---###-## #--##-##-###-###---#--##-##--##-##-#-#-##--#-#-##- 

i'm wanting produce this:

-------------------------------------------------- ------------------####---------------------------- -----------------#####---------------------------- ----------------#####----------------------------- ---------------#####--------------###------------- ---------------#####--------------###------------- ---------------------------------####------------- ---######------------------------####------------- ---######------------###-------------------------- ----########---------###-------------------------- -----#######---------###-------------------------- ------###----------------------------------------- 

how can manage smooth out white-noise generate, , turn islands? can explain in simplistic way me?

i may thinking of wrong.

just use noise. coders code, great reuse.

here's very basic example (others can found in /examples directory).


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -