summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rwxr-xr-xpatches/eowyn.sh14
-rw-r--r--patches/patches/046_optionals2.patch4
-rw-r--r--patches/patches/058_quiz7.patch6
-rw-r--r--patches/patches/060_floats.patch12
-rw-r--r--patches/patches/065_builtins2.patch10
-rw-r--r--patches/patches/099_formatting.patch4
-rw-r--r--patches/patches/100_for4.patch2
-rw-r--r--patches/patches/106_files.patch8
-rw-r--r--patches/patches/107_files2.patch2
-rw-r--r--patches/patches/109_vectors.patch13
-rw-r--r--patches/patches/110_quiz9.patch56
11 files changed, 106 insertions, 25 deletions
diff --git a/patches/eowyn.sh b/patches/eowyn.sh
index 8cac450..afc2732 100755
--- a/patches/eowyn.sh
+++ b/patches/eowyn.sh
@@ -12,6 +12,12 @@
# using the patches in this directory and convey them
# to convalesce in the healed directory.
#
+delete_progress() {
+ progress_file=".progress.txt"
+ if [ -f $progress_file ]; then
+ rm $progress_file
+ fi
+}
set -e
# We check ourselves before we wreck ourselves.
@@ -23,9 +29,12 @@ fi
# Which version we have?
echo "Zig version" $(zig version)
-echo "Eowyn version 23.10.5.1, let's try our magic power."
+echo "Eowyn version 25.1.9, let's try our magic power."
echo ""
+# Remove progress file
+delete_progress
+
# Create directory of healing if it doesn't already exist.
mkdir -p patches/healed
@@ -54,3 +63,6 @@ zig fmt --check patches/healed
# Test the healed exercises. May the compiler have mercy upon us.
zig build -Dhealed
+
+# Remove progress file again
+delete_progress
diff --git a/patches/patches/046_optionals2.patch b/patches/patches/046_optionals2.patch
index 1b364a6..8fa01a2 100644
--- a/patches/patches/046_optionals2.patch
+++ b/patches/patches/046_optionals2.patch
@@ -1,5 +1,5 @@
---- exercises/046_optionals2.zig 2024-09-04 20:51:36.766783971 +0200
-+++ answers/046_optionals2.zig 2024-09-04 20:51:01.389400985 +0200
+--- exercises/046_optionals2.zig 2024-11-08 22:46:25.592875338 +0100
++++ answers/046_optionals2.zig 2024-11-08 22:46:20.699447951 +0100
@@ -22,7 +22,7 @@
const Elephant = struct {
diff --git a/patches/patches/058_quiz7.patch b/patches/patches/058_quiz7.patch
index 265b9e3..978fbb1 100644
--- a/patches/patches/058_quiz7.patch
+++ b/patches/patches/058_quiz7.patch
@@ -1,8 +1,8 @@
---- exercises/058_quiz7.zig 2023-10-03 22:15:22.125574535 +0200
-+++ answers/058_quiz7.zig 2023-10-05 20:04:07.106101152 +0200
+--- exercises/058_quiz7.zig 2024-10-28 09:06:49.448505460 +0100
++++ answers/058_quiz7.zig 2024-10-28 09:35:14.631932322 +0100
@@ -192,8 +192,8 @@
// Oops! The hermit forgot how to capture the union values
- // in a switch statement. Please capture both values as
+ // in a switch statement. Please capture each value as
// 'p' so the print statements work!
- .place => print("{s}", .{p.name}),
- .path => print("--{}->", .{p.dist}),
diff --git a/patches/patches/060_floats.patch b/patches/patches/060_floats.patch
index 404654a..9e64c6f 100644
--- a/patches/patches/060_floats.patch
+++ b/patches/patches/060_floats.patch
@@ -1,11 +1,11 @@
---- exercises/060_floats.zig 2023-11-06 19:45:03.609687304 +0100
-+++ answers/060_floats.zig 2023-11-06 19:44:49.249419994 +0100
+--- exercises/060_floats.zig 2025-03-03 20:23:40.255443963 +0400
++++ answers/060_floats.zig 2025-03-03 20:29:58.554854977 +0400
@@ -43,7 +43,7 @@
//
- // We'll convert this weight from pound to kilograms at a
- // conversion of 0.453592kg to the pound.
-- const shuttle_weight: f16 = 0.453592 * 4480e6;
-+ const shuttle_weight: f32 = 0.453592 * 4.480e6;
+ // We'll convert this weight from pounds to metric units at a
+ // conversion of 0.453592 kg to the pound.
+- const shuttle_weight: f16 = 0.453592 * 4480e3;
++ const shuttle_weight: f32 = 0.453592 * 4.480e3;
// By default, float values are formatted in scientific
// notation. Try experimenting with '{d}' and '{d:.3}' to see
diff --git a/patches/patches/065_builtins2.patch b/patches/patches/065_builtins2.patch
index d5da950..e5e6410 100644
--- a/patches/patches/065_builtins2.patch
+++ b/patches/patches/065_builtins2.patch
@@ -1,5 +1,5 @@
---- exercises/065_builtins2.zig 2024-09-02 19:15:56.569952315 +0200
-+++ answers/065_builtins2.zig 2024-09-02 19:13:44.280600350 +0200
+--- exercises/065_builtins2.zig 2024-11-02 16:58:30.607829441 +0100
++++ answers/065_builtins2.zig 2024-11-02 16:58:33.821220588 +0100
@@ -58,7 +58,7 @@
// Oops! We cannot leave the 'me' and 'myself' fields
// undefined. Please set them here:
@@ -24,16 +24,16 @@
// (which is a zero-bit type that takes up no space at all!):
- if (fields[0].??? != void) {
+ if (fields[0].type != void) {
- print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[0].name});
+ print(" {s}", .{fields[0].name});
}
- if (fields[1].??? != void) {
+ if (fields[1].type != void) {
- print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[1].name});
+ print(" {s}", .{fields[1].name});
}
- if (fields[2].??? != void) {
+ if (fields[2].type != void) {
- print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[2].name});
+ print(" {s}", .{fields[2].name});
}
diff --git a/patches/patches/099_formatting.patch b/patches/patches/099_formatting.patch
index 384bf86..a56b556 100644
--- a/patches/patches/099_formatting.patch
+++ b/patches/patches/099_formatting.patch
@@ -1,5 +1,5 @@
---- exercises/099_formatting.zig 2023-10-03 22:15:22.125574535 +0200
-+++ answers/099_formatting.zig 2023-10-05 20:04:07.292771311 +0200
+--- exercises/099_formatting.zig 2024-11-07 21:45:10.459123650 +0100
++++ answers/099_formatting.zig 2024-11-07 21:43:55.154345991 +0100
@@ -131,7 +131,7 @@
for (0..size) |b| {
// What formatting is needed here to make our columns
diff --git a/patches/patches/100_for4.patch b/patches/patches/100_for4.patch
index 3539be2..ad73e9a 100644
--- a/patches/patches/100_for4.patch
+++ b/patches/patches/100_for4.patch
@@ -7,5 +7,5 @@
- for (hex_nums, ???) |hn, ???| {
+ for (hex_nums, dec_nums) |hn, dn| {
if (hn != dn) {
- std.debug.print("Uh oh! Found a mismatch: {d} vs {d}\n", .{ hn, dn });
+ print("Uh oh! Found a mismatch: {d} vs {d}\n", .{ hn, dn });
return;
diff --git a/patches/patches/106_files.patch b/patches/patches/106_files.patch
index 5eb5a19..89f37ad 100644
--- a/patches/patches/106_files.patch
+++ b/patches/patches/106_files.patch
@@ -1,5 +1,5 @@
---- exercises/106_files.zig 2024-06-17 10:11:53.651439869 +0200
-+++ answers/106_files.zig 2024-06-17 10:21:50.697337653 +0200
+--- exercises/106_files.zig 2024-11-09 20:33:07.455580904 +0100
++++ answers/106_files.zig 2024-11-09 20:33:30.394785215 +0100
@@ -1,22 +1,22 @@
//
// Until now, we've only been printing our output in the console,
@@ -17,9 +17,9 @@
+// by organizing files into directories, which hold files and other directories,
+// thus creating a tree structure for navigating.
//
--// Fortunately, the Zig standard library provides a simple API for interacting
+-// Fortunately, the Zig Standard Library provides a simple API for interacting
-// with the file system, see the detail documentation here:
-+// Fortunately, zig standard library provide a simple api for interacting
++// Fortunately, the Zig Standard Library provide a simple api for interacting
+// with the file system, see the detail documentation here
//
// https://ziglang.org/documentation/master/std/#std.fs
diff --git a/patches/patches/107_files2.patch b/patches/patches/107_files2.patch
index ebf8a7c..f03a2e8 100644
--- a/patches/patches/107_files2.patch
+++ b/patches/patches/107_files2.patch
@@ -42,7 +42,7 @@
- // can you go here to find a way to read the content?
+ // can you go here to find a way to read the content ?
// https://ziglang.org/documentation/master/std/#std.fs.File
- // hint: you might find two answers that are both vaild in this case
+ // hint: you might find two answers that are both valid in this case
- const bytes_read = zig_read_the_file_or_i_will_fight_you(&content);
+ const bytes_read = try file.read(&content);
diff --git a/patches/patches/109_vectors.patch b/patches/patches/109_vectors.patch
new file mode 100644
index 0000000..bf18cc0
--- /dev/null
+++ b/patches/patches/109_vectors.patch
@@ -0,0 +1,13 @@
+--- exercises/109_vectors.zig 2024-11-07 14:57:09.673383618 +0100
++++ answers/109_vectors.zig 2024-11-07 14:22:59.069150138 +0100
+@@ -121,8 +121,8 @@
+
+ const Vec4 = @Vector(4, f32);
+ fn calcMaxPairwiseDiffNew(a: Vec4, b: Vec4) f32 {
+- const abs_diff_vec = ???;
+- const max_diff = @reduce(???, abs_diff_vec);
++ const abs_diff_vec = @abs(a - b);
++ const max_diff = @reduce(.Max, abs_diff_vec);
+ return max_diff;
+ }
+
diff --git a/patches/patches/110_quiz9.patch b/patches/patches/110_quiz9.patch
new file mode 100644
index 0000000..9d9b864
--- /dev/null
+++ b/patches/patches/110_quiz9.patch
@@ -0,0 +1,56 @@
+--- exercises/110_quiz9.zig 2025-02-08 13:19:48.522641785 -0800
++++ answers/110_quiz9.zig 2025-02-10 17:42:04.525004335 -0800
+@@ -108,7 +108,7 @@
+ PORTB = 0b1100;
+ print(" {b:0>4} // (initial state of PORTB)\n", .{PORTB});
+ print("^ {b:0>4} // (bitmask)\n", .{0b0101});
+- PORTB ^= (1 << 1) | (1 << 0); // What's wrong here?
++ PORTB ^= (1 << 2) | (1 << 0);
+ checkAnswer(0b1001, PORTB);
+
+ newline();
+@@ -116,7 +116,7 @@
+ PORTB = 0b1100;
+ print(" {b:0>4} // (initial state of PORTB)\n", .{PORTB});
+ print("^ {b:0>4} // (bitmask)\n", .{0b0011});
+- PORTB ^= (1 << 1) & (1 << 0); // What's wrong here?
++ PORTB ^= (1 << 1) | (1 << 0);
+ checkAnswer(0b1111, PORTB);
+
+ newline();
+@@ -170,7 +170,7 @@
+ PORTB = 0b1001; // reset PORTB
+ print(" {b:0>4} // (initial state of PORTB)\n", .{PORTB});
+ print("| {b:0>4} // (bitmask)\n", .{0b0100});
+- PORTB = PORTB ??? (1 << 2); // What's missing here?
++ PORTB = PORTB | (1 << 2);
+ checkAnswer(0b1101, PORTB);
+
+ newline();
+@@ -178,7 +178,7 @@
+ PORTB = 0b1001; // reset PORTB
+ print(" {b:0>4} // (reset state)\n", .{PORTB});
+ print("| {b:0>4} // (bitmask)\n", .{0b0100});
+- PORTB ??? (1 << 2); // What's missing here?
++ PORTB |= (1 << 2);
+ checkAnswer(0b1101, PORTB);
+
+ newline();
+@@ -269,7 +269,7 @@
+ PORTB = 0b1110; // reset PORTB
+ print(" {b:0>4} // (initial state of PORTB)\n", .{PORTB});
+ print("& {b:0>4} // (bitmask)\n", .{0b1011});
+- PORTB = PORTB & ???@as(u4, 1 << 2); // What character is missing here?
++ PORTB = PORTB & ~@as(u4, 1 << 2);
+ checkAnswer(0b1010, PORTB);
+
+ newline();
+@@ -277,7 +277,7 @@
+ PORTB = 0b0111; // reset PORTB
+ print(" {b:0>4} // (reset state)\n", .{PORTB});
+ print("& {b:0>4} // (bitmask)\n", .{0b1110});
+- PORTB &= ~(1 << 0); // What's missing here?
++ PORTB &= ~@as(u4, 1 << 0);
+ checkAnswer(0b0110, PORTB);
+
+ newline();