From 14db3452410f86fd6ef15d9dd2dc789c3c4eb58b Mon Sep 17 00:00:00 2001 From: panki27 Date: Tue, 17 Apr 2018 20:04:36 +0200 Subject: [PATCH] Implemented Drawing of the playingfield --- README.md | 1 + minebash.py | 39 +++++++++++++++++++++++++++++++++++++++ pattern | 3 +++ 3 files changed, 43 insertions(+) create mode 100644 README.md create mode 100644 minebash.py create mode 100644 pattern diff --git a/README.md b/README.md new file mode 100644 index 0000000..dc5f354 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# minebash diff --git a/minebash.py b/minebash.py new file mode 100644 index 0000000..4a5f745 --- /dev/null +++ b/minebash.py @@ -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() \ No newline at end of file diff --git a/pattern b/pattern new file mode 100644 index 0000000..af2c4bd --- /dev/null +++ b/pattern @@ -0,0 +1,3 @@ +.---. +|[x]| +|---|