set default in from_string

This commit is contained in:
Stefan Harmuth 2022-12-04 10:58:17 +01:00
parent ab05a1a770
commit afcafbba0a

View File

@ -377,8 +377,8 @@ class Grid:
)
@classmethod
def from_str(cls, grid_string: str, true_char: str = '#') -> 'Grid':
ret = cls()
def from_str(cls, grid_string: str, true_char: str = '#', default: Any = False) -> 'Grid':
ret = cls(default=default)
for y, line in enumerate(grid_string.split("/")):
for x, c in enumerate(line):
ret.set(Coordinate(x, y), c == true_char)