Skip to content

Commit

Permalink
Merge branch 'main' into refactor-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ee7 committed Oct 30, 2023
2 parents 4083c4e + afd5021 commit b0fdc6a
Show file tree
Hide file tree
Showing 29 changed files with 150 additions and 122 deletions.
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
interval: 'monthly'
time: '07:00'
commit-message:
prefix: '.github'
16 changes: 9 additions & 7 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"slug": "lasagna",
"name": "Lasagna",
"uuid": "3d6fc9bc-c451-4ae5-b322-3ae805c66eb0",
"concepts": ["basics"],
"concepts": [
"basics"
],
"prerequisites": [],
"status": "wip"
}
Expand Down Expand Up @@ -335,7 +337,6 @@
"practices": [],
"prerequisites": [],
"difficulty": 1,
"topics": null,
"status": "deprecated"
},
{
Expand Down Expand Up @@ -853,6 +854,7 @@
"topics": [
"bitwise_operations",
"conditionals",
"enumerations",
"integers",
"lists",
"logic",
Expand Down Expand Up @@ -1020,16 +1022,16 @@
}
],
"tags": [
"execution_mode/compiled",
"paradigm/imperative",
"paradigm/procedural",
"typing/static",
"typing/strong",
"execution_mode/compiled",
"platform/windows",
"platform/mac",
"platform/linux",
"platform/mac",
"platform/web",
"platform/windows",
"runtime/standalone_executable",
"typing/static",
"typing/strong",
"used_for/backends",
"used_for/cross_platform_development",
"used_for/embedded_systems",
Expand Down
10 changes: 5 additions & 5 deletions exercises/practice/acronym/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace)

For example:

|Input|Output|
|-|-|
|As Soon As Possible|ASAP|
|Liquid-crystal display|LCD|
|Thank George It's Friday!|TGIF|
| Input | Output |
| ------------------------- | ------ |
| As Soon As Possible | ASAP |
| Liquid-crystal display | LCD |
| Thank George It's Friday! | TGIF |
8 changes: 4 additions & 4 deletions exercises/practice/all-your-base/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ Given a number in base **a**, represented as a sequence of digits, convert it to

In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**.

The number 42, *in base 10*, means:
The number 42, _in base 10_, means:

`(4 * 10^1) + (2 * 10^0)`

The number 101010, *in base 2*, means:
The number 101010, _in base 2_, means:

`(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)`

The number 1120, *in base 3*, means:
The number 1120, _in base 3_, means:

`(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)`

I think you got the idea!

*Yes. Those three numbers above are exactly the same. Congratulations!*
_Yes. Those three numbers above are exactly the same. Congratulations!_

[positional-notation]: https://en.wikipedia.org/wiki/Positional_notation
2 changes: 1 addition & 1 deletion exercises/practice/allergies/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say:
- Whether Tom is allergic to any one of those allergens listed above.
- All the allergens Tom is allergic to.

Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
Your program should ignore those components of the score.
For example, if the allergy score is 257, your program should only report the eggs (1) allergy.
5 changes: 5 additions & 0 deletions exercises/practice/anagram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ description = "detects anagrams using case-insensitive possible matches"

[7cc195ad-e3c7-44ee-9fd2-d3c344806a2c]
description = "does not detect an anagram if the original word is repeated"
include = false

[630abb71-a94e-4715-8395-179ec1df9f91]
description = "does not detect an anagram if the original word is repeated"
reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c"

[9878a1c9-d6ea-4235-ae51-3ea2befd6842]
description = "anagrams must use all letters exactly once"
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/anagram/test_anagram.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ suite "Anagram":

test "does not detect an anagram if the original word is repeated":
const word = "go"
const candidates = @["go Go GO"]
const candidates = @["goGoGO"]
check detectAnagrams(word, candidates).len == 0

test "anagrams must use all letters exactly once":
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/armstrong-numbers/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ An [Armstrong number][armstrong-number] is a number that is the sum of its own d
For example:

