Skip to content

Commit

Permalink
Sync docs and metadata (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras authored Oct 14, 2024
1 parent 67265b8 commit 78d662b
Show file tree
Hide file tree
Showing 118 changed files with 468 additions and 159 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/accumulate/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
},
"blurb": "Implement the `accumulate` operation, which, given a collection and an operation to perform on each element of the collection, returns a new collection containing the result of applying that operation to each element of the input collection.",
"source": "Conversation with James Edward Gray II",
"source_url": "https://twitter.com/jeg2"
"source_url": "http://graysoftinc.com/"
}
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 |
3 changes: 3 additions & 0 deletions exercises/practice/acronym/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"Acronym.vbproj"
]
},
"blurb": "Convert a long phrase to its acronym.",
Expand Down
8 changes: 4 additions & 4 deletions exercises/practice/affine-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The affine cipher is a type of monoalphabetic substitution cipher.
Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value.
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys.

[//]: # ( monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic )
[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic "

## Encryption

Expand All @@ -18,12 +18,12 @@ 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]).
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.
Otherwise it should encrypt or decrypt with the provided key.

Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/affine-cipher/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"AffineCipher.vbproj"
]
},
"blurb": "Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.",
Expand Down
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.
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
3 changes: 3 additions & 0 deletions exercises/practice/armstrong-numbers/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"ArmstrongNumbers.vbproj"
]
},
"blurb": "Determine if a number is an Armstrong number.",
Expand Down
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
3 changes: 3 additions & 0 deletions exercises/practice/bank-account/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"BankAccount.vbproj"
]
},
"blurb": "Simulate a bank account supporting opening/closing, withdraws, and deposits of money. Watch out for concurrent transactions!"
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/beer-song/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"BeerSong.vbproj"
]
},
"blurb": "Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.",
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: 3 additions & 0 deletions exercises/practice/binary-search/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"BinarySearch.vbproj"
]
},
"blurb": "Implement a binary search algorithm.",
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/binary/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A number 23 in base 10 notation can be understood as a linear combination of pow
- The rightmost digit gets multiplied by 10^0 = 1
- The next number gets multiplied by 10^1 = 10
- ...
- The *n*th number gets multiplied by 10^*(n-1)*.
- The nth number gets multiplied by 10^_(n-1)_.
- All these values are summed.

So: `23 => 2*10^1 + 3*10^0 => 2*10 + 3*1 = 23 base 10`
Expand Down
8 changes: 4 additions & 4 deletions exercises/practice/book-store/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ This would give a total of:

Resulting in:

- 5 × (100% - 25%) * $8 = 5 × $6.00 = $30.00, plus
- 3 × (100% - 10%) * $8 = 3 × $7.20 = $21.60
- 5 × (100% - 25%) × $8 = 5 × $6.00 = $30.00, plus
- 3 × (100% - 10%) × $8 = 3 × $7.20 = $21.60

Which equals $51.60.

Expand All @@ -53,8 +53,8 @@ This would give a total of:

Resulting in:

- 4 × (100% - 20%) * $8 = 4 × $6.40 = $25.60, plus
- 4 × (100% - 20%) * $8 = 4 × $6.40 = $25.60
- 4 × (100% - 20%) × $8 = 4 × $6.40 = $25.60, plus
- 4 × (100% - 20%) × $8 = 4 × $6.40 = $25.60

Which equals $51.20.

Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/book-store/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"BookStore.vbproj"
]
},
"blurb": "To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.",
Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/bowling/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ There are three cases for the tabulation of a frame.

Here is a three frame example:

| Frame 1 | Frame 2 | Frame 3 |
| :-------------: |:-------------:| :---------------------:|
| X (strike) | 5/ (spare) | 9 0 (open frame) |
| Frame 1 | Frame 2 | Frame 3 |
| :--------: | :--------: | :--------------: |
| X (strike) | 5/ (spare) | 9 0 (open frame) |

