Skip to content

Commit fcc409b

Browse files
committed
improved MessageStep
1 parent ae907d1 commit fcc409b

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

backend/main/chapters/c11_tic_tac_toe_project.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def generate_inputs(cls):
176176
["X", "O", "O", "O", "O"]], False),
177177
]
178178

179-
class catch_empty_row(MessageStep):
179+
class catch_empty_row(ExerciseStep, MessageStep):
180180
"""
181181
Keep in mind that some entries might be `' '`. An empty row is not a winning row.
182182
"""
@@ -196,12 +196,20 @@ def row_winner(board: List[List[str]]):
196196

197197
return row_winner
198198

199-
def check(self):
200-
return not (
201-
"== ' '" in self.input or
202-
"!= ' '" in self.input or
203-
'== " "' in self.input or
204-
'!= " "' in self.input)
199+
tests = [
200+
([[" ", " ", " "],
201+
["A", "A", "B"],
202+
["B", "B", "A"]], True),
203+
([["S", "S", "S", "S"],
204+
[" ", " ", " ", " "],
205+
["S", "S", "M", "S"],
206+
["M", "M", " ", "S"]], True),
207+
([["X", "O", " ", "X", "X"],
208+
["X", "O", " ", "X", "X"],
209+
[" ", "O", "O", "O", " "],
210+
["X", "X", "X", "X", " "],
211+
[" ", " ", " ", " ", " "]], True),
212+
]
205213

206214
class column_winner(ExerciseStep):
207215
"""

0 commit comments

Comments
 (0)