Created
November 5, 2017 15:29
-
-
Save yvan/815963d237ad204e90c886a178f3adf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shape = (42,42) | |
WALL = 0 | |
FLOOR = 1 | |
# set the probability of filling | |
# a wall at 40% not 50% | |
fill_prob = 0.4 | |
new_map = np.ones(shape) | |
for i in range(shape[0]): | |
for j in range(shape[1]): | |
choice = random.uniform(0, 1) | |
# replace 0.5 with fill_prob | |
new_map[i][j] = WALL if choice < fill_prob else FLOOR | |
display_cave(new_map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment