diff options
-rw-r--r-- | oo.py | 44 |
1 files changed, 27 insertions, 17 deletions
@@ -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) |