commit dd685dfdc3fd8476b965d2da185f6179f47f3bcc Author: Date: Tue Apr 17 20:02:35 2018 +0200 Implemented Drawing of the playingfield 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]| +|---|