ziglings.org/patches/patches/058_quiz7.patch

32 lines
1.2 KiB
Diff
Raw Normal View History

2021-06-30 19:18:13 -04:00
185,186c185,186
2021-04-04 16:05:44 -04:00
< .place => print("{s}", .{p.name}),
< .path => print("--{}->", .{p.dist}),
---
> .place => |p| print("{s}", .{p.name}),
> .path => |p| print("--{}->", .{p.dist}),
2021-06-30 19:18:13 -04:00
248c248
2021-04-04 16:05:44 -04:00
< if (place == entry.*.?.place) return entry;
---
> if (place == entry.*.?.place) return &entry.*.?;
2021-06-30 19:18:13 -04:00
302c302
2021-04-04 16:05:44 -04:00
< fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) void {
---
> fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) TripError!void {
2021-06-30 19:18:13 -04:00
336d335
< // Note: you do not need to fix anything here.
419,422c418
< // We convert the usize length to a u8 with @intCast(), a
< // builtin function just like @import(). We'll learn about
< // these properly in a later exercise.
< var i: u8 = @intCast(u8, trip.len);
---
> var i: u8 = @intCast(u8, trip.len); // convert usize length
449,452c445,446
< // Search" (BFS).
< //
< // By tracking "lowest cost" paths, we can also say that we're
< // performing a "least-cost search".
---
> // Search" (BFS). By tracking "lowest cost" paths, we can also say
> // that we're performing a "least-cost search".