Reputation: 2001
I am trying to teach myself how to use the Python external "noise" library that can be found on GitHub here. I'm trying to work through the tutorial on the Red Blob Games website here. However, I'm not sure how to actually make it do anything. I've read the help text that appears when I type help(noise)
into the console, but there doesn't seem to be much information available.
Right now, it just prints 50 rows and columns worth of 0.0 float elements. If I change the arguments I put into noise.pnoise2(nx, ny)
I can get different values, but all the values are still identical. I have checked the addresses of each row in the 2D list I create, and they aren't pointing the same place.
I am just beginning to learn about Perlin Noise, and I don't need it to actually do anything useful. I just want to see the numbers it generates.
How can I get my code to produce different float values?
import noise
height = 50
width = 50
mapList = []
for y in range(height):
row = []
for x in range(width):
nx = x/width - 0.5
ny = y/height - 0.5
row.append(noise.pnoise2(nx, ny))
mapList.append(row)
for row in mapList:
print(row)
Upvotes: 0
Views: 47
Reputation: 649
Since you're on Python 2, the regular /
division floors the answer. You'll need to use from __future__ import division
to get the true decimal result when using /
.
Upvotes: 1