summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Anderson <jandew+dev@gmail.com>2016-02-10 11:09:36 -0800
committerJoe Anderson <jandew+dev@gmail.com>2016-02-10 11:09:36 -0800
commit4deaefdb436c77b7b35820fdc0c40a10b4fd2706 (patch)
tree63cf1f8bc70b692a3739811c30ae582fea4f13cf
parent9e00a1dcd2e63407c24c0b8e2003b53b7a98dd14 (diff)
downloadoo-4deaefdb436c77b7b35820fdc0c40a10b4fd2706.tar.gz
oo-4deaefdb436c77b7b35820fdc0c40a10b4fd2706.zip
cleaned up ooPlay, added unicode strings
-rw-r--r--oo.py44
1 files changed, 27 insertions, 17 deletions
diff --git a/oo.py b/oo.py
index a947665..1b0d4b4 100644
--- a/oo.py
+++ b/oo.py
@@ -161,31 +161,41 @@ class ooPuzzle:
pass
class ooPlay:
- """Encapsulates a oo game instance.
-
- Methods.
- display() : Display the state of the board, refresh screen.
- keyloop() : Set up screen and wait for keypress.
+ """Encapsulates an oo game instance.
+
+ Renders and interacts with an ooPuzzle instance.
"""
- def __init__(self, scr, inverted=False):
+ def __init__(self, scr):
"""Create a new ooPlay instance.
Arguments.
- scr : curses screen object used for display
- X,Y : horizontal and vertical size of the board
- inverted : bool for swapping to "dark mode"
+ scr : curses screen object used for display
"""
self.scr = scr
- Y, X = self.scr.getmaxyx()
- self.X, self.Y = X, Y - 2
- self.piece = {}
- self.state = {}
+ self.Y, self.X = self.scr.getmaxyx()
+ self.puzzle = ooPuzzle(self.X, self.Y-2)
+ self.puzzle.random_state()
self.scr.clear()
- # draw the help area
- border_line = X * "═"
- self.scr.addstr(self.Y + 1, 0, border_line)
- self.scr.refresh()
+ # draw the help area and board state
+ border_line = self.X * "═"
+ self.scr.addstr(self.Y - 2, 0, border_line)
+ self.display()
+
+ PIECE_ORIENT_TO_STRING = \
+ ["╸╵╺╷",
+ "┙┕┍┑",
+ "━│━│",
+ "┝┯┥┷"]
+
+
+ def display(self):
+ """Display the state of the board, refresh screen."""
+ pass
+
+ def keyloop(self):
+ """Wait for and parse keypress."""
+ pass
def main():
curses.wrapper(ooPlay)