aboutsummaryrefslogtreecommitdiffstats
path: root/day02
diff options
context:
space:
mode:
authorOrfeas <38209077+0xfea5@users.noreply.github.com>2023-12-07 06:56:53 +0200
committerOrfeas <38209077+0xfea5@users.noreply.github.com>2025-10-28 23:20:45 +0200
commit3ffc9de9efd3b3650eaf3ccc77e434fa000a9a08 (patch)
tree49aee2fcbb4a5f7a57a67ea49b6b0f3cefa35117 /day02
parentcreate template file and update init script (diff)
downloadaoc23-3ffc9de9efd3b3650eaf3ccc77e434fa000a9a08.tar.gz
aoc23-3ffc9de9efd3b3650eaf3ccc77e434fa000a9a08.zip
day5
Diffstat (limited to 'day02')
-rw-r--r--day02/solution.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/day02/solution.zig b/day02/solution.zig
index 5e8d6f6..b40274d 100644
--- a/day02/solution.zig
+++ b/day02/solution.zig
@@ -45,10 +45,10 @@ pub fn parseBall(text: []const u8) Ball {
45 const trimmed = mem.trim(u8, text, &std.ascii.whitespace); 45 const trimmed = mem.trim(u8, text, &std.ascii.whitespace);
46 var splitBalls = mem.splitScalar(u8, trimmed, ' '); 46 var splitBalls = mem.splitScalar(u8, trimmed, ' ');
47 47
48 const nballs = std.fmt.parseInt(u64, splitBalls.next() orelse unreachable, 10) catch unreachable; 48 const nballs = std.fmt.parseInt(u64, splitBalls.next().?, 10) catch unreachable;
49 var color: Color = undefined; 49 var color: Color = undefined;
50 color = blk: { 50 color = blk: {
51 const s = splitBalls.next() orelse unreachable; 51 const s = splitBalls.next().?;
52 52
53 if (mem.eql(u8, s, "red")) { 53 if (mem.eql(u8, s, "red")) {
54 break :blk .red; 54 break :blk .red;
@@ -152,7 +152,7 @@ pub fn main() !void {
152 var splitGame = mem.splitScalar(u8, line, ':'); 152 var splitGame = mem.splitScalar(u8, line, ':');
153 _ = splitGame.next(); 153 _ = splitGame.next();
154 154
155 const game = try parseGame(splitGame.next() orelse unreachable); 155 const game = try parseGame(splitGame.next().?);
156 try games.append(game); 156 try games.append(game);
157 } 157 }
158 158