File handling for API.
This commit is contained in:
@@ -84,9 +84,14 @@ class Solver(BaseSolver):
|
||||
|
||||
beams = propagate(layout, (0, 0), "R")
|
||||
|
||||
if self.verbose:
|
||||
for row in beams:
|
||||
self.logger.info("".join("#" if col else "." for col in row))
|
||||
if self.files:
|
||||
self.files.create(
|
||||
"beams.txt",
|
||||
"\n".join(
|
||||
"".join("#" if col else "." for col in row) for row in beams
|
||||
).encode(),
|
||||
True,
|
||||
)
|
||||
|
||||
# part 1
|
||||
yield sum(sum(map(bool, row)) for row in beams)
|
||||
|
Reference in New Issue
Block a user