- 9 is an Armstrong number, because `9 = 9^1 = 9`
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`

Write some code to determine whether a number is an Armstrong number.

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/binary-search/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Binary search only works when a list has been sorted.

The algorithm looks like this:

- Find the middle element of a *sorted* list and compare it with the item we're looking for.
- Find the middle element of a _sorted_ list and compare it with the item we're looking for.
- If the middle element is our item, then we're done!
- If the middle element is greater than our item, we can eliminate that element and all the elements **after** it.
- If the middle element is less than our item, we can eliminate that element and all the elements **before** it.
Expand Down
3 changes: 1 addition & 2 deletions exercises/practice/clock/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
]
},
"blurb": "Implement a clock that handles times without dates.",
"source": "Pairing session with Erin Drummond",
"source_url": "https://twitter.com/ebdrummond"
"source": "Pairing session with Erin Drummond"
}
8 changes: 8 additions & 0 deletions exercises/practice/darts/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Write a function that returns the earned points in a single toss of a Darts game

In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands:

![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg)

- If the dart lands outside the target, player earns no points (0 points).
- If the dart lands in the outer circle of the target, player earns 1 point.
- If the dart lands in the middle circle of the target, player earns 5 points.
Expand All @@ -16,8 +18,14 @@ Of course, they are all centered at the same point — that is, the circles are

Write a function that given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), returns the correct amount earned by a dart landing at that point.

## Credit

The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape].

[darts]: https://en.wikipedia.org/wiki/Darts
[darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg
[concentric]: https://mathworld.wolfram.com/ConcentricCircles.html
[cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html
[real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html
[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire
[inkscape]: https://en.wikipedia.org/wiki/Inkscape
2 changes: 1 addition & 1 deletion exercises/practice/isogram/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Examples of isograms:
- downstream
- six-year-old

The word *isograms*, however, is not an isogram, because the s repeats.
The word _isograms_, however, is not an isogram, because the s repeats.
2 changes: 1 addition & 1 deletion exercises/practice/meetup/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
},
"blurb": "Calculate the date of meetups.",
"source": "Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month",
"source_url": "https://twitter.com/copiousfreetime"
"source_url": "http://www.copiousfreetime.org/"
}
5 changes: 2 additions & 3 deletions exercises/practice/perfect-numbers/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Instructions

Determine if a number is perfect, abundant, or deficient based on
Nicomachus' (60 - 120 CE) classification scheme for positive integers.
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.

The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum][aliquot-sum].
The aliquot sum is defined as the sum of the factors of a number not including the number itself.
For example, the aliquot sum of 15 is (1 + 3 + 5) = 9
For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`.

- **Perfect**: aliquot sum = number
- 6 is a perfect number because (1 + 2 + 3) = 6
Expand Down
10 changes: 6 additions & 4 deletions exercises/practice/phone-number/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ Clean up user-entered phone numbers so that they can be sent SMS messages.
The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda.
All NANP-countries share the same international country code: `1`.

NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number.
The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*.
NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number.
The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_.

The format is usually represented as

```text
(NXX)-NXX-XXXX
NXX NXX-XXXX
```

where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.

Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
Sometimes they also have the country code (represented as `1` or `+1`) prefixed.

Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present.

For example, the inputs

Expand Down
20 changes: 10 additions & 10 deletions exercises/practice/protein-translation/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ Note the stop codon `"UAA"` terminates the translation and the final methionine

Below are the codons and resulting Amino Acids needed for the exercise.

Codon | Protein
:--- | :---
AUG | Methionine
UUU, UUC | Phenylalanine
UUA, UUG | Leucine
UCU, UCC, UCA, UCG | Serine
UAU, UAC | Tyrosine
UGU, UGC | Cysteine
UGG | Tryptophan
UAA, UAG, UGA | STOP
| Codon | Protein |
| :----------------- | :------------ |
| AUG | Methionine |
| UUU, UUC | Phenylalanine |
| UUA, UUG | Leucine |
| UCU, UCC, UCA, UCG | Serine |
| UAU, UAC | Tyrosine |
| UGU, UGC | Cysteine |
| UGG | Tryptophan |
| UAA, UAG, UGA | STOP |

