aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorWill Clardy <will@quexxon.net>2021-02-15 17:13:55 -0500
committerWill Clardy <will@quexxon.net>2021-02-15 17:13:55 -0500
commit304489ca1f465b5456fa8c21dd0ae4e4c6c48617 (patch)
tree45f2eba30d72f43df60cd9b053ebaea5dfe11f18 /patches
parent2f821bd5e83129445179ea7bd81260df74fff295 (diff)
downloadziglings-304489ca1f465b5456fa8c21dd0ae4e4c6c48617.tar.gz
ziglings-304489ca1f465b5456fa8c21dd0ae4e4c6c48617.tar.bz2
ziglings-304489ca1f465b5456fa8c21dd0ae4e4c6c48617.tar.xz
ziglings-304489ca1f465b5456fa8c21dd0ae4e4c6c48617.zip
Add remaining patch files
Diffstat (limited to 'patches')
-rw-r--r--patches/patches/03_assignment.patch13
-rw-r--r--patches/patches/04_arrays.patch13
-rw-r--r--patches/patches/05_arrays2.patch9
-rw-r--r--patches/patches/06_strings.patch13
-rw-r--r--patches/patches/07_strings2.patch9
-rw-r--r--patches/patches/08_quiz.patch15
-rw-r--r--patches/patches/09_if.patch5
-rw-r--r--patches/patches/10_if2.patch5
-rw-r--r--patches/patches/11_while.patch5
-rw-r--r--patches/patches/12_while2.patch5
-rw-r--r--patches/patches/13_while3.patch7
-rw-r--r--patches/patches/14_while4.patch5
-rw-r--r--patches/patches/15_for.patch5
-rw-r--r--patches/patches/16_for2.patch5
-rw-r--r--patches/patches/17_quiz2.patch17
-rw-r--r--patches/patches/18_functions.patch5
-rw-r--r--patches/patches/19_functions2.patch5
-rw-r--r--patches/patches/20_quiz3.patch19
-rw-r--r--patches/patches/21_errors.patch9
-rw-r--r--patches/patches/22_errors2.patch5
-rw-r--r--patches/patches/23_errors3.patch9
-rw-r--r--patches/patches/24_errors4.patch11
-rw-r--r--patches/patches/25_errors5.patch5
-rw-r--r--patches/patches/26_hello2.patch5
-rw-r--r--patches/patches/27_defer.patch5
-rw-r--r--patches/patches/28_defer2.patch5
-rw-r--r--patches/patches/29_errdefer.patch5
-rw-r--r--patches/patches/30_switch.patch3
-rw-r--r--patches/patches/31_switch2.patch3
-rw-r--r--patches/patches/32_unreachable.patch3
-rw-r--r--patches/patches/33_iferror.patch3
-rw-r--r--patches/patches/34_quiz4.patch9
-rw-r--r--patches/patches/35_enums.patch5
-rw-r--r--patches/patches/36_enums2.patch13
-rw-r--r--patches/patches/37_structs.patch5
-rw-r--r--patches/patches/38_structs2.patch8
-rw-r--r--patches/patches/39_pointers.patch5
-rw-r--r--patches/patches/40_pointers2.patch5
-rw-r--r--patches/patches/41_pointers3.patch5
-rw-r--r--patches/patches/42_pointers4.patch5
-rw-r--r--patches/patches/43_pointers5.patch5
-rw-r--r--patches/patches/44_quiz5.patch5
-rw-r--r--patches/patches/45_optionals.patch5
43 files changed, 263 insertions, 43 deletions
diff --git a/patches/patches/03_assignment.patch b/patches/patches/03_assignment.patch
index 8b13789..bef4b24 100644
--- a/patches/patches/03_assignment.patch
+++ b/patches/patches/03_assignment.patch
@@ -1 +1,12 @@
-
+37c37
+< const n: u8 = 50;
+---
+> var n: u8 = 50;
+40c40
+< const pi: u8 = 314159;
+---
+> const pi: u32 = 314159;
+42c42
+< const negative_eleven: u8 = -11;
+---
+> const negative_eleven: i8 = -11;
diff --git a/patches/patches/04_arrays.patch b/patches/patches/04_arrays.patch
index 8b13789..c6f9de3 100644
--- a/patches/patches/04_arrays.patch
+++ b/patches/patches/04_arrays.patch
@@ -1 +1,12 @@
-
+30c30
+< const some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 };
+---
+> var some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 };
+43c43
+< const fourth = some_primes[???];
+---
+> const fourth = some_primes[3];
+47c47
+< const length = some_primes.???;
+---
+> const length = some_primes.len;
diff --git a/patches/patches/05_arrays2.patch b/patches/patches/05_arrays2.patch
index 8b13789..1e7b6b1 100644
--- a/patches/patches/05_arrays2.patch
+++ b/patches/patches/05_arrays2.patch
@@ -1 +1,8 @@
-
+23c23
+< const leet = ???;
+---
+> const leet = le ++ et;
+28c28
+< const bit_pattern = [_]u8{ ??? } ** 3;
+---
+> const bit_pattern = [_]u8{ 1, 0, 0, 1 } ** 3;
diff --git a/patches/patches/06_strings.patch b/patches/patches/06_strings.patch
index 8b13789..040a73c 100644
--- a/patches/patches/06_strings.patch
+++ b/patches/patches/06_strings.patch
@@ -1 +1,12 @@
-
+22c22
+< const d: u8 = ziggy[???];
+---
+> const d: u8 = ziggy[4];
+26c26
+< const laugh = "ha " ???;
+---
+> const laugh = "ha " ** 3;
+33c33
+< const major_tom = major ??? tom;
+---
+> const major_tom = major ++ " " ++ tom;
diff --git a/patches/patches/07_strings2.patch b/patches/patches/07_strings2.patch
index 8b13789..34cd053 100644
--- a/patches/patches/07_strings2.patch
+++ b/patches/patches/07_strings2.patch
@@ -1 +1,8 @@
-
+18,20c18,20
+< Ziggy played guitar
+< Jamming good with Andrew Kelley
+< And the Spiders from Mars
+---
+> \\Ziggy played guitar
+> \\Jamming good with Andrew Kelley
+> \\And the Spiders from Mars
diff --git a/patches/patches/08_quiz.patch b/patches/patches/08_quiz.patch
index 8b13789..3d35a5a 100644
--- a/patches/patches/08_quiz.patch
+++ b/patches/patches/08_quiz.patch
@@ -1 +1,14 @@
-
+16c16
+< const x: u8 = 1;
+---
+> var x: u8 = 1;
+27c27
+< lang[???] = letters[x];
+---
+> lang[1] = letters[x];
+29,30c29,30
+< x = ???;
+< lang[2] = letters[???];
+---
+> x = 5;
+> lang[2] = letters[x];
diff --git a/patches/patches/09_if.patch b/patches/patches/09_if.patch
index 8b13789..46579ad 100644
--- a/patches/patches/09_if.patch
+++ b/patches/patches/09_if.patch
@@ -1 +1,4 @@
-
+26c26
+< if (foo) {
+---
+> if (foo == 1) {
diff --git a/patches/patches/10_if2.patch b/patches/patches/10_if2.patch
index 8b13789..e78f644 100644
--- a/patches/patches/10_if2.patch
+++ b/patches/patches/10_if2.patch
@@ -1 +1,4 @@
-
+13c13
+< var price: u8 = if ???;
+---
+> var price: u8 = if (discount) 17 else 20;
diff --git a/patches/patches/11_while.patch b/patches/patches/11_while.patch
index 8b13789..a892191 100644
--- a/patches/patches/11_while.patch
+++ b/patches/patches/11_while.patch
@@ -1 +1,4 @@
-
+24c24
+< while (???) {
+---
+> while (n < 1024) {
diff --git a/patches/patches/12_while2.patch b/patches/patches/12_while2.patch
index 8b13789..29ae763 100644
--- a/patches/patches/12_while2.patch
+++ b/patches/patches/12_while2.patch
@@ -1 +1,4 @@
-
+28c28
+< while (n < 1000) : ??? {
+---
+> while (n < 1000) : (n *= 2) {
diff --git a/patches/patches/13_while3.patch b/patches/patches/13_while3.patch
index 8b13789..b0172da 100644
--- a/patches/patches/13_while3.patch
+++ b/patches/patches/13_while3.patch
@@ -1 +1,6 @@
-
+27,28c27,28
+< if (n % 3 == 0) ???;
+< if (n % 5 == 0) ???;
+---
+> if (n % 3 == 0) continue;
+> if (n % 5 == 0) continue;
diff --git a/patches/patches/14_while4.patch b/patches/patches/14_while4.patch
index 8b13789..fb67587 100644
--- a/patches/patches/14_while4.patch
+++ b/patches/patches/14_while4.patch
@@ -1 +1,4 @@
-
+21c21
+< if (???) ???;
+---
+> if (n == 4) break;
diff --git a/patches/patches/15_for.patch b/patches/patches/15_for.patch
index 8b13789..e937221 100644
--- a/patches/patches/15_for.patch
+++ b/patches/patches/15_for.patch
@@ -1 +1,4 @@
-
+18c18
+< for (???) |???| {
+---
+> for (story) |scene| {
diff --git a/patches/patches/16_for2.patch b/patches/patches/16_for2.patch
index 8b13789..5aba37f 100644
--- a/patches/patches/16_for2.patch
+++ b/patches/patches/16_for2.patch
@@ -1 +1,4 @@
-
+27c27
+< for (bits) |bit, ???| {
+---
+> for (bits) |bit, i| {
diff --git a/patches/patches/17_quiz2.patch b/patches/patches/17_quiz2.patch
index 8b13789..b46dab6 100644
--- a/patches/patches/17_quiz2.patch
+++ b/patches/patches/17_quiz2.patch
@@ -1 +1,16 @@
-
+12c12
+< const std = import standard library;
+---
+> const std = @import("std");
+14c14
+< function main() void {
+---
+> pub fn main() void {
+19c19
+< ??? (i <= stop_at) : (i += 1) {
+---
+> while (i <= stop_at) : (i += 1) {
+23c23
+< std.debug.print("{}", .{???});
+---
+> std.debug.print("{}", .{i});
diff --git a/patches/patches/18_functions.patch b/patches/patches/18_functions.patch
index 8b13789..dd3f2f6 100644
--- a/patches/patches/18_functions.patch
+++ b/patches/patches/18_functions.patch
@@ -1 +1,4 @@
-
+31c31
+< ??? deepThought() ??? {
+---
+> fn deepThought() u8 {
diff --git a/patches/patches/19_functions2.patch b/patches/patches/19_functions2.patch
index 8b13789..254889a 100644
--- a/patches/patches/19_functions2.patch
+++ b/patches/patches/19_functions2.patch
@@ -1 +1,4 @@
-
+25c25
+< fn twoToThe(???) u32 {
+---
+> fn twoToThe(my_number: u32) u32 {
diff --git a/patches/patches/20_quiz3.patch b/patches/patches/20_quiz3.patch
index 8b13789..6a00d31 100644
--- a/patches/patches/20_quiz3.patch
+++ b/patches/patches/20_quiz3.patch
@@ -1 +1,18 @@
-
+24,25c24,25
+< fn printPowersOfTwo(numbers: [4]u16) ??? {
+< loop (numbers) |n| {
+---
+> fn printPowersOfTwo(numbers: [4]u16) void {
+> for (numbers) |n| {
+34c34
+< fn twoToThe(number: u16) ??? {
+---
+> fn twoToThe(number: u16) u16 {
+38c38
+< loop (n < number) : (n += 1) {
+---
+> while (n < number) : (n += 1) {
+42c42
+< return ???;
+---
+> return total;
diff --git a/patches/patches/21_errors.patch b/patches/patches/21_errors.patch
index 8b13789..b37b3c8 100644
--- a/patches/patches/21_errors.patch
+++ b/patches/patches/21_errors.patch
@@ -1 +1,8 @@
-
+12c12
+< ???,
+---
+> TooSmall,
+29c29
+< if (???) {
+---
+> if (number_error == MyNumberError.TooSmall) {
diff --git a/patches/patches/22_errors2.patch b/patches/patches/22_errors2.patch
index 8b13789..0501159 100644
--- a/patches/patches/22_errors2.patch
+++ b/patches/patches/22_errors2.patch
@@ -1 +1,4 @@
-
+22c22
+< var my_number: ??? = 5;
+---
+> var my_number: MyNumberError!u8 = 5;
diff --git a/patches/patches/23_errors3.patch b/patches/patches/23_errors3.patch
index 8b13789..a850116 100644
--- a/patches/patches/23_errors3.patch
+++ b/patches/patches/23_errors3.patch
@@ -1 +1,8 @@
-
+15c15
+< var b: u32 = addTwenty(4) ??? 22;
+---
+> var b: u32 = addTwenty(4) catch 22;
+22c22
+< fn addTwenty(n: u32) ??? {
+---
+> fn addTwenty(n: u32) MyNumberError!u32 {
diff --git a/patches/patches/24_errors4.patch b/patches/patches/24_errors4.patch
index 8b13789..bb3fc8f 100644
--- a/patches/patches/24_errors4.patch
+++ b/patches/patches/24_errors4.patch
@@ -1 +1,10 @@
-
+62c62,68
+< return detectProblems(n) ???
+---
+> return detectProblems(n) catch |err| {
+> if (err == MyNumberError.TooSmall) {
+> return 10;
+> }
+>
+> return err;
+> };
diff --git a/patches/patches/25_errors5.patch b/patches/patches/25_errors5.patch
index 8b13789..8aa59d4 100644
--- a/patches/patches/25_errors5.patch
+++ b/patches/patches/25_errors5.patch
@@ -1 +1,4 @@
-
+29c29
+< var x = detect(n);
+---
+> var x = try detect(n);
diff --git a/patches/patches/26_hello2.patch b/patches/patches/26_hello2.patch
index 8b13789..0065da5 100644
--- a/patches/patches/26_hello2.patch
+++ b/patches/patches/26_hello2.patch
@@ -1 +1,4 @@
-
+22c22
+< stdout.print("Hello world!\n", .{});
+---
+> try stdout.print("Hello world!\n", .{});
diff --git a/patches/patches/27_defer.patch b/patches/patches/27_defer.patch
index 8b13789..6ff7f98 100644
--- a/patches/patches/27_defer.patch
+++ b/patches/patches/27_defer.patch
@@ -1 +1,4 @@
-
+23c23
+< std.debug.print("Two\n", .{});
+---
+> defer std.debug.print("Two\n", .{});
diff --git a/patches/patches/28_defer2.patch b/patches/patches/28_defer2.patch
index 8b13789..c042c45 100644
--- a/patches/patches/28_defer2.patch
+++ b/patches/patches/28_defer2.patch
@@ -1 +1,4 @@
-
+21c21
+< std.debug.print(") ", .{}); // <---- how!?
+---
+> defer std.debug.print(") ", .{}); // <---- how!?
diff --git a/patches/patches/29_errdefer.patch b/patches/patches/29_errdefer.patch
index 8b13789..f93c56f 100644
--- a/patches/patches/29_errdefer.patch
+++ b/patches/patches/29_errdefer.patch
@@ -1 +1,4 @@
-
+35c34
+< std.debug.print("failed!\n", .{});
+---
+> errdefer std.debug.print("failed!\n", .{});
diff --git a/patches/patches/30_switch.patch b/patches/patches/30_switch.patch
index 8b13789..05cbe1a 100644
--- a/patches/patches/30_switch.patch
+++ b/patches/patches/30_switch.patch
@@ -1 +1,2 @@
-
+48a49
+> else => std.debug.print("?", .{}),
diff --git a/patches/patches/31_switch2.patch b/patches/patches/31_switch2.patch
index 8b13789..f786762 100644
--- a/patches/patches/31_switch2.patch
+++ b/patches/patches/31_switch2.patch
@@ -1 +1,2 @@
-
+33a34
+> else => '!',
diff --git a/patches/patches/32_unreachable.patch b/patches/patches/32_unreachable.patch
index 8b13789..0883932 100644
--- a/patches/patches/32_unreachable.patch
+++ b/patches/patches/32_unreachable.patch
@@ -1 +1,2 @@
-
+37a38
+> else => unreachable,
diff --git a/patches/patches/33_iferror.patch b/patches/patches/33_iferror.patch
index 8b13789..62904db 100644
--- a/patches/patches/33_iferror.patch
+++ b/patches/patches/33_iferror.patch
@@ -1 +1,2 @@
-
+36a37
+> MyNumberError.TooSmall => std.debug.print("<4. ", .{}),
diff --git a/patches/patches/34_quiz4.patch b/patches/patches/34_quiz4.patch
index 8b13789..b259352 100644
--- a/patches/patches/34_quiz4.patch
+++ b/patches/patches/34_quiz4.patch
@@ -1 +1,8 @@
-
+12c12
+< pub fn main() void {
+---
+> pub fn main() !void {
+15c15
+< const my_num: u32 = getNumber();
+---
+> const my_num: u32 = try getNumber();
diff --git a/patches/patches/35_enums.patch b/patches/patches/35_enums.patch
index 8b13789..ed2344b 100644
--- a/patches/patches/35_enums.patch
+++ b/patches/patches/35_enums.patch
@@ -1 +1,4 @@
-
+23c23
+< const Ops = enum { ??? };
+---
+> const Ops = enum { dec, inc, pow };
diff --git a/patches/patches/36_enums2.patch b/patches/patches/36_enums2.patch
index 8b13789..54a7094 100644
--- a/patches/patches/36_enums2.patch
+++ b/patches/patches/36_enums2.patch
@@ -1 +1,12 @@
-
+32c32
+< blue = ???,
+---
+> blue = 0x0000ff,
+54c54
+< \\ <span style="color: #{}">Blue</span>
+---
+> \\ <span style="color: #{x:0>6}">Blue</span>
+59c59
+< @enumToInt(???), // Oops! We're missing something!
+---
+> @enumToInt(Color.blue), // Oops! We're missing something!
diff --git a/patches/patches/37_structs.patch b/patches/patches/37_structs.patch
index 8b13789..c26510d 100644
--- a/patches/patches/37_structs.patch
+++ b/patches/patches/37_structs.patch
@@ -1 +1,4 @@
-
+38a39
+> health: u8,
+46a48
+> .health = 100,
diff --git a/patches/patches/38_structs2.patch b/patches/patches/38_structs2.patch
index 8b13789..5d0d188 100644
--- a/patches/patches/38_structs2.patch
+++ b/patches/patches/38_structs2.patch
@@ -1 +1,7 @@
-
+44a45,50
+> chars[1] = Character{
+> .class = Class.bard,
+> .gold = 10,
+> .health = 100,
+> .experience = 20,
+> };
diff --git a/patches/patches/39_pointers.patch b/patches/patches/39_pointers.patch
index 8b13789..57d67e5 100644
--- a/patches/patches/39_pointers.patch
+++ b/patches/patches/39_pointers.patch
@@ -1 +1,4 @@
-
+33c33
+< num2 = ???;
+---
+> num2 = num1_pointer.*;
diff --git a/patches/patches/40_pointers2.patch b/patches/patches/40_pointers2.patch
index 8b13789..a69cb20 100644
--- a/patches/patches/40_pointers2.patch
+++ b/patches/patches/40_pointers2.patch
@@ -1 +1,4 @@
-
+24c24
+< const b: *u8 = &a; // fix this!
+---
+> const b: *const u8 = &a; // fix this!
diff --git a/patches/patches/41_pointers3.patch b/patches/patches/41_pointers3.patch
index 8b13789..02f7744 100644
--- a/patches/patches/41_pointers3.patch
+++ b/patches/patches/41_pointers3.patch
@@ -1 +1,4 @@
-
+34c34
+< ??? p: ??? = undefined;
+---
+> var p: *u8 = undefined;
diff --git a/patches/patches/42_pointers4.patch b/patches/patches/42_pointers4.patch
index 8b13789..29ca2d0 100644
--- a/patches/patches/42_pointers4.patch
+++ b/patches/patches/42_pointers4.patch
@@ -1 +1,4 @@
-
+31c31
+< ??? = 5; // fix me!
+---
+> x.* = 5; // fix me!
diff --git a/patches/patches/43_pointers5.patch b/patches/patches/43_pointers5.patch
index 8b13789..8a73551 100644
--- a/patches/patches/43_pointers5.patch
+++ b/patches/patches/43_pointers5.patch
@@ -1 +1,4 @@
-
+60c60
+< printCharacter(???);
+---
+> printCharacter(&glorp);
diff --git a/patches/patches/44_quiz5.patch b/patches/patches/44_quiz5.patch
index 8b13789..44d4451 100644
--- a/patches/patches/44_quiz5.patch
+++ b/patches/patches/44_quiz5.patch
@@ -1 +1,4 @@
-
+21a22
+> var elephantB = Elephant{ .letter = 'B' };
+27a29
+> elephantB.tail = &elephantC;
diff --git a/patches/patches/45_optionals.patch b/patches/patches/45_optionals.patch
index 8b13789..c945b5a 100644
--- a/patches/patches/45_optionals.patch
+++ b/patches/patches/45_optionals.patch
@@ -1 +1,4 @@
-
+32c32
+< var answer: u8 = result;
+---
+> var answer: u8 = result orelse 42;