Implemented Drawing of the playingfield

This commit is contained in:
panki 2018-04-17 20:02:35 +02:00
commit 817ceb2624
3 changed files with 43 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# minebash

39
minebash.py Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/python
import readline, random
UNKNOWN = 0
width, height = 9, 9
#put logic for program param here
playfield = [[0 for x in range(width)] for y in range(height)]
headline = '.'
midline = '|'
tailline = '\''
def setup_playfield(w, h):
#do this only once
for i in range(w):
global headline, midline, tailline
headline += '---.'
midline += '---|'
tailline += '---\''
def print_playfield(playfield):
print headline
for index, row in enumerate(playfield):
rowstring = '|'
for cell in row:
rowstring+='[ ]|'
print rowstring
if(index < len(row)-1):
print midline
print(tailline)
def main():
setup_playfield(width, height)
print_playfield(playfield)
if __name__ == "__main__":
main()

3
pattern Normal file
View File

@ -0,0 +1,3 @@
.---.
|[x]|
|---|