Learn more about [protein translation on Wikipedia][protein-translation].

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/queen-attack/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ So if you are told the white queen is at `c5` (zero-indexed at column 2, row 3)
a b c d e f g h
```

You are also be able to answer whether the queens can attack each other.
You are also able to answer whether the queens can attack each other.
In this case, that answer would be yes, they can, because both pieces share a diagonal.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For this exercise, you need to know only three things about them:
- Grey: 8
- White: 9

In `resistor-color duo` you decoded the first two colors.
In Resistor Color Duo you decoded the first two colors.
For instance: orange-orange got the main value `33`.
The third color stands for how many zeros need to be added to the main value.
The main value plus the zeros gives us a value in ohms.
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/roman-numerals/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ In Roman numerals 1990 is MCMXC:
2000=MM
8=VIII

Learn more about [Roman numberals on Wikipedia][roman-numerals].
Learn more about [Roman numerals on Wikipedia][roman-numerals].

[roman-numerals]: https://wiki.imperivm-romanvm.com/wiki/Roman_Numerals
4 changes: 2 additions & 2 deletions exercises/practice/rotational-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Ciphertext is written out in the same formatting as the input including spaces a

## Examples

- ROT5 `omg` gives `trl`
- ROT0 `c` gives `c`
- ROT5 `omg` gives `trl`
- ROT0 `c` gives `c`
- ROT26 `Cool` gives `Cool`
- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.`
- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.`
33 changes: 17 additions & 16 deletions exercises/practice/saddle-points/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# Instructions

Detect saddle points in a matrix.
Your task is to find the potential trees where you could build your tree house.

So say you have a matrix like so:
The data company provides the data as grids that show the heights of the trees.
The rows of the grid represent the east-west direction, and the columns represent the north-south direction.

```text
1 2 3
|---------
1 | 9 8 7
2 | 5 3 2 <--- saddle point at row 2, column 1, with value 5
3 | 6 6 7
```

It has a saddle point at row 2, column 1.
An acceptable tree will be the largest in its row, while being the smallest in its column.

It's called a "saddle point" because it is greater than or equal to every element in its row and less than or equal to every element in its column.
A grid might not have any good trees at all.
Or it might have one, or even several.

A matrix may have zero or more saddle points.
Here is a grid that has exactly one candidate tree.

Your code should be able to provide the (possibly empty) list of all the saddle points for any given matrix.
```text
1 2 3 4
|-----------
1 | 9 8 7 8
2 | 5 3 2 4 <--- potential tree house at row 2, column 1, for tree with height 5
3 | 6 6 7 1
```

The matrix can have a different number of rows and columns (Non square).
- Row 2 has values 5, 3, 2, and 4. The largest value is 5.
- Column 1 has values 9, 5, and 6. The smallest value is 5.

Note that you may find other definitions of matrix saddle points online, but the tests for this exercise follow the above unambiguous definition.
So the point at `[2, 1]` (row: 2, column: 1) is a great spot for a tree house.
11 changes: 11 additions & 0 deletions exercises/practice/saddle-points/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Introduction

You plan to build a tree house in the woods near your house so that you can watch the sun rise and set.

You've obtained data from a local survey company that show the height of every tree in each rectangular section of the map.
You need to analyze each grid on the map to find good trees for your tree house.

A good tree is both:

- taller than every tree to the east and west, so that you have the best possible view of the sunrises and sunsets.
- shorter than every tree to the north and south, to minimize the amount of tree climbing.
20 changes: 10 additions & 10 deletions exercises/practice/scale-generator/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Then, for each interval in the pattern, the next note is determined by starting

For example, starting with G and using the seven intervals MMmMMMm, there would be the following eight notes:

Note | Reason
--|--
G | Tonic
A | M indicates a whole step from G, skipping G♯
B | M indicates a whole step from A, skipping A♯
C | m indicates a half step from B, skipping nothing
D | M indicates a whole step from C, skipping C♯
E | M indicates a whole step from D, skipping D♯
F♯ | M indicates a whole step from E, skipping F
G | m indicates a half step from F♯, skipping nothing
| Note | Reason |
| ---- | ------------------------------------------------- |
| G | Tonic |
| A | M indicates a whole step from G, skipping G♯ |
| B | M indicates a whole step from A, skipping A♯ |
| C | m indicates a half step from B, skipping nothing |
| D | M indicates a whole step from C, skipping C♯ |
| E | M indicates a whole step from D, skipping D♯ |
| F♯ | M indicates a whole step from E, skipping F |
| G | m indicates a half step from F♯, skipping nothing |
2 changes: 1 addition & 1 deletion exercises/practice/secret-handshake/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
},
"blurb": "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.",
"source": "Bert, in Mary Poppins",
"source_url": "https://www.imdb.com/title/tt0058331/quotes/qt0437047"
"source_url": "https://www.imdb.com/title/tt0058331/quotes/?item=qt0437047"
}
Loading

0 comments on commit b0fdc6a

Please sign in to comment.