-
Notifications
You must be signed in to change notification settings - Fork 1
/
grid.py
executable file
·25 lines (20 loc) · 929 Bytes
/
grid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
################################################################################
### This generates a dot array with random dimensions based on a fixed range ###
### and is set up as a function to be called by other modules. ###
### Last edit by Jemuel Pavlic on 3/16/2016 1:34pm ###
################################################################################
import numpy
from random import randint
class grid_gen():
## Generate random board dimensions
mapx = randint(5,19)
mapy = randint(5,19)
## Creates a nested (2D) list based on the randomly generated dimensions
matrix = [["." for x in range(mapx)] for x in range(mapy)]
## Store the finished grid here:
grid=[]
## Displays the generated board with a space in between "."s
for row in matrix:
## To do: make this output to grid so it can be edited:
print " ".join(map(str,row))