From f659c2d39bcb450b30378ca4f119fd81e4d87329 Mon Sep 17 00:00:00 2001 From: camperbot Date: Tue, 18 Oct 2022 15:21:01 +0100 Subject: [PATCH] chore(i18n,learn): processed translations (#48111) --- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa1e8ccd579330e097ce44.md | 4 +- .../62aa1eec891ed731db227a36.md | 12 +++--- .../62aa1fed3d4e873366ff3131.md | 4 +- .../62aa204c1e1d33348ff09944.md | 4 +- .../62aa20e9cf1be9358f5aceae.md | 6 +-- .../62aa2136fc49b836dfedb959.md | 6 +-- .../62aa21971e3b743844849985.md | 12 +++--- .../62aa21ea8d9d9f396b95dd87.md | 6 +-- .../62aa226207f33d3ad4c6f546.md | 12 +++--- .../62aa22aba186563bcbf2c395.md | 8 ++-- .../62aa234322d4ad3e8bce42cc.md | 12 +++--- .../62aa2469c77b363fdb4f0e06.md | 10 ++--- .../62aa252c3b1073415ba2b898.md | 6 +-- .../62aa258da314ef42ba0a1858.md | 16 ++++---- .../62aa25fcb5837d43b4d9873d.md | 12 +++--- .../62aa2626c3c10244b94c787b.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- .../remove-an-element-from-a-max-heap.md | 40 ++++++++++++++----- .../5d822fd413a79914d39e98d5.md | 2 +- .../62aa2aec2f09d454253aad6c.md | 2 +- 40 files changed, 322 insertions(+), 162 deletions(-) diff --git a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index ecd6876805a..b452d276002 100644 --- a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( The `remove` method should remove the greatest element from the max heap while maintaining the max heap property. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index dc841313d87..01e995c8100 100644 --- a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -爲你的 `.bb1` 元素添加以下樣式屬性:`display: flex;`、`flex-direction: column;` 和 `align-items: center;`。 這將使用 “flex” 或 “flexbox” 將建築物居中。 你將在另一個項目中更詳細地瞭解它。 +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5f48991b690..17491c06783 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index ecd6876805a..b452d276002 100644 --- a/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( The `remove` method should remove the greatest element from the max heap while maintaining the max heap property. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index ca54ad6cdf3..690dbf02297 100644 --- a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -为你的 `.bb1` 元素添加以下样式属性:`display: flex;`、`flex-direction: column;` 和 `align-items: center;`。 这将使用 “flex” 或 “flexbox” 将建筑物居中。 你将在另一个项目中更详细地了解它。 +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5f48991b690..17491c06783 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index 443bbd9c395..844246919d5 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( The `remove` method should remove the greatest element from the max heap while maintaining the max heap property. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index a4ed32cbdaa..417e7ce4d42 100644 --- a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -Give your `.bb1` element these style properties: `display: flex;`, `flex-direction: column;`, and `align-items: center;`. This will center the parts of the building using "flex" or "flexbox". You will learn about it in more detail on another project. +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index c6991626e59..98d3761bc4c 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/german/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/german/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index ecd6876805a..b452d276002 100644 --- a/curriculum/challenges/german/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/german/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( The `remove` method should remove the greatest element from the max heap while maintaining the max heap property. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/german/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/german/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index 7f0b43b6b49..accc2077f00 100644 --- a/curriculum/challenges/german/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/german/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -Give your `.bb1` element these style properties: `display: flex;`, `flex-direction: column;`, and `align-items: center;`. This will center the parts of the building using "flex" or "flexbox". You will learn about it in more detail on another project. +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5f48991b690..17491c06783 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index 350de23d524..6928f071e72 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( Il metodo remove dovrebbe rimuovere l'elemento più grande dal max heap mantenendo la proprietà max heap. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index 57aaa0d6546..02eae816fe1 100644 --- a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -Dai all'elemento `.bb1` le proprietà `display: flex;`, `flex-direction: column;` e `align-items: center;`. Così centrerai le parti dell'edificio utilizzando "flex" o "flexbox". Ne imparerai di più in un altro progetto. +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md index 181a8937e1e..0d62091fc28 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md @@ -13,13 +13,13 @@ Usa la parola chiave `return` per restituire il valore di `hit` alla fine della # --hints-- -You should use the `return` keyword to return the value of `hit`. +Dovresti usare la parola chiave `return` per restituire il valore di `hit`. ```js assert.match(getMonsterAttackValue, /return\s*hit/); ``` -Your function should return the expected value. +La funzione dovrebbe restituire il valore atteso. ```js xp = 0; diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md index 725aa7e720a..4ea63159065 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md @@ -7,11 +7,11 @@ dashedName: step-147 # --description-- -If you play the game in its current state you might notice a bug. If your `xp` is high enough, the `getMonsterAttackValue` function will return a negative number, which will actually add to your total health when fighting a monster! +Se fai il gioco nel suo stato attuale potresti notare un bug. Se `xp` è abbastanza alto, la funzione `getMonsterAttackValue` restituirà un valore negativo, che in realtà si aggiungerà alla tua vita totale quando combatti un mostro! -In `getMonsterAttackValue`, change `return hit` to a ternary operator that returns `hit` if `hit` is greater than `0`, or returns `0` if it is not. +In `getMonsterAttackValue`, cambia `return hit` in un operatore ternario che restituisce `hit` se `hit` è maggiore di `0` o restituisce `0` se non lo è. -Here is an example of returning a value based on `condition` with a ternary: +Ecco un esempio su come restituire un valore in base a una condizione (`condition`) con un'espressione ternaria: ```js return condition ? true : false; @@ -19,19 +19,19 @@ return condition ? true : false; # --hints-- -You should use a ternary to change the `return` value if `hit` is greater than `0`. +Dovresti usare un ternario per cambiare il valore dato dal `return` se `hit` è maggiore di `0`. ```js assert.match(getMonsterAttackValue.toString(), /return\s+hit\s*>\s*0/); ``` -You should use a ternary to return `hit` if `hit` is greater than `0` +Dovresti usare un ternario per restituire `hit` se `hit` è maggiore di `0` ```js assert.match(getMonsterAttackValue.toString(), /return\s+hit\s*>\s*0\s*\?\s*hit/); ``` -You should use a ternary to return `0` if `hit` is not greater than `0`. +Dovresti usare un ternario per restituire `0` se `hit` non è maggiore di `0`. ```js assert.match(getMonsterAttackValue.toString(), /return\s+hit\s*>\s*0\s*\?\s*hit\s*:\s*0/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md index 97ce39a4821..2d7be19c063 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md @@ -7,11 +7,11 @@ dashedName: step-148 # --description-- -In your `attack` function, below the `health` variable create an `if` statement. Set the condition to call the `isMonsterHit` function. +Nella funzione `attack`, sotto la variabile `health`, crea un'istruzione `if`. Imposta la condizione in modo che chiami la funzione `isMonsterHit`. # --hints-- -You should add an `if` statement which calls `isMonsterHit` in the condition. +Dovresti aggiungere un'istruzione `if` che chiama `isMonsterHit` nella condizione. ```js assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\s*\(\s*\)/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md index 6b3bc12e219..b96d714e1fe 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md @@ -7,11 +7,11 @@ dashedName: step-149 # --description-- -Move your `monsterHealth` assignment into your `if` block. +Sposta l'assegnazione di `monsterHealth` nel blocco `if`. # --hints-- -You should move your `monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1` into your `if` block. +Dovresti spostare `monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1` nel blocco `if`. ```js assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md index 8bf8c85ac0e..d38184b4025 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md @@ -7,17 +7,17 @@ dashedName: step-150 # --description-- -Add an `else` statement to your `if` statement. In the `else` statement, use the `+=` operator to add the text `You miss.` to the end of `text.innerText`. +Aggiungi un'istruzione `else` all'istruzione `if`. Nell'istruzione `else`, usa l'operatore `+=` per aggiungere il testo `You miss.` alla fine di `text.innerText`. # --hints-- -You should add an `else` block after your `if (isMonsterHit())` block. +Dovresti aggiungere un blocco `else` dopo il blocco `if (isMonsterHit())`. ```js assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1;\s*\}\s*else/) ``` -You should add the text `You miss.` to the end of `text.innerText`. Remember to use compound assignment. +Dovresti aggiungere il testo `You miss.` alla fine di `text.innerText`. Ricordati di usare l'assegnazione composta. ```js assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1;\s*\}\s*else\s*\{\s*text\.innerText\s*\+=\s*('|")\sYou miss\.\1/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md index 7a5d427b22f..a4ead2b59e0 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md @@ -7,17 +7,17 @@ dashedName: step-151 # --description-- -Now create the `isMonsterHit` function. This will return a boolean value (true or false) to be used in your `if` statement. Return the result of the comparison `Math.random() > .2`. +Adesso crea la funzione `isMonsterHit`. Restituirà un valore booleano (true o false) da usare nell'istruzione `if`. Restituisci il risultato del confronto `Math.random() > .2`. # --hints-- -You should use the `function` keyword to declare `isMonsterHit`. +Dovresti usare la parola chiave `function` per dichiarare `isMonsterHit`. ```js assert.match(code, /function\s+isMonsterHit/); ``` -Your `isMonsterHit` function should return the result of the comparison `Math.random() > .2`. +La funzione `isMonsterHit` dovrebbe restituire il risultato del confronto `Math.random() > .2`. ```js assert.match(isMonsterHit.toString(), /return\s*Math\.random\(\)\s*>\s*0?\.2/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md index 2db80762083..158a432358f 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md @@ -7,27 +7,27 @@ dashedName: step-152 # --description-- -The player should hit if either `Math.random() > .2` **or** if the player's health is less than 20. At the end of your `return` statement, use the logical or operator `||` and check if `health` is less than `20`. +Il giocatore dovrebbe colpire se `Math.random() > .2` **o** se la vita del giocatore è minore di 20. Alla fine dell'istruzione `return`, usa l'operatore logico or, `||`, e verifica se `health` è minore di `20`. -The logical or operator will use the first value if it is truthy, otherwise it will use the second value. +L'operatore logico or userà il primo valore se è vero, altrimenti userà il secondo valore. -For example: `num < 10 || num > 20`. +Ad esempio: `num < 10 || num > 20`. # --hints-- -Your `isMonsterHit` function should use the logical or operator. +La funzione `isMonsterHit` dovrebbe usare l'operatore logico or. ```js assert.match(isMonsterHit.toString(), /\|\|/); ``` -Your logical or operator should use `health < 20` as the fallback value. +L'operatore logico or dovrebbe usare `health < 20` come valore di fallback. ```js assert.match(isMonsterHit.toString(), /\|\|\s*health\s*<\s*20/); ``` -Your function should return the result of the comparison `Math.random() > .2` **or** `health < 20`. +La funzione dovrebbe restituire il risultato del confronto `Math.random() > .2` **or** `health < 20`. ```js assert.match(isMonsterHit.toString(), /return\s*Math\.random\(\)\s*>\s*0?\.2\s*\|\|\s*health\s*<\s*20/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md index 34820846dd6..c9d9ab029f9 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md @@ -7,18 +7,18 @@ dashedName: step-153 # --description-- -On every attack, there should be a chance that the player's weapon breaks. At the end of the `attack` function, add an empty `if` expression with the condition `Math.random() <= .1`. +In ogni attacco, dovrebbe esserci la possibilità che l'arma del giocatore si rompa. Alla fine della funzione `attack`, aggiungi un'espressione `if` vuota con la condizione `Math.random() <= .1`. # --hints-- -You should add an `if` statement to your `attack` function. +Dovresti aggiungere un'istruzione `if` alla funzione `attack`. ```js const ifs = attack.toString().match(/if/g); assert.lengthOf(ifs, 4); ``` -Your new `if` statement should check `Math.random() <= .1`. +La nuova istruzione `if` dovrebbe verificare se `Math.random() <= .1`. ```js assert.match(attack.toString(), /if\s*\(\s*Math\.random\(\)\s*<=\s*0?\.1\s*\)/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md index 02ffeb838f6..a38c8054764 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md @@ -7,37 +7,37 @@ dashedName: step-154 # --description-- -Use the `+=` operator to add `Your [weapon] breaks.` to the end of `text.innerText`, replacing `weapon` with the last item in the `inventory` array. You can get this last item by using `inventory.pop()`, which will remove the last item in the array AND return it so it appears in your string. +Usa l'operatore `+=` per aggiungere `Your [weapon] breaks.` alla fine di `text.innerText`, sostituendo `weapon` con l'ultimo elemento nell'array `inventory`. Puoi ottenere l'ultimo elemento con `inventory.pop()`, che rimuove l'ultimo elemento nell'array E lo restituisce, così che appaia nella stringa. # --hints-- -You should use the compound assignment operator to modify `text.innerText`. +Dovresti usare l'operatore di assegnazione composta per modificare `text.innerText`. ```js const concat = attack.toString().match(/\+=/g); assert.lengthOf(concat, 3); ``` -You should use the `pop` method on the `inventory` array. +Dovresti usare il metodo `pop` sull'array `inventory`. ```js assert.match(attack.toString(), /inventory\.pop\(\)/); ``` -You should add the string " Your " to `text.innerText`. Remember that spacing matters. +Dovresti aggiungere la stringa " Your " a `text.innerText`. Ricorda che la spaziatura è importante. ```js assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1/); ``` -You should add the return value of `inventory.pop()` to the `Your` string. +Dovresti aggiungere il valore di ritorno di `inventory.pop()` alla stringa `Your`. ```js console.log(attack.toString()); assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1\s*\+\s*inventory\.pop\(\)/); ``` -You should add `breaks.` to the `"Your " + inventory.pop()` string. +Dovresti aggiungere `breaks.` alla stringa `"Your " + inventory.pop()`. ```js assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1\s*\+\s*inventory\.pop\(\)\s*\+\s*('|")\sbreaks\.\2/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md index 44980b592f0..f4d9a18a668 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md @@ -7,19 +7,19 @@ dashedName: step-155 # --description-- -Remember that the increment operator `++` can be used to increase a variable's value by 1. There is also a decrement operator `--` that can be used to decrease a variable's value by 1. +Ricorda che l'operatore di incremento `++` può essere usato per aumentare il valore di una variabile di 1. Esiste anche l'operatore di decremento `--` che può essere usato per diminuire il valore di una variabile di 1. -Decrement the value of `currentWeapon` in your `if` statement, after you update the text. +Decrementa il valore di `currentWeapon` nell'istruzione `if`, dopo l'aggiornamento del testo. # --hints-- -You should use the decrement operator. +Dovresti usare l'operatore di decremento. ```js assert.match(attack.toString(), /--/); ``` -You should decrement `currentWeapon` in your `if` statement. +Dovresti decrementare `currentWeapon` nell'istruzione `if`. ```js assert.match(attack.toString(), /currentWeapon\s*--/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md index 65fc9cd5576..a2a0f106bca 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md @@ -7,11 +7,11 @@ dashedName: step-156 # --description-- -We don't want a player's only weapon to break. The logical or operator checks if two statements are true. +Non vogliamo che l'unica arma di un giocatore si rompa. The logical or operator checks if two statements are true. -Use the logical and operator `&&` to add a second condition to your `if` statement. The player's weapon should only break if `inventory.length` does not equal (`!==`) one. +Usa l'operatore logico and, `&&`, per aggiungere una seconda condizione all'istruzione `if`. L'arma del giocatore dovrebbe rompersi solo se `inventory.length` non è uguale (`!==`) a uno. -Here is an example of an `if` statement with two conditions: +Ecco un esempio di istruzione `if` con due condizioni: ```js if (firstName === "Quincy" && lastName === "Larson") { @@ -21,19 +21,19 @@ if (firstName === "Quincy" && lastName === "Larson") { # --hints-- -You should not modify your existing `if` statement. +Non dovresti modificare l'istruzione `if` esistente. ```js assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1/); ``` -You should use the logical and operator `&&`. +Dovresti usare l'operatore logico `&&`. ```js assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1\s*&&/); ``` -You should use the logical and operator to check if `inventory.length` does not equal `1`. +Dovresti usare l'operatore logico and per verificare se `inventory.length` non è uguale a `1`. ```js assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1\s*&&\s*inventory\.length\s*\!\=\=\s*1\s*\)/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md index 10cb8603022..6a868835ec4 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md @@ -7,25 +7,25 @@ dashedName: step-157 # --description-- -Now you can add a small easter egg (hidden feature) to your game. +Ora puoi aggiungere un piccolo easter egg (funzionalità nascosta, letteralmente uovo di pasqua) al gioco. -Create a new function called `easterEgg` which calls the `update` function with `locations[7]` as the argument. +Crea una nuova funzione chiamata `easterEgg` che chiama la funzione `update` con `locations[7]` come argomento. # --hints-- -You should use the `function` keyword to declare `easterEgg`. +Dovresti usare la parola chiave `function` per dichiarare `easterEgg`. ```js assert.match(code, /function\s+easterEgg\s*/); ``` -`easterEgg` should call the `update` function. +`easterEgg` dovrebbe chiamare la funzione `update`. ```js assert.match(easterEgg.toString(), /update\(/); ``` -`easterEgg` should call the `update` function with `locations[7]` as the argument. +`easterEgg`dovrebbe chiamare la funzione `update` con `locations[7]` come argomento. ```js assert.match(easterEgg.toString(), /update\(\s*locations\[7\]\s*\)/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md index a502101c334..17cbff85c3f 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md @@ -7,17 +7,17 @@ dashedName: step-158 # --description-- -Create an empty `pick` function with a parameter named `guess`. +Crea una funzione vuota `pick` con un parametro chiamato `guess`. # --hints-- -You should use the `function` keyword to declare `pick`. +Dovresti usare la parola chiave `function` per dichiarare `pick`. ```js assert.match(code, /function\s+pick\s*/); ``` -`pick` should take a parameter named `guess`. +`pick` dovrebbe prendere un parametro chiamato `guess`. ```js assert.match(pick.toString(), /pick\s*\(\s*guess\s*\)/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md index 5f657de3877..a64da0836cc 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md @@ -7,43 +7,43 @@ dashedName: step-159 # --description-- -Create two new functions named `pickTwo` and `pickEight`. +Crea due nuove funzioni chiamate `pickTwo` e `pickEight`. -Inside each of those, call the `pick()` function and pass either `2` or `8` as the argument depending on the function name. +All'interno di ognuna, chiama la funzione `pick()` passando `2` o `8` come argomento a seconda del nome della funzione. # --hints-- -You should use the `function` keyword to declare `pickTwo`. +Dovresti usare la parola chiave `function` per dichiarare `pickTwo`. ```js assert.match(code, /function\s+pickTwo\s*/); ``` -You should use the `function` keyword to declare `pickEight`. +Dovresti usare la parola chiave `function` per dichiarare `pickEight`. ```js assert.match(code, /function\s+pickEight\s*/); ``` -`pickTwo` should call the `pick` function. +`pickTwo` dovrebbe chiamare la funzione `pick`. ```js assert.match(pickTwo.toString(), /pick\(/); ``` -`pickTwo` should call the `pick` function with `2` as the argument. +`pickTwo` dovrebbe chiamare la funzione `pick` con `2` come argomento. ```js assert.match(pickTwo.toString(), /pick\(\s*2\s*\)/); ``` -`pickEight` should call the `pick` function. +`pickEight` dovrebbe chiamare la funzione `pick`. ```js assert.match(pickEight.toString(), /pick\(/); ``` -`pickEight` should call the `pick` function with `8` as the argument. +`pickEight` dovrebbe chiamare la funzione `pick` con `8` come argomento. ```js assert.match(pickEight.toString(), /pick\(\s*8\s*\)/); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md index 01f3692b24e..61a79684f00 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md @@ -7,35 +7,35 @@ dashedName: step-160 # --description-- -Add another object to your `locations` array. Set `name` to `easter egg`, set `button text` to an array with the strings `2`, `8`, and `Go to town square?`, set `button functions` to an array with the variables `pickTwo`, `pickEight`, and `goTown`, and `text` to `You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!`. +Aggiungi un altro oggetto all'array `locations`. Set `name` to `easter egg`, set `button text` to an array with the strings `2`, `8`, and `Go to town square?`, set `button functions` to an array with the variables `pickTwo`, `pickEight`, and `goTown`, and `text` to `You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!`. # --hints-- -Your `locations` array should have 8 values. +L'array `locations` dovrebbe contenere 8 valori. ```js assert.lengthOf(locations, 8); ``` -Your eighth `locations` value should be an object. +L'ottavo valore di `locations` dovrebbe essere un oggetto. ```js assert.isObject(locations[7]); ``` -Your eighth `locations` value should have a `name` property with the value `easter egg`. +L'ottavo valore di `locations` dovrebbe avere una proprietà `name` con il valore `easter egg`. ```js assert.equal(locations[7].name, "easter egg"); ``` -Your eighth `locations` value should have a `button text` property with the value an array with the strings `2`, `8`, and `Go to town square?`. +L'ottavo valore di `locations` dovrebbe avere una proprietà `button text` con il valore di un array con le stringhe `2`, `8` e `Go to town square?`. ```js assert.deepEqual(locations[7]["button text"], ["2", "8", "Go to town square?"]); ``` -Your eighth `locations` value should have a `button functions` property with the value an array with the variables `pickTwo`, `pickEight`, and `goTown`. +L'ottavo valore di `locations` dovrebbe avere una proprietà `button functions` con il valore di un array con le variabili `pickTwo`, `pickEight` e `goTown`. ```js assert.deepEqual(locations[7]["button functions"], [pickTwo, pickEight, goTown]); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md index c335f2d7bc9..ec8f0b929e6 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md @@ -7,7 +7,7 @@ dashedName: step-161 # --description-- -Inside `pick`, use `let` to initialize a variable named `numbers` and set it to an empty array. +All'interno di `pick`, usa `let` per inizializzare una variabile chiamata `numbers` e impostala su un array vuoto. # --hints-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5f48991b690..17491c06783 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index 0dd072e980a..b3fe0799b1f 100644 --- a/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( The `remove` method should remove the greatest element from the max heap while maintaining the max heap property. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index c36cb168254..8fba23243fe 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -`.bb1` の要素のスタイルプロパティとして、`display: flex;`、`flex-direction: column;`、`align-items: center;` を設定してください。 この設定により「フレックス」または「フレックスボックス」と呼ばれる方法で、ビルのパーツが中央に配置されます。 フレックスボックスについては別のプロジェクトで詳しく学習します。 +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5f48991b690..17491c06783 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index 67b67d2505b..b7c58ee98b5 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( O método `remove` deve remover o maior elemento do Max Heap ao mesmo tempo em que mantém a propriedade do Max Heap. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index afb3a5c0b4d..978ce7985b6 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -Dê ao elemento `.bb1` estas propriedades de estilo: `display: flex;`, `flex-direction: column;` e `align-items: center;`. Isto centralizará as partes do edifício usando "flex" ou "flexbox". Você aprenderá sobre isso com mais detalhes em outro projeto. +Centralize as partes do seu edifício transformando o elemento `.bb1` em um elemento pai do flexbox. Use as propriedades `flex-direction` e `align-items` para centralizar os elementos filhos. # --hints-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5f48991b690..17491c06783 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints-- diff --git a/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md index cf4b23754e3..d3af667db1c 100644 --- a/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md +++ b/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md @@ -87,6 +87,21 @@ assert( The `remove` method should remove the greatest element from the max heap while maintaining the max heap property. ```js +function isHeap(arr, i, n) { + if (i >= (n - 1) / 2) { + return true; + } + if ( + arr[i] >= arr[2 * i + 1] && + arr[i] >= arr[2 * i + 2] && + isHeap(arr, 2 * i + 1, n) && + isHeap(arr, 2 * i + 2, n) + ) { + return true; + } + return false; +} + assert( (function () { var test = false; @@ -95,16 +110,21 @@ assert( } else { return false; } - test.insert(30); - test.insert(300); - test.insert(500); - test.insert(10); - let result = []; - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - result.push(test.remove()); - return result.join('') == '5003003010'; + let max = Infinity; + const [result, vals] = [[], [2, 15, 3, 7, 12, 7, 10, 90]]; + vals.forEach((val) => test.insert(val)); + for (let i = 0; i < vals.length; i++) { + const curHeap = test.print(); + const arr = curHeap[0] === null ? curHeap.slice(1) : curHeap; + if (!isHeap(arr, 0, arr.length - 1)) { + return false; + } + const removed = test.remove(); + if(removed > max) return false + max = removed; + result.push(removed); + } + return true })() ); ``` diff --git a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md index cb593930791..ce49c9c02a0 100644 --- a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md +++ b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98d5.md @@ -7,7 +7,7 @@ dashedName: step-13 # --description-- -Надайте своєму елементу `.bb1` наступні властивості стилю: `display: flex;`, `flex-direction: column;` та `align-items: center;`. Це зцентрує частини будівлі з допомогою «flex» або «flexbox». Детальніше про це ви дізнаєтесь в іншому проєкті. +Center the parts of your building by turning the `.bb1` element into a flexbox parent. Use the `flex-direction` and `align-items` properties to center the children. # --hints-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 7ce17063fe5..7b65ce68541 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -7,7 +7,7 @@ dashedName: step-174 # --description-- -Since you subtracted health from the player, you need to check `if` the player's `health` is less than or equal to `0`. If it is, call the `lose` function. +Since you subtracted health from the player, you need to check if the player's `health` is less than or equal to `0`. If it is, call the `lose` function. # --hints--