From 147e5268bcc05c1afcd2ca4ca9bbbe9010688c31 Mon Sep 17 00:00:00 2001 From: Charles Antoine NOURY Date: Tue, 22 Nov 2022 15:49:37 +0100 Subject: [PATCH] [rules] created check_board_size --- src/rules.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/rules.py b/src/rules.py index eaca103..f53a32e 100644 --- a/src/rules.py +++ b/src/rules.py @@ -1,8 +1,23 @@ class Rules: def __init__(self): - name = None - nb_row = None - nb_col = None + self.name = None + self.nb_row = None + self.nb_col = None + def check_board_size(self, board: Board) -> Bool: + """ Checks if the board size is correct. + Entries: + self: the Rules class itself + board -> Board: a board + Output: + correct -> Bool: if True, the board size is correct + """ + correct = True - \ No newline at end of file + if not self.nb_col == board.nb_col: + correct = False + + if not self.nb_row == board.nb_row: + correct = False + + return correct