def draw(self, pause=None): pause = pause or self.pause_time print(nl * self.screen_sep) if self.num_grid: print(space, space*(self.xpad + 1), ujoin( range1(self.width), space, self.tiletpl ), nl * self.ypad) for n, row in enumerate1(self.board): args = [self.tiletpl % n] if self.num_grid else [] if self.stackable: row = (tile[-1] for tile in row) args = [space] + args + [ujoin(row, space, self.tiletpl), nl * self.ypad] print(*args) self.status() sleep(pause)
def draw(self): if self.viswrap: self.viswrap_draw(); return print(nl*5) for n, row in enumerate(self.board): x, y = self.vtopleft if y + self.vheight > n >= y: print(space, ujoin( topitems(row[ x : x+self.vwidth ]) )) sleep(pause_time)
def draw(self, pause=None): pause = pause or self.pause_time print(nl * self.screen_sep) if self.num_grid: print(space, space * (self.xpad + 1), ujoin(range1(self.width), space, self.tiletpl), nl * self.ypad) for n, row in enumerate1(self.board): args = [self.tiletpl % n] if self.num_grid else [] if self.stackable: row = (tile[-1] for tile in row) args = [space] + args + [ ujoin(row, space, self.tiletpl), nl * self.ypad ] print(*args) self.status() sleep(pause)
def viswrap_draw(self): print(nl*5) # print("self.vtopleft.y", self.vtopleft.y) rows = Loop(self.board, "row", index=self.vtopleft.y) for _ in range(self.vheight): cols = Loop(rows.row, index=self.vtopleft.x) print(space, ujoin( topitems(cols.n_items(self.vwidth)) )) rows.next() sleep(pause_time)