Skip to content

Commit

Permalink
Sync docs and metadata (#2288)
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras authored Jul 29, 2024
1 parent 47266f7 commit 8fff6fb
Show file tree
Hide file tree
Showing 27 changed files with 154 additions and 83 deletions.
4 changes: 2 additions & 2 deletions exercises/practice/affine-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ E(x) = (ai + b) mod m

Where:

- `i` is the letter's index from `0` to the length of the alphabet - 1
- `i` is the letter's index from `0` to the length of the alphabet - 1.
- `m` is the length of the alphabet.
For the Roman alphabet `m` is `26`.
- `a` and `b` are integers which make the encryption key
- `a` and `b` are integers which make up the encryption key.

Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
In case `a` is not coprime to `m`, your program should indicate that this is an error.
Expand Down
4 changes: 1 addition & 3 deletions exercises/practice/alphametics/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instructions

Write a function to solve alphametics puzzles.
Given an alphametics puzzle, find the correct solution.

[Alphametics][alphametics] is a puzzle where letters in words are replaced with numbers.

Expand All @@ -26,6 +26,4 @@ This is correct because every letter is replaced by a different number and the w

Each letter must represent a different digit, and the leading digit of a multi-digit number must not be zero.

Write a function to solve alphametics puzzles.

[alphametics]: https://en.wikipedia.org/wiki/Alphametics
2 changes: 1 addition & 1 deletion exercises/practice/alphametics/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
"representer": {
"version": 1
},
"blurb": "Write a function to solve alphametics puzzles."
"blurb": "Given an alphametics puzzle, find the correct solution."
}
2 changes: 1 addition & 1 deletion exercises/practice/bank-account/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Your task is to implement bank accounts supporting opening/closing, withdrawals, and deposits of money.

As bank accounts can be accessed in many different ways (internet, mobile phones, automatic charges), your bank software must allow accounts to be safely accessed from multiple threads/processes (terminology depends on your programming language) in parallel.
For example, there may be many deposits and withdrawals occurring in parallel; you need to ensure there is no [race conditions][wikipedia] between when you read the account balance and set the new balance.
For example, there may be many deposits and withdrawals occurring in parallel; you need to ensure there are no [race conditions][wikipedia] between when you read the account balance and set the new balance.

It should be possible to close an account; operations against a closed account must fail.

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/darts/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instructions

Write a function that returns the earned points in a single toss of a Darts game.
Calculate the points scored in a single toss of a Darts game.

[Darts][darts] is a game where players throw darts at a [target][darts-target].

Expand All @@ -16,7 +16,7 @@ In our particular instance of the game, the target rewards 4 different amounts o
The outer circle has a radius of 10 units (this is equivalent to the total radius for the entire target), the middle circle a radius of 5 units, and the inner circle a radius of 1.
Of course, they are all centered at the same point — that is, the circles are [concentric][] defined by the coordinates (0, 0).

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.
Given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), calculate the correct score earned by a dart landing at that point.

## Credit

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/darts/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"Darts.csproj"
]
},
"blurb": "Write a function that returns the earned points in a single toss of a Darts game.",
"blurb": "Calculate the points scored in a single toss of a Darts game.",
"source": "Inspired by an exercise created by a professor Della Paolera in Argentina"
}
2 changes: 1 addition & 1 deletion exercises/practice/flatten-array/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Take a nested list and return a single flattened list with all values except nil/null.

The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
The challenge is to take an arbitrarily-deep nested list-like structure and produce a flattened structure without any nil/null values.

For example:

Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/go-counting/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Count the scored points on a Go board.
In the game of go (also known as baduk, igo, cờ vây and wéiqí) points are gained by completely encircling empty intersections with your stones.
The encircled intersections of a player are known as its territory.

Write a function that determines the territory of each player.
Calculate the territory of each player.
You may assume that any stones that have been stranded in enemy territory have already been taken off the board.

Write a function that determines the territory which includes a specified coordinate.
Determine the territory which includes a specified coordinate.