Frame 1 is (10 + 5 + 5) = 20

Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/bowling/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"Bowling.vbproj"
]
},
"blurb": "Score a bowling game.",
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/change/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"Change.vbproj"
]
},
"blurb": "Correctly determine change to be given using the least number of coins.",
Expand Down
48 changes: 32 additions & 16 deletions exercises/practice/circular-buffer/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,55 @@ A circular buffer, cyclic buffer or ring buffer is a data structure that uses a

A circular buffer first starts empty and of some predefined length.
For example, this is a 7-element buffer:
<!-- prettier-ignore -->
[ ][ ][ ][ ][ ][ ][ ]

```text
[ ][ ][ ][ ][ ][ ][ ]
```

Assume that a 1 is written into the middle of the buffer (exact starting location does not matter in a circular buffer):
<!-- prettier-ignore -->
[ ][ ][ ][1][ ][ ][ ]

```text
[ ][ ][ ][1][ ][ ][ ]
```

Then assume that two more elements are added — 2 & 3 — which get appended after the 1:
<!-- prettier-ignore -->
[ ][ ][ ][1][2][3][ ]

```text
[ ][ ][ ][1][2][3][ ]
```

If two elements are then removed from the buffer, the oldest values inside the buffer are removed.
The two elements removed, in this case, are 1 & 2, leaving the buffer with just a 3:
<!-- prettier-ignore -->
[ ][ ][ ][ ][ ][3][ ]

```text
[ ][ ][ ][ ][ ][3][ ]
```

If the buffer has 7 elements then it is completely full:
<!-- prettier-ignore -->
[5][6][7][8][9][3][4]

```text
[5][6][7][8][9][3][4]
```

When the buffer is full an error will be raised, alerting the client that further writes are blocked until a slot becomes free.

When the buffer is full, the client can opt to overwrite the oldest data with a forced write.
In this case, two more elements — A & B — are added and they overwrite the 3 & 4:
<!-- prettier-ignore -->
[5][6][7][8][9][A][B]

```text
[5][6][7][8][9][A][B]
```

3 & 4 have been replaced by A & B making 5 now the oldest data in the buffer.
Finally, if two elements are removed then what would be returned is 5 & 6 yielding the buffer:
<!-- prettier-ignore -->
[ ][ ][7][8][9][A][B]

```text
[ ][ ][7][8][9][A][B]
```

Because there is space available, if the client again uses overwrite to store C & D then the space where 5 & 6 were stored previously will be used not the location of 7 & 8.
7 is still the oldest element and the buffer is once again full.
<!-- prettier-ignore -->
[C][D][7][8][9][A][B]

```text
[C][D][7][8][9][A][B]
```
3 changes: 3 additions & 0 deletions exercises/practice/circular-buffer/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"CircularBuffer.vbproj"
]
},
"blurb": "A data structure that uses a single, fixed-size buffer as if it were connected end-to-end.",
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 @@ -17,6 +17,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"
}
12 changes: 10 additions & 2 deletions exercises/practice/darts/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# 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].

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 @@ -14,10 +16,16 @@ 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

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
5 changes: 4 additions & 1 deletion exercises/practice/darts/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"Darts.vbproj"
]
},
"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"
}
3 changes: 3 additions & 0 deletions exercises/practice/difference-of-squares/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"DifferenceOfSquares.vbproj"
]
},
"blurb": "Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.",
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/diffie-hellman/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"DiffieHellman.vbproj"
]
},
"blurb": "Diffie-Hellman key exchange.",
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/dnd-character/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"DndCharacter.vbproj"
]
},
"blurb": "Randomly generate Dungeons & Dragons characters.",
Expand Down
3 changes: 3 additions & 0 deletions exercises/practice/error-handling/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"example": [
".meta/Example.vb"
],
"invalidator": [
"ErrorHandling.vbproj"
]
},
"blurb": "Implement various kinds of error handling and resource management."
Expand Down
Loading

0 comments on commit 78d662b

Please sign in to comment.