set default in from_string
This commit is contained in:
parent
ab05a1a770
commit
afcafbba0a
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user