set default in from_string
This commit is contained in:
parent
ab05a1a770
commit
afcafbba0a
@ -377,8 +377,8 @@ class Grid:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_str(cls, grid_string: str, true_char: str = '#') -> 'Grid':
|
def from_str(cls, grid_string: str, true_char: str = '#', default: Any = False) -> 'Grid':
|
||||||
ret = cls()
|
ret = cls(default=default)
|
||||||
for y, line in enumerate(grid_string.split("/")):
|
for y, line in enumerate(grid_string.split("/")):
|
||||||
for x, c in enumerate(line):
|
for x, c in enumerate(line):
|
||||||
ret.set(Coordinate(x, y), c == true_char)
|
ret.set(Coordinate(x, y), c == true_char)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user