From 6aeae1413aa20f94a80909a27788726c986bef1e Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Wed, 31 Jan 2024 22:07:57 +0800 Subject: [PATCH 1/6] Add analyzer feedback for Annalyns Infiltration --- .../concept/annalyns-infiltration/.meta/design.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/exercises/concept/annalyns-infiltration/.meta/design.md b/exercises/concept/annalyns-infiltration/.meta/design.md index 4fb590e67..22f40a7ae 100644 --- a/exercises/concept/annalyns-infiltration/.meta/design.md +++ b/exercises/concept/annalyns-infiltration/.meta/design.md @@ -17,3 +17,15 @@ Nothing to report ## Prerequisites - `basics`: know how to define methods. + +## Analyzer + +This exercise could benefit from the following rules in the [analyzer]: + +- `actionable`: If the student used an `if` statement to return `true` or `false` in their solution, suggest to them the `if` is unnecessary. +- `actionable`: If the student compares a boolean variable with `true` or `false` (e.g. `knightIsAwake == true` or `archerIsAwake == false`), suggest to them the comparison is unnecessary. + +If the solution does not receive any of the above feedback, it must be exemplar. +Leave a `celebratory` comment to celebrate the success! + +[analyzer]: https://github.com/exercism/java-analyzer From fbad597138f13a53379cdfb0fcb1e890cd9ae6e7 Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Thu, 1 Feb 2024 21:52:25 +0800 Subject: [PATCH 2/6] Update analyzer according to comments --- .../annalyns-infiltration/.meta/design.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/exercises/concept/annalyns-infiltration/.meta/design.md b/exercises/concept/annalyns-infiltration/.meta/design.md index 22f40a7ae..6e0011245 100644 --- a/exercises/concept/annalyns-infiltration/.meta/design.md +++ b/exercises/concept/annalyns-infiltration/.meta/design.md @@ -22,8 +22,22 @@ Nothing to report This exercise could benefit from the following rules in the [analyzer]: -- `actionable`: If the student used an `if` statement to return `true` or `false` in their solution, suggest to them the `if` is unnecessary. -- `actionable`: If the student compares a boolean variable with `true` or `false` (e.g. `knightIsAwake == true` or `archerIsAwake == false`), suggest to them the comparison is unnecessary. +- `essential`: If student returns a boolean literal, tell them it is possible to directly return the result of a expression. For example: + ```java + // instead of + if (knightIsAwake) { + return true; + } else { + return false; + } + + // ... return the expression directly + return knightIsAwake; + ``` +- `essential`: If the student compares a boolean variable with a boolean literal (e.g. `knightIsAwake == true` or `archerIsAwake == false`), tell them this can be simplified to just the variables (e.g. `knightIsAwake` or `archerIsAwake`). +- `actionable`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them. +- `informative`: +If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`. If the solution does not receive any of the above feedback, it must be exemplar. Leave a `celebratory` comment to celebrate the success! From 5d1655f42c3bb9c42d1c2746d03004c0ef9e5d37 Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Thu, 1 Feb 2024 21:56:05 +0800 Subject: [PATCH 3/6] Make if statement comment essential --- exercises/concept/annalyns-infiltration/.meta/design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/concept/annalyns-infiltration/.meta/design.md b/exercises/concept/annalyns-infiltration/.meta/design.md index 6e0011245..de43a3098 100644 --- a/exercises/concept/annalyns-infiltration/.meta/design.md +++ b/exercises/concept/annalyns-infiltration/.meta/design.md @@ -35,7 +35,7 @@ This exercise could benefit from the following rules in the [analyzer]: return knightIsAwake; ``` - `essential`: If the student compares a boolean variable with a boolean literal (e.g. `knightIsAwake == true` or `archerIsAwake == false`), tell them this can be simplified to just the variables (e.g. `knightIsAwake` or `archerIsAwake`). -- `actionable`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them. +- `essential`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them. - `informative`: If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`. From c58d06fd606e93d6b804ca37fae115cc6064da73 Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Thu, 1 Feb 2024 22:01:33 +0800 Subject: [PATCH 4/6] Remove trailing space --- exercises/concept/annalyns-infiltration/.meta/design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/concept/annalyns-infiltration/.meta/design.md b/exercises/concept/annalyns-infiltration/.meta/design.md index de43a3098..48be270f5 100644 --- a/exercises/concept/annalyns-infiltration/.meta/design.md +++ b/exercises/concept/annalyns-infiltration/.meta/design.md @@ -36,7 +36,7 @@ This exercise could benefit from the following rules in the [analyzer]: ``` - `essential`: If the student compares a boolean variable with a boolean literal (e.g. `knightIsAwake == true` or `archerIsAwake == false`), tell them this can be simplified to just the variables (e.g. `knightIsAwake` or `archerIsAwake`). - `essential`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them. -- `informative`: +- `informative`: If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`. If the solution does not receive any of the above feedback, it must be exemplar. From c6c6889a24742828d4904b6b8284181359cbc29c Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Thu, 1 Feb 2024 22:03:09 +0800 Subject: [PATCH 5/6] Fix formatting --- exercises/concept/annalyns-infiltration/.meta/design.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exercises/concept/annalyns-infiltration/.meta/design.md b/exercises/concept/annalyns-infiltration/.meta/design.md index 48be270f5..6d184a3a7 100644 --- a/exercises/concept/annalyns-infiltration/.meta/design.md +++ b/exercises/concept/annalyns-infiltration/.meta/design.md @@ -36,8 +36,7 @@ This exercise could benefit from the following rules in the [analyzer]: ``` - `essential`: If the student compares a boolean variable with a boolean literal (e.g. `knightIsAwake == true` or `archerIsAwake == false`), tell them this can be simplified to just the variables (e.g. `knightIsAwake` or `archerIsAwake`). - `essential`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them. -- `informative`: -If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`. +- `informative`: If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`. If the solution does not receive any of the above feedback, it must be exemplar. Leave a `celebratory` comment to celebrate the success! From 1ead1b1d5b3b3720c5f9544cd22be52f9f8f208a Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Fri, 2 Feb 2024 12:55:30 +0800 Subject: [PATCH 6/6] Fix formatting --- .../annalyns-infiltration/.meta/design.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/exercises/concept/annalyns-infiltration/.meta/design.md b/exercises/concept/annalyns-infiltration/.meta/design.md index 6d184a3a7..d4084b93b 100644 --- a/exercises/concept/annalyns-infiltration/.meta/design.md +++ b/exercises/concept/annalyns-infiltration/.meta/design.md @@ -23,17 +23,19 @@ Nothing to report This exercise could benefit from the following rules in the [analyzer]: - `essential`: If student returns a boolean literal, tell them it is possible to directly return the result of a expression. For example: - ```java - // instead of - if (knightIsAwake) { - return true; - } else { - return false; - } - - // ... return the expression directly - return knightIsAwake; - ``` + + ```java + // instead of + if (knightIsAwake) { + return true; + } else { + return false; + } + + // ... return the expression directly + return knightIsAwake; + ``` + - `essential`: If the student compares a boolean variable with a boolean literal (e.g. `knightIsAwake == true` or `archerIsAwake == false`), tell them this can be simplified to just the variables (e.g. `knightIsAwake` or `archerIsAwake`). - `essential`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them. - `informative`: If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`.