From 421b34c1c74f152223568a3a7a33f6c132730a08 Mon Sep 17 00:00:00 2001 From: Dory Date: Mon, 16 Dec 2024 11:07:30 -0800 Subject: [PATCH] more debugging printouts --- day15/d15p2.swift | 14 +++++++++----- day16/d16p1.swift | 4 ++-- day16/d16p2.swift | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/day15/d15p2.swift b/day15/d15p2.swift index a004276..680bb2e 100644 --- a/day15/d15p2.swift +++ b/day15/d15p2.swift @@ -44,10 +44,13 @@ struct Map: CustomStringConvertible { var s: [[String]] = Array( repeating: Array(repeating: " ", count: w*2), count: h ) - walls.forEach { w in s[w.y][w.x] = "██" } - boxes.boxes.forEach { b in s[b.y][b.x] = "🮇🮀"; s[b.y][b.x+1] = "🮀▌" } - s[bot.y][bot.x] = "🮕🮕" - return s.map { row in row.joined() }.joined(separator: "\n") + walls.forEach { w in s[w.y][w.x] = "🮘🮘" } + boxes.boxes.forEach { b in s[b.y][b.x] = "🬴🬰"; s[b.y][b.x+1] = "🬰🬸" } + s[bot.y][bot.x] = "\u{001B}[91m🮿 \u{001B}[0m" + return (" " + (0.. (Map, [Move]) { } var (map, moves) = try readInput(CommandLine.arguments[1]) -print(map) print(moves) for move in moves { + print(map) map.move(move) + print(move) } print(map) print(map.gps) diff --git a/day16/d16p1.swift b/day16/d16p1.swift index b381b74..48b5fd8 100644 --- a/day16/d16p1.swift +++ b/day16/d16p1.swift @@ -58,8 +58,8 @@ struct Maze : CustomStringConvertible { let s: [[String]] = walls.enumerated().map { i, r in [String(format: "%3d ", i)] + r.map { $0 ? "██" : " " } } - print(" " + (0..