|
@ -4,7 +4,7 @@ class Field: |
|
|
|
|
|
|
|
|
cursor = (0,0) |
|
|
cursor = (0,0) |
|
|
|
|
|
|
|
|
field =[ |
|
|
frame =[ |
|
|
[1,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,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,1,0,0,0,0,0,0,0,0,0], |
|
@ -17,16 +17,18 @@ class Field: |
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
def __init__(self): |
|
|
self.message = '' |
|
|
self.message = '' |
|
|
|
|
|
self.changed = False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def toggleCurrent(self): |
|
|
def togglePixel(self): |
|
|
curline = self.field[self.cursor[0]] |
|
|
curline = self.frame[self.cursor[0]] |
|
|
curline[self.cursor[1]] = 0 if curline[self.cursor[1]] == 1 else 1 |
|
|
curline[self.cursor[1]] = 0 if curline[self.cursor[1]] == 1 else 1 |
|
|
|
|
|
self.changed = True |
|
|
|
|
|
|
|
|
def print_field(self,stdscr): |
|
|
def print_field(self,stdscr): |
|
|
stdscr.clear() |
|
|
stdscr.clear() |
|
|
for line in range(0,len(self.field)): |
|
|
for line in range(0,len(self.frame)): |
|
|
curline = self.field[line] |
|
|
curline = self.frame[line] |
|
|
|
|
|
|
|
|
for col in range(0,len(curline)): |
|
|
for col in range(0,len(curline)): |
|
|
colour = curses.color_pair(1) |
|
|
colour = curses.color_pair(1) |
|
|