058_quiz7.patch 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. 185,186c185,186
  2. < .place => print("{s}", .{p.name}),
  3. < .path => print("--{}->", .{p.dist}),
  4. ---
  5. > .place => |p| print("{s}", .{p.name}),
  6. > .path => |p| print("--{}->", .{p.dist}),
  7. 248c248
  8. < if (place == entry.*.?.place) return entry;
  9. ---
  10. > if (place == entry.*.?.place) return &entry.*.?;
  11. 302c302
  12. < fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) void {
  13. ---
  14. > fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) TripError!void {
  15. 336d335
  16. < // Note: you do not need to fix anything here.
  17. 419,422c418
  18. < // We convert the usize length to a u8 with @intCast(), a
  19. < // builtin function just like @import(). We'll learn about
  20. < // these properly in a later exercise.
  21. < var i: u8 = @intCast(u8, trip.len);
  22. ---
  23. > var i: u8 = @intCast(u8, trip.len); // convert usize length
  24. 449,452c445,446
  25. < // Search" (BFS).
  26. < //
  27. < // By tracking "lowest cost" paths, we can also say that we're
  28. < // performing a "least-cost search".
  29. ---
  30. > // Search" (BFS). By tracking "lowest cost" paths, we can also say
  31. > // that we're performing a "least-cost search".