From 4deaefdb436c77b7b35820fdc0c40a10b4fd2706 Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Wed, 10 Feb 2016 11:09:36 -0800 Subject: cleaned up ooPlay, added unicode strings --- oo.py | 44 +++++++++++++++++++++++++++----------------- 1 file 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) -- cgit v1.2.3-70-g09d2