From ea09a811838760c3391a3d580caa79fcd20635a6 Mon Sep 17 00:00:00 2001 From: colinleach Date: Sun, 8 Sep 2024 16:28:17 -0700 Subject: [PATCH 1/5] Concept exercise `annalyns-infiltration` updated, moved from `concepts.wip` --- config.json | 12 +++ .../annalyns-infiltration/.docs/hints.md | 1 + .../.docs/instructions.md | 65 +++++++++++++++ .../.docs/introduction.md | 83 +++++++++++++++++++ .../annalyns-infiltration/.docs/source.md | 7 ++ .../annalyns-infiltration/.meta/config.json | 23 +++++ .../annalyns-infiltration/.meta/exemplar.jl | 28 +++++++ .../annalyns-infiltration.jl | 11 +++ .../concept/annalyns-infiltration/runtests.jl | 71 ++++++++++++++++ 9 files changed, 301 insertions(+) create mode 100644 exercises/concept/annalyns-infiltration/.docs/hints.md create mode 100644 exercises/concept/annalyns-infiltration/.docs/instructions.md create mode 100644 exercises/concept/annalyns-infiltration/.docs/introduction.md create mode 100644 exercises/concept/annalyns-infiltration/.docs/source.md create mode 100644 exercises/concept/annalyns-infiltration/.meta/config.json create mode 100644 exercises/concept/annalyns-infiltration/.meta/exemplar.jl create mode 100644 exercises/concept/annalyns-infiltration/annalyns-infiltration.jl create mode 100644 exercises/concept/annalyns-infiltration/runtests.jl diff --git a/config.json b/config.json index 8a1bee8d..673c891c 100644 --- a/config.json +++ b/config.json @@ -45,6 +45,18 @@ ], "prerequisites": [], "status": "wip" + }, + { + "slug": "annalyns-infiltration", + "name": "annalyns-infiltration", + "uuid": "603c7f88-5250-427e-b5d8-f8306fdd9b03", + "concepts": [ + "booleans" + ], + "prerequisites": [ + "basics" + ], + "status": "wip" } ], "practice": [ diff --git a/exercises/concept/annalyns-infiltration/.docs/hints.md b/exercises/concept/annalyns-infiltration/.docs/hints.md new file mode 100644 index 00000000..b5296c36 --- /dev/null +++ b/exercises/concept/annalyns-infiltration/.docs/hints.md @@ -0,0 +1 @@ +# Hints diff --git a/exercises/concept/annalyns-infiltration/.docs/instructions.md b/exercises/concept/annalyns-infiltration/.docs/instructions.md new file mode 100644 index 00000000..af9e77ad --- /dev/null +++ b/exercises/concept/annalyns-infiltration/.docs/instructions.md @@ -0,0 +1,65 @@ +# Instructions + +In this exercise, you'll be writing some logic for a video game a friend is developing. The game's main character is Annalyn, a brave girl with a fierce and loyal pet dog. Unfortunately, disaster strikes, as her best friend Nóra is kidnapped while searching for berries in the forest. Annalyn will try to find and free Nóra, optionally taking her dog with her on this quest. + +Annalyn eventually finds the camp in which Nóra is imprisoned and it turns out there are two kidnappers: a mighty knight and a cunning archer. +The player is presented with some options for what to do next. +For each of the four possible options you need to write a function that tells the game whether it should show that option or not. + +## 1. Check if the 'Fast Attack' option should be shown + +If the knight is sleeping, then Annalyn will be able to make a quick attack into the camp before he can wake up properly and get his armour on. + +Implement a function named `can_do_fast_attack` that takes a boolean value which indicates if the knight is awake. This function returns `true` if the 'Fast Attack' action is available based on the state of the character. Otherwise, returns `false`: + +```julia-repl +julia> knight_awake = true; + +julia> can_do_fast_attack(knight_awake) +false +``` + + + +## 2. Check if the 'Spy' option should be shown + +The group can be spied upon if at least one of them is awake. Otherwise, spying is a waste of time. + +Implement a function named `can_spy` that takes three boolean values, indicating if the knight, archer and Nóra, respectively, are awake. The function returns `true` if the 'Spy' action is available based on the state of the characters. Otherwise, returns `false`: + +```julia-repl +julia> knight_awake = false; archer_awake = true; nóra_awake = false; + +julia> can_spy(knight_awake, archer_awake, nóra_awake) +true +``` + +## 3. Check if the 'Signal Prisoner' option should be shown + +Nóra can be signalled using bird sounds if she is awake and the archer is sleeping. If the archer is awake then Nóra can't be safely signaled because the archer is also trained in bird signalling! + +Implement a function named `can_signal_prisoner` that takes two boolean values, indicating if the archer and Nóra, respectively, are awake. The function returns `true` if the 'Signal Prisoner' action is available based on the state of the characters. Otherwise, returns `false`: + +```julia-repl +julia> archer_awake = false; nóra_awake = true; + +julia> can_signal_prisoner(archer_awake, nóra_awake) +true +``` + +## 4. Check if the 'Free Prisoner' option should be shown + +Annalyn can try sneaking into the camp to free Nóra. This is a risky thing to do and can only succeed in one of two ways: + - If Annalyn has her pet dog with her she can rescue Nóra if the archer is asleep. + The knight is scared of the dog and the archer will not have time to get ready before Annalyn and Nóra can escape. + - If Annalyn does not have her dog then she and Nóra must be very sneaky! + Annalyn can free Nóra if they are awake and the knight and archer are both sleeping, but if Nóra is sleeping they can't be rescued: they would be startled by Annalyn's sudden appearance and wake up the knight and archer. + +Implement a function named `can_free_prisoner` that takes four boolean values. The first three parameters indicate if the knight, archer and Nóra, respectively, are awake. The last parameter indicates if Annalyn's pet dog is present. The function returns `true` if the 'Free Prisoner' action is available based on the state of the characters. Otherwise, it returns `false`: + +```julia-repl +julia> knight_awake = false; archer_awake = true; nóra_awake = false; dog_present = false; + +julia> can_free_prisoner(knight_awake, archer_awake, nóra_awake, dog_present) +false +``` diff --git a/exercises/concept/annalyns-infiltration/.docs/introduction.md b/exercises/concept/annalyns-infiltration/.docs/introduction.md new file mode 100644 index 00000000..c796a04b --- /dev/null +++ b/exercises/concept/annalyns-infiltration/.docs/introduction.md @@ -0,0 +1,83 @@ +# Introduction + +## Booleans in Julia + +True or false values are represented by the `Bool` type. +It contains only two values: `true` and `false`. + +```julia-repl +julia> true +true + +julia> false +false + +julia> typeof(true) +Bool +``` + +## Boolean logic + +Imagine we have the following Boolean expressions in Julia: `5 > x` and `x != 0`. +If `x` was 3 they would both be `true`. +We can express statements like "is x less than 5 and not equal to y?" using [Boolean operators](https://docs.julialang.org/en/v1/manual/mathematical-operations/#Boolean-Operators): `!` (not), `&&` (and), `||` (or). + +In Julia (and many other programming languages), `&&` has a [higher precedence][operator-precedence] than `||` (in the same way that `*` is applied before `+`). +This means that `true || false && true` evaluates to `true` because it is parsed as `(true || false) && true`. +It is common to include explicit brackets anyway so that the reader doesn't need to think about this. + +### Logical _not_ + +`!` represents the logical "not" operation in Julia. +Not is also called negation. + +```julia-repl +julia> !false +true + +julia> false != true +true + +julia> 3 != "apple" +true + +julia> !(false == true) +true + +julia> !(1 < 7) +false +``` + +### Logical _and_ + +`&&` (two ampersands) represents logical "and" in Julia. + +```julia-repl +julia> 5 > 3 +true + +julia> 1 != 0 +true + +julia> (5 > 3) && (1 != 0) +true +``` + +Parentheses are optional and can make the code easier to read. + +### Logical _or_ + +`||` (two pipe characters) represents logical "or" in Julia. + +```julia-repl +julia> 5 * 5 == 25 +true + +julia> 2 < 1 +false + +julia> (5 * 5 == 25) || (2 < 1) +true +``` + +[operator-precedence]: https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity diff --git a/exercises/concept/annalyns-infiltration/.docs/source.md b/exercises/concept/annalyns-infiltration/.docs/source.md new file mode 100644 index 00000000..ad6b165d --- /dev/null +++ b/exercises/concept/annalyns-infiltration/.docs/source.md @@ -0,0 +1,7 @@ +# Source + +This exercise is based on the ["Booleans" exercise][source] of the Javascript track, designed by [Rishi Kothari][rishiosaur] and [Derk-Jan Karrenbeld][sleepless]. + +[source]: https://github.com/exercism/v3/tree/1b7c392e1cc576f3948ed55216611c42fabb19b1/languages/javascript/exercises/concept/booleans +[rishiosaur]: https://github.com/rishiosaur +[sleepless]: https://github.com/SleeplessByte diff --git a/exercises/concept/annalyns-infiltration/.meta/config.json b/exercises/concept/annalyns-infiltration/.meta/config.json new file mode 100644 index 00000000..2e955925 --- /dev/null +++ b/exercises/concept/annalyns-infiltration/.meta/config.json @@ -0,0 +1,23 @@ +{ + "blurb": "Learn about boolean expressions by implementing the quest logic for a new RPG.", + "language_versions": "≥1.0", + "files": { + "exemplar": [ + ".meta/exemplar.jl" + ], + "test": [ + "runtests.jl" + ], + "solution": [ + "annalyns-infiltration.jl" + ] + }, + "authors": [ + "SaschaMann" + ], + "contributors": [ + "cmcaine", + "colinleach" + ], + "forked_from": ["javascript/annalyns-infiltration"] +} diff --git a/exercises/concept/annalyns-infiltration/.meta/exemplar.jl b/exercises/concept/annalyns-infiltration/.meta/exemplar.jl new file mode 100644 index 00000000..7cf8a17e --- /dev/null +++ b/exercises/concept/annalyns-infiltration/.meta/exemplar.jl @@ -0,0 +1,28 @@ +""" + can_do_fast_attack(knight_awake) + +Return if a fast attack is possible. +""" +can_do_fast_attack(knight_awake) = !knight_awake + +""" + can_spy(knight_awake, archer_awake, prisoner_awake) + +Return if the spy action is possible. +""" +can_spy(knight_awake, archer_awake, prisoner_awake) = knight_awake || archer_awake || prisoner_awake + +""" + can_signal_prisoner(archer_awake, prisoner_awake) + +Return if signaling the prisoner is possible. +""" +can_signal_prisoner(archer_awake, prisoner_awake) = prisoner_awake && !archer_awake + +""" + can_free_prisoner(knight_awake, archer_awake, prisoner_awake, dog_present) + +Return if the prisoner can be freed. +""" +can_free_prisoner(knight_awake, archer_awake, prisoner_awake, dog_present) = + !knight_awake && !archer_awake && prisoner_awake || dog_present && !archer_awake diff --git a/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl b/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl new file mode 100644 index 00000000..77de5c27 --- /dev/null +++ b/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl @@ -0,0 +1,11 @@ +function can_do_fast_attack(knight_awake) +end + +function can_spy(knight_awake, archer_awake, nóra_awake) +end + +function can_signal_prisoner(archer_awake, nóra_awake) +end + +function can_free_prisoner(knight_awake, archer_awake, nóra_awake, dog_present) +end diff --git a/exercises/concept/annalyns-infiltration/runtests.jl b/exercises/concept/annalyns-infiltration/runtests.jl new file mode 100644 index 00000000..1d9ea95c --- /dev/null +++ b/exercises/concept/annalyns-infiltration/runtests.jl @@ -0,0 +1,71 @@ +using Test + +include("annalyns-infiltration.jl") + +# Julia 1.0 compat +# The function definition of eachrow is taken from Julia Base, +# released under the MIT license: https://julialang.org/license +if VERSION < v"1.1" + @eval eachrow(A) = (view(A, i, :) for i in axes(A, 1)) +end + +@testset verbose = true "tests" begin + @testset "fast attack" begin + @test !can_do_fast_attack(true) + @test can_do_fast_attack(false) + end + + @testset "spying" begin + character_state_combinations = Bool[ + 0 0 0 0; + 0 0 1 1; + 0 1 0 1; + 0 1 1 1; + 1 0 0 1; + 1 0 1 1; + 1 1 1 1; + ] + + for state in eachrow(character_state_combinations) + @test can_spy(state[1:3]...) == state[4] + end + end + + @testset "signaling prisoner" begin + character_state_combinations = Bool[ + 0 0 0; + 0 1 1; + 1 0 0; + 1 1 0; + ] + + for state in eachrow(character_state_combinations) + @test can_signal_prisoner(state[1:2]...) == state[3] + end + end + + @testset "freeing prisoner" begin + character_state_combinations = Bool[ + 0 0 0 0 0; + 0 0 0 1 1; + 0 0 1 0 1; + 0 0 1 1 1; + 0 1 0 0 0; + 0 1 0 1 0; + 0 1 1 0 0; + 0 1 1 1 0; + 1 0 0 0 0; + 1 0 0 1 1; + 1 0 1 0 0; + 1 0 1 1 1; + 1 1 0 0 0; + 1 1 0 1 0; + 1 1 1 0 0; + 1 1 1 1 0; + ] + + for state in eachrow(character_state_combinations) + @test can_free_prisoner(state[1:4]...) == state[5] + end + end +end From 23ae5cb5fe4f8f1cf826e757212dd6b0be09fb65 Mon Sep 17 00:00:00 2001 From: colinleach Date: Fri, 20 Sep 2024 11:44:37 -0700 Subject: [PATCH 2/5] partial fixes --- .../.docs/instructions.md | 62 ++++++++++++------ .../.docs/introduction.md | 65 ++++++------------- .../annalyns-infiltration.jl | 6 +- 3 files changed, 64 insertions(+), 69 deletions(-) diff --git a/exercises/concept/annalyns-infiltration/.docs/instructions.md b/exercises/concept/annalyns-infiltration/.docs/instructions.md index af9e77ad..793ba962 100644 --- a/exercises/concept/annalyns-infiltration/.docs/instructions.md +++ b/exercises/concept/annalyns-infiltration/.docs/instructions.md @@ -1,8 +1,12 @@ # Instructions -In this exercise, you'll be writing some logic for a video game a friend is developing. The game's main character is Annalyn, a brave girl with a fierce and loyal pet dog. Unfortunately, disaster strikes, as her best friend Nóra is kidnapped while searching for berries in the forest. Annalyn will try to find and free Nóra, optionally taking her dog with her on this quest. +In this exercise, you'll be writing some logic for a video game a friend is developing. +The game's main character is Annalyn, a brave girl with a fierce and loyal pet dog. +Unfortunately, disaster strikes, as her best friend is kidnapped while searching for berries in the forest. +Annalyn will try to find and free her friend, optionally taking her dog with her on this quest. + +Annalyn eventually finds the camp in which her friend is imprisoned and it turns out there are two kidnappers: a mighty knight and a cunning archer. -Annalyn eventually finds the camp in which Nóra is imprisoned and it turns out there are two kidnappers: a mighty knight and a cunning archer. The player is presented with some options for what to do next. For each of the four possible options you need to write a function that tells the game whether it should show that option or not. @@ -10,56 +14,72 @@ For each of the four possible options you need to write a function that tells th If the knight is sleeping, then Annalyn will be able to make a quick attack into the camp before he can wake up properly and get his armour on. -Implement a function named `can_do_fast_attack` that takes a boolean value which indicates if the knight is awake. This function returns `true` if the 'Fast Attack' action is available based on the state of the character. Otherwise, returns `false`: +Implement a function named `can_do_fast_attack` that takes a boolean value which indicates if the knight is awake. +This function returns `true` if the 'Fast Attack' action is available based on the state of the character. Otherwise, returns `false`: ```julia-repl -julia> knight_awake = true; +julia> knight_awake = true julia> can_do_fast_attack(knight_awake) false ``` - - ## 2. Check if the 'Spy' option should be shown The group can be spied upon if at least one of them is awake. Otherwise, spying is a waste of time. -Implement a function named `can_spy` that takes three boolean values, indicating if the knight, archer and Nóra, respectively, are awake. The function returns `true` if the 'Spy' action is available based on the state of the characters. Otherwise, returns `false`: +Implement a function named `can_spy` that takes three boolean values, indicating if the knight, archer and prisoner, respectively, are awake. +The function returns `true` if the 'Spy' action is available based on the state of the characters. +Otherwise, returns `false`: ```julia-repl -julia> knight_awake = false; archer_awake = true; nóra_awake = false; +# Output suppressed from the next 3 lines +julia> knight_awake = false +julia> archer_awake = true +julia> prisoner_awake = false -julia> can_spy(knight_awake, archer_awake, nóra_awake) +julia> can_spy(knight_awake, archer_awake, prisoner_awake) true ``` ## 3. Check if the 'Signal Prisoner' option should be shown -Nóra can be signalled using bird sounds if she is awake and the archer is sleeping. If the archer is awake then Nóra can't be safely signaled because the archer is also trained in bird signalling! +The prisoner can be signalled using bird sounds if she is awake and the archer is sleeping. +If the archer is awake then can't be safely signaled because the archer is also trained in bird signalling. -Implement a function named `can_signal_prisoner` that takes two boolean values, indicating if the archer and Nóra, respectively, are awake. The function returns `true` if the 'Signal Prisoner' action is available based on the state of the characters. Otherwise, returns `false`: +Implement a function named `can_signal_prisoner` that takes two boolean values, indicating if the archer and prisoner, respectively, are awake. +The function returns `true` if the 'Signal Prisoner' action is available based on the state of the characters. +Otherwise, returns `false`: ```julia-repl -julia> archer_awake = false; nóra_awake = true; +julia> archer_awake = false +julia> prisoner_awake = true -julia> can_signal_prisoner(archer_awake, nóra_awake) +julia> can_signal_prisoner(archer_awake, prisoner_awake) true ``` ## 4. Check if the 'Free Prisoner' option should be shown -Annalyn can try sneaking into the camp to free Nóra. This is a risky thing to do and can only succeed in one of two ways: - - If Annalyn has her pet dog with her she can rescue Nóra if the archer is asleep. - The knight is scared of the dog and the archer will not have time to get ready before Annalyn and Nóra can escape. - - If Annalyn does not have her dog then she and Nóra must be very sneaky! - Annalyn can free Nóra if they are awake and the knight and archer are both sleeping, but if Nóra is sleeping they can't be rescued: they would be startled by Annalyn's sudden appearance and wake up the knight and archer. +Annalyn can try sneaking into the camp to free her friend. This is a risky thing to do and can only succeed in one of two ways: + +- If Annalyn has her pet dog with her she can rescue the prisoner if the archer is asleep. + The knight is scared of the dog and the archer will not have time to get ready before Annalyn and her friend can escape. + +- If Annalyn does not have her dog then she and the prisoner must be very sneaky! + Annalyn can free the prisoner if they are awake and the knight and archer are both sleeping, but if he prisoner is sleeping they can't be rescued: they would be startled by Annalyn's sudden appearance and wake up the knight and archer. -Implement a function named `can_free_prisoner` that takes four boolean values. The first three parameters indicate if the knight, archer and Nóra, respectively, are awake. The last parameter indicates if Annalyn's pet dog is present. The function returns `true` if the 'Free Prisoner' action is available based on the state of the characters. Otherwise, it returns `false`: +Implement a function named `can_free_prisoner` that takes four boolean values. +The first three parameters indicate if the knight, archer and prisoner, respectively, are awake. +The last parameter indicates if Annalyn's pet dog is present. +The function returns `true` if the 'Free Prisoner' action is available based on the state of the characters. Otherwise, it returns `false`: ```julia-repl -julia> knight_awake = false; archer_awake = true; nóra_awake = false; dog_present = false; +julia> knight_awake = false +julia> archer_awake = true +julia> prisoner_awake = false +julia> dog_present = false -julia> can_free_prisoner(knight_awake, archer_awake, nóra_awake, dog_present) +julia> can_free_prisoner(knight_awake, archer_awake, prisoner_awake, dog_present) false ``` diff --git a/exercises/concept/annalyns-infiltration/.docs/introduction.md b/exercises/concept/annalyns-infiltration/.docs/introduction.md index c796a04b..4b37877b 100644 --- a/exercises/concept/annalyns-infiltration/.docs/introduction.md +++ b/exercises/concept/annalyns-infiltration/.docs/introduction.md @@ -11,73 +11,48 @@ true julia> false false - -julia> typeof(true) -Bool ``` -## Boolean logic - -Imagine we have the following Boolean expressions in Julia: `5 > x` and `x != 0`. -If `x` was 3 they would both be `true`. -We can express statements like "is x less than 5 and not equal to y?" using [Boolean operators](https://docs.julialang.org/en/v1/manual/mathematical-operations/#Boolean-Operators): `!` (not), `&&` (and), `||` (or). - -In Julia (and many other programming languages), `&&` has a [higher precedence][operator-precedence] than `||` (in the same way that `*` is applied before `+`). -This means that `true || false && true` evaluates to `true` because it is parsed as `(true || false) && true`. -It is common to include explicit brackets anyway so that the reader doesn't need to think about this. +## Boolean Operators -### Logical _not_ +There are three Boolean operators in Julia. -`!` represents the logical "not" operation in Julia. -Not is also called negation. +`&&` is Boolean "and". +It evaluates to `true` if the expressions on *both* sides of `&&` are `true`. ```julia-repl -julia> !false -true - -julia> false != true +julia> true && true true -julia> 3 != "apple" -true - -julia> !(false == true) -true - -julia> !(1 < 7) +julia> true && false false ``` -### Logical _and_ - -`&&` (two ampersands) represents logical "and" in Julia. +`||` is Boolean "or". +It evaluates to `true` if an expression on *either* side of `||` is `true`. ```julia-repl -julia> 5 > 3 +julia> true || true true -julia> 1 != 0 -true - -julia> (5 > 3) && (1 != 0) +julia> false || true true ``` -Parentheses are optional and can make the code easier to read. - -### Logical _or_ - -`||` (two pipe characters) represents logical "or" in Julia. +`!` is Boolean "not". +It exchanges `true` and `false` values. ```julia-repl -julia> 5 * 5 == 25 -true - -julia> 2 < 1 +julia> !true false -julia> (5 * 5 == 25) || (2 < 1) +julia> !false true ``` -[operator-precedence]: https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity +For longer and more complicated expressions, it is best to use parentheses to make your intention clear. + +```julia-repl +julia> (true || false) && (false && true) +false +``` \ No newline at end of file diff --git a/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl b/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl index 77de5c27..151f8e41 100644 --- a/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl +++ b/exercises/concept/annalyns-infiltration/annalyns-infiltration.jl @@ -1,11 +1,11 @@ function can_do_fast_attack(knight_awake) end -function can_spy(knight_awake, archer_awake, nóra_awake) +function can_spy(knight_awake, archer_awake, prisoner_awake) end -function can_signal_prisoner(archer_awake, nóra_awake) +function can_signal_prisoner(archer_awake, prisoner_awake) end -function can_free_prisoner(knight_awake, archer_awake, nóra_awake, dog_present) +function can_free_prisoner(knight_awake, archer_awake, prisoner_awake, dog_present) end From 0e6d56df4d0eb89a3bc8c6941c1c733911ea1295 Mon Sep 17 00:00:00 2001 From: colinleach Date: Fri, 20 Sep 2024 12:04:41 -0700 Subject: [PATCH 3/5] added hints.md --- .../annalyns-infiltration/.meta/config.json | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/exercises/concept/annalyns-infiltration/.meta/config.json b/exercises/concept/annalyns-infiltration/.meta/config.json index 2e955925..4328e880 100644 --- a/exercises/concept/annalyns-infiltration/.meta/config.json +++ b/exercises/concept/annalyns-infiltration/.meta/config.json @@ -1,23 +1,26 @@ { - "blurb": "Learn about boolean expressions by implementing the quest logic for a new RPG.", - "language_versions": "≥1.0", + "authors": [ + "SaschaMann", + "colinleach" + ], + "contributors": [ + "cmcaine", + "BNAndras" + ], "files": { - "exemplar": [ - ".meta/exemplar.jl" + "solution": [ + "annalyns-infiltration.jl" ], "test": [ "runtests.jl" ], - "solution": [ - "annalyns-infiltration.jl" + "exemplar": [ + ".meta/exemplar.jl" ] }, - "authors": [ - "SaschaMann" - ], - "contributors": [ - "cmcaine", - "colinleach" + "language_versions": "≥1.0", + "forked_from": [ + "javascript/annalyns-infiltration" ], - "forked_from": ["javascript/annalyns-infiltration"] + "blurb": "Learn about boolean expressions by implementing the quest logic for a new RPG." } From 0a0adb5cb5c1d14bebf21500dd46c82ea625f433 Mon Sep 17 00:00:00 2001 From: colinleach Date: Fri, 20 Sep 2024 12:09:40 -0700 Subject: [PATCH 4/5] fixed name in config.sys --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index ed9016da..607c6432 100644 --- a/config.json +++ b/config.json @@ -48,7 +48,7 @@ }, { "slug": "annalyns-infiltration", - "name": "annalyns-infiltration", + "name": "Annalyns Infiltration", "uuid": "603c7f88-5250-427e-b5d8-f8306fdd9b03", "concepts": [ "booleans" From f6e55f11c3f3f9fb7a9070a1da95ca58df8e3e49 Mon Sep 17 00:00:00 2001 From: colinleach Date: Fri, 20 Sep 2024 12:39:32 -0700 Subject: [PATCH 5/5] Update hints.md Failed to save before committing. Time to stop for lunch, I think. --- .../annalyns-infiltration/.docs/hints.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/exercises/concept/annalyns-infiltration/.docs/hints.md b/exercises/concept/annalyns-infiltration/.docs/hints.md index b5296c36..36983b20 100644 --- a/exercises/concept/annalyns-infiltration/.docs/hints.md +++ b/exercises/concept/annalyns-infiltration/.docs/hints.md @@ -1 +1,23 @@ # Hints + +## General + +- There are three [boolean operators][boolean-operators] to work with boolean values. +- Multiple operators can be combined in a single expression. + +## 1. Check if a fast attack can be made + +- The logical NOT operator (`!`) can be placed before an expression to negate its value. + +## 2. Check if the group can be spied upon + +- Boolean operators are typically used to evaluate whether two or more expressions are true or not true. + +## 3. Check if the prisoner can be signaled + +- Boolean operators execute in the order of their precedence (from highest to lowest): `!`, `&&`, `||`. +- In general, use of parentheses is encouraged to make your intention clearer. +- For more details check out the Operator Precedence section on the [official Julia documentation][operator-precedence]. + +[boolean-operators]: https://docs.julialang.org/en/v1/manual/mathematical-operations/#Boolean-Operators +[operator-precedence]: https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity