Fix printing -- had the x and y coordinates flipped
This commit is contained in:
parent
05976b51fb
commit
3d69b67185
1 changed files with 3 additions and 3 deletions
|
@ -201,10 +201,10 @@ class Board(dict):
|
|||
lines = []
|
||||
box_lines = []
|
||||
square_size = len(str(self.size))
|
||||
for x in range(self.size):
|
||||
for y in range(self.size):
|
||||
row_squares = []
|
||||
box_squares = []
|
||||
for y in range(self.size):
|
||||
for x in range(self.size):
|
||||
square = self.get(self._xy_key(x, y))
|
||||
if len(square) == 1:
|
||||
box_squares.append(str(square[0]).center(square_size))
|
||||
|
@ -218,7 +218,7 @@ class Board(dict):
|
|||
if len(box_lines) == self.box_size:
|
||||
lines.append('\n'.join(box_lines))
|
||||
box_lines = []
|
||||
if x < self.size - 1:
|
||||
if y < self.size - 1:
|
||||
# Don't print a divider on the last line.
|
||||
box_dividers = ['-' * ((square_size + 1) * self.box_size - 1) for box in range(self.box_size)]
|
||||
lines.append('\n{}\n'.format('-+-'.join(box_dividers)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue