Olli Graf
8 months ago
4 changed files with 99 additions and 13 deletions
@ -0,0 +1,5 @@ |
|||||
|
# created by virtualenv automatically |
||||
|
__pycache__ |
||||
|
lib |
||||
|
bin |
||||
|
|
@ -0,0 +1,39 @@ |
|||||
|
import curses |
||||
|
|
||||
|
class Field: |
||||
|
|
||||
|
cursor = (0,0) |
||||
|
|
||||
|
field =[ |
||||
|
[1,0,0,0,0,0,0,0,0,0,0,0], |
||||
|
[0,1,0,0,0,0,0,0,0,0,0,0], |
||||
|
[0,0,1,0,0,0,0,0,0,0,0,0], |
||||
|
[0,0,0,1,0,0,0,0,0,0,0,0], |
||||
|
[0,0,0,0,1,0,0,0,0,0,0,0], |
||||
|
[0,0,0,0,0,1,0,0,0,0,0,0], |
||||
|
[0,0,0,0,0,0,1,0,0,0,0,0], |
||||
|
[0,0,0,0,0,0,0,1,0,0,0,0] |
||||
|
] |
||||
|
|
||||
|
def __init__(self): |
||||
|
self.message = '' |
||||
|
|
||||
|
|
||||
|
def print_field(self,stdscr): |
||||
|
stdscr.clear() |
||||
|
for line in range(0,len(self.field)): |
||||
|
curline = self.field[line] |
||||
|
|
||||
|
for col in range(0,len(curline)): |
||||
|
colour = curses.color_pair(1) |
||||
|
if (line,col) == self.cursor: |
||||
|
colour = curses.color_pair(2) |
||||
|
if curline[col] == 0: |
||||
|
stdscr.addstr(line,col,'o ',colour) |
||||
|
else: |
||||
|
stdscr.addstr(line,col,'x ',colour) |
||||
|
stdscr.addstr(line+1,0,'Press Space to toggle, q to quit') |
||||
|
if len(self.message) > 0: |
||||
|
stdscr.addstr(line+2,0,f'{self.message}',curses.color_pair(3)) |
||||
|
stdscr.refresh() |
||||
|
|
@ -0,0 +1,8 @@ |
|||||
|
home = /usr/bin |
||||
|
implementation = CPython |
||||
|
version_info = 3.11.2.final.0 |
||||
|
virtualenv = 20.17.1+ds |
||||
|
include-system-site-packages = false |
||||
|
base-prefix = /usr |
||||
|
base-exec-prefix = /usr |
||||
|
base-executable = /usr/bin/python3 |
Loading…
Reference in new issue