Multiple empty intersections may be encircled at once and for encircling only horizontal and vertical neighbors count.
In the following diagram the stones which matter are marked "O" and the stones that don't are marked "I" (ignored).
Expand All @@ -25,7 +25,7 @@ Empty spaces represent empty intersections.

To be more precise an empty intersection is part of a player's territory if all of its neighbors are either stones of that player or empty intersections that are part of that player's territory.

For more information see [wikipedia][go-wikipedia] or [Sensei's Library][go-sensei].
For more information see [Wikipedia][go-wikipedia] or [Sensei's Library][go-sensei].

[go-wikipedia]: https://en.wikipedia.org/wiki/Go_%28game%29
[go-sensei]: https://senseis.xmp.net/
3 changes: 2 additions & 1 deletion exercises/practice/matching-brackets/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Instructions

Given a string containing brackets `[]`, braces `{}`, parentheses `()`, or any combination thereof, verify that any and all pairs are matched and nested correctly.
The string may also contain other characters, which for the purposes of this exercise should be ignored.
Any other characters should be ignored.
For example, `"{what is (42)}?"` is balanced and `"[text}"` is not.
8 changes: 8 additions & 0 deletions exercises/practice/matching-brackets/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Introduction

You're given the opportunity to write software for the Bracketeer™, an ancient but powerful mainframe.
The software that runs on it is written in a proprietary language.
Much of its syntax is familiar, but you notice _lots_ of brackets, braces and parentheses.
Despite the Bracketeer™ being powerful, it lacks flexibility.
If the source code has any unbalanced brackets, braces or parentheses, the Bracketeer™ crashes and must be rebooted.
To avoid such a scenario, you start writing code that can verify that brackets, braces, and parentheses are balanced before attempting to run it on the Bracketeer™.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Count the frequency of letters in texts using parallel computation.

Parallelism is about doing things in parallel that can also be done sequentially.
A common example is counting the frequency of letters.
Create a function that returns the total frequency of each letter in a list of texts and that employs parallelism.
Employ parallelism to calculate the total frequency of each letter in a list of texts.
27 changes: 24 additions & 3 deletions exercises/practice/pascals-triangle/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# Instructions

Compute Pascal's triangle up to a given number of rows.
Your task is to output the first N rows of Pascal's triangle.

In Pascal's Triangle each number is computed by adding the numbers to the right and left of the current position in the previous row.
[Pascal's triangle][wikipedia] is a triangular array of positive integers.

In Pascal's triangle, the number of values in a row is equal to its row number (which starts at one).
Therefore, the first row has one value, the second row has two values, and so on.

The first (topmost) row has a single value: `1`.
Subsequent rows' values are computed by adding the numbers directly to the right and left of the current position in the previous row.

If the previous row does _not_ have a value to the left or right of the current position (which only happens for the leftmost and rightmost positions), treat that position's value as zero (effectively "ignoring" it in the summation).

## Example

Let's look at the first 5 rows of Pascal's Triangle:

```text
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
# ... etc
```

The topmost row has one value, which is `1`.

The leftmost and rightmost values have only one preceding position to consider, which is the position to its right respectively to its left.
With the topmost value being `1`, it follows from this that all the leftmost and rightmost values are also `1`.

The other values all have two positions to consider.
For example, the fifth row's (`1 4 6 4 1`) middle value is `6`, as the values to its left and right in the preceding row are `3` and `3`:

[wikipedia]: https://en.wikipedia.org/wiki/Pascal%27s_triangle
22 changes: 22 additions & 0 deletions exercises/practice/pascals-triangle/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Introduction

With the weather being great, you're not looking forward to spending an hour in a classroom.
Annoyed, you enter the class room, where you notice a strangely satisfying triangle shape on the blackboard.
Whilst waiting for your math teacher to arrive, you can't help but notice some patterns in the triangle: the outer values are all ones, each subsequent row has one more value than its previous row and the triangle is symmetrical.
Weird!

Not long after you sit down, your teacher enters the room and explains that this triangle is the famous [Pascal's triangle][wikipedia].

Over the next hour, your teacher reveals some amazing things hidden in this triangle:

- It can be used to compute how many ways you can pick K elements from N values.
- It contains the Fibonacci sequence.
- If you color odd and even numbers differently, you get a beautiful pattern called the [Sierpiński triangle][wikipedia-sierpinski-triangle].

The teacher implores you and your classmates to lookup other uses, and assures you that there are lots more!
At that moment, the school bell rings.
You realize that for the past hour, you were completely absorbed in learning about Pascal's triangle.
You quickly grab your laptop from your bag and go outside, ready to enjoy both the sunshine _and_ the wonders of Pascal's triangle.

[wikipedia]: https://en.wikipedia.org/wiki/Pascal%27s_triangle
[wikipedia-sierpinski-triangle]: https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle
4 changes: 2 additions & 2 deletions exercises/practice/pig-latin/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For example:

## Rule 2

If a word begins with a one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.
If a word begins with one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.

For example:

Expand All @@ -33,7 +33,7 @@ If a word starts with zero or more consonants followed by `"qu"`, first move tho

For example:

- `"quick"` -> `"ickqu"` -> `"ay"` (starts with `"qu"`, no preceding consonants)
- `"quick"` -> `"ickqu"` -> `"ickquay"` (starts with `"qu"`, no preceding consonants)
- `"square"` -> `"aresqu"` -> `"aresquay"` (starts with one consonant followed by `"qu`")

## Rule 4
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/poker/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Pick the best hand(s) from a list of poker hands.

See [wikipedia][poker-hands] for an overview of poker hands.
See [Wikipedia][poker-hands] for an overview of poker hands.

[poker-hands]: https://en.wikipedia.org/wiki/List_of_poker_hands
2 changes: 1 addition & 1 deletion exercises/practice/raindrops/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"Raindrops.csproj"
]
},
"blurb": "Convert a number to a string, the content of which depends on the number's factors.",
"blurb": "Convert a number into its corresponding raindrop sounds - Pling, Plang and Plong.",
"source": "A variation on FizzBuzz, a famous technical interview question that is intended to weed out potential candidates. That question is itself derived from Fizz Buzz, a popular children's game for teaching division.",
"source_url": "https://en.wikipedia.org/wiki/Fizz_buzz"
}
22 changes: 11 additions & 11 deletions exercises/practice/resistor-color-duo/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ The program will take color names as input and output a two digit number, even i

The band colors are encoded as follows:

- Black: 0
- Brown: 1
- Red: 2
- Orange: 3
- Yellow: 4
- Green: 5
- Blue: 6
- Violet: 7
- Grey: 8
- White: 9
- black: 0
- brown: 1
- red: 2
- orange: 3
- yellow: 4
- green: 5
- blue: 6
- violet: 7
- grey: 8
- white: 9

From the example above:
brown-green should return 15
brown-green should return 15, and
brown-green-violet should return 15 too, ignoring the third color.
20 changes: 10 additions & 10 deletions exercises/practice/resistor-color-trio/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ For this exercise, you need to know only three things about them:
The program will take 3 colors as input, and outputs the correct value, in ohms.
The color bands are encoded as follows:

- Black: 0
- Brown: 1
- Red: 2
- Orange: 3
- Yellow: 4
- Green: 5
- Blue: 6
- Violet: 7
- Grey: 8
- White: 9
- black: 0
- brown: 1
- red: 2
- orange: 3
- yellow: 4
- green: 5
- blue: 6
- violet: 7
- grey: 8
- white: 9

In Resistor Color Duo you decoded the first two colors.
For instance: orange-orange got the main value `33`.
Expand Down
20 changes: 10 additions & 10 deletions exercises/practice/resistor-color/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ In this exercise you are going to create a helpful program so that you don't hav

These colors are encoded as follows:

- Black: 0
- Brown: 1
- Red: 2
- Orange: 3
- Yellow: 4
- Green: 5
- Blue: 6
- Violet: 7
- Grey: 8
- White: 9
- black: 0
- brown: 1
- red: 2
- orange: 3
- yellow: 4
- green: 5
- blue: 6
- violet: 7
- grey: 8
- white: 9

The goal of this exercise is to create a way:

Expand Down
2 changes: 0 additions & 2 deletions exercises/practice/say/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ Implement breaking a number up into chunks of thousands.

So `1234567890` should yield a list like 1, 234, 567, and 890, while the far simpler `1000` should yield just 1 and 0.

The program must also report any values that are out of range.

## Step 3

Now handle inserting the appropriate scale word between those chunks.
Expand Down
31 changes: 17 additions & 14 deletions exercises/practice/space-age/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# Instructions

Given an age in seconds, calculate how old someone would be on:
Given an age in seconds, calculate how old someone would be on a planet in our Solar System.

- Mercury: orbital period 0.2408467 Earth years
- Venus: orbital period 0.61519726 Earth years
- Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds
- Mars: orbital period 1.8808158 Earth years
- Jupiter: orbital period 11.862615 Earth years
- Saturn: orbital period 29.447498 Earth years
- Uranus: orbital period 84.016846 Earth years
- Neptune: orbital period 164.79132 Earth years
One Earth year equals 365.25 Earth days, or 31,557,600 seconds.
If you were told someone was 1,000,000,000 seconds old, their age would be 31.69 Earth-years.

So if you were told someone were 1,000,000,000 seconds old, you should
be able to say that they're 31.69 Earth-years old.
For the other planets, you have to account for their orbital period in Earth Years:

If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video].
| Planet | Orbital period in Earth Years |
| ------- | ----------------------------- |
| Mercury | 0.2408467 |
| Venus | 0.61519726 |
| Earth | 1.0 |
| Mars | 1.8808158 |
| Jupiter | 11.862615 |
| Saturn | 29.447498 |
| Uranus | 84.016846 |
| Neptune | 164.79132 |

Note: The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year).
~~~~exercism/note
The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year).
The Gregorian calendar has, on average, 365.2425 days.
While not entirely accurate, 365.25 is the value used in this exercise.
See [Year on Wikipedia][year] for more ways to measure a year.
[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs
[year]: https://en.wikipedia.org/wiki/Year#Summary
~~~~
20 changes: 20 additions & 0 deletions exercises/practice/space-age/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Introduction

The year is 2525 and you've just embarked on a journey to visit all planets in the Solar System (Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus and Neptune).
The first stop is Mercury, where customs require you to fill out a form (bureaucracy is apparently _not_ Earth-specific).
As you hand over the form to the customs officer, they scrutinize it and frown.
"Do you _really_ expect me to believe you're just 50 years old?
You must be closer to 200 years old!"

Amused, you wait for the customs officer to start laughing, but they appear to be dead serious.
You realize that you've entered your age in _Earth years_, but the officer expected it in _Mercury years_!
As Mercury's orbital period around the sun is significantly shorter than Earth, you're actually a lot older in Mercury years.
After some quick calculations, you're able to provide your age in Mercury Years.
The customs officer smiles, satisfied, and waves you through.
You make a mental note to pre-calculate your planet-specific age _before_ future customs checks, to avoid such mix-ups.

~~~~exercism/note
If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video].
[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs
~~~~
2 changes: 1 addition & 1 deletion exercises/practice/strain/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"Strain.csproj"
]
},
"blurb": "Implement the `keep` and `discard` operation on collections. Given a collection and a predicate on the collection's elements, `keep` returns a new collection containing those elements where the predicate is true, while `discard` returns a new collection containing those elements where the predicate is false.",
"blurb": "Implement the `keep` and `discard` operation on collections.",
"source": "Conversation with James Edward Gray II",
"source_url": "http://graysoftinc.com/"
}
2 changes: 1 addition & 1 deletion exercises/practice/two-bucket/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ There are some rules that your solution must follow:
b) the second bucket is full
2. Emptying a bucket and doing nothing to the other.
3. Filling a bucket and doing nothing to the other.
- After an action, you may not arrive at a state where the starting bucket is empty and the other bucket is full.
- After an action, you may not arrive at a state where the initial starting bucket is empty and the other bucket is full.

Your program will take as input:

Expand Down
Loading

0 comments on commit 8fff6fb

Please sign in to comment.