From 69da1795b78841a8ffb44c5da5fc0011c6d02de9 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Fri, 9 Feb 2024 16:50:16 +0200 Subject: Refactoring tests some more. --- board/board.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/board/board.py b/board/board.py index 118a771..36ceb62 100644 --- a/board/board.py +++ b/board/board.py @@ -18,14 +18,19 @@ class Board(): board = None): # pylint: disable = too-many-arguments + if ( not width or not height or + width not in range(2,51) or + height not in range(2,51) ): + width, height = None, None + self.__level = level self.__width, self.__height, self.__mines =LevelSpecs[self.__level][:3] - if width and width in range(2,51): + if width: self.__width = width - if height and height in range(2,51): + if height: self.__height = height - if mines: + if height or width or mines: self.__mines = mines if self.__mines not in range(1,self.__width*self.__height): -- cgit v1.2.3