Skip to content

Commit 416803e

Browse files
authored
Merge branch 'exercism:main' into mazy-mice
2 parents 5cab22d + 3858910 commit 416803e

File tree

215 files changed

+4345
-1129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+4345
-1129
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ updates:
66
- package-ecosystem: 'github-actions'
77
directory: '/'
88
schedule:
9-
interval: 'daily'
9+
interval: 'monthly'

.github/workflows/action-format.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- name: 'Post acknowledgement that it will format code'
1414
continue-on-error: true # Never fail the build if this fails
15-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
15+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
1616
with:
1717
github-token: ${{ secrets.GITHUB_TOKEN }}
1818
script: |
@@ -65,7 +65,7 @@ jobs:
6565
run: ./bin/reorder-keys
6666

6767
- name: Use Node.js LTS (16.x)
68-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
68+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
6969
with:
7070
node-version: '16'
7171

@@ -75,7 +75,7 @@ jobs:
7575
run: echo "::set-output name=dir::$(yarn cache dir)"
7676

7777
- name: Cache yarn
78-
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
78+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
7979
id: yarn-cache
8080
with:
8181
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -90,7 +90,7 @@ jobs:
9090
run: yarn format-json && ruby bin/format-array.rb
9191

9292
- name: Format Markdown files
93-
run: yarn format-md
93+
run: yarn format-md && ruby bin/format-admonition-fences.rb
9494

9595
- name: 'Commit formatted code'
9696
run: |
@@ -111,7 +111,7 @@ jobs:
111111
112112
- name: 'Post acknowledgement that it has formatted the code'
113113
continue-on-error: true # Never fail the build if this fails
114-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
114+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
115115
with:
116116
github-token: ${{ secrets.GITHUB_TOKEN }}
117117
script: |
@@ -125,7 +125,7 @@ jobs:
125125
- name: 'Post reminder to trigger build manually'
126126
continue-on-error: true # Never fail the build if this fails
127127
if: steps.fork_status.outputs.fork == 'true'
128-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
128+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
129129
with:
130130
github-token: ${{ secrets.GITHUB_TOKEN }}
131131
script: |

.github/workflows/ci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ jobs:
1212
name: All required files are present
1313
runs-on: ubuntu-22.04
1414
steps:
15-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
1616

1717
- name: All required files are present
1818
run: bin/check_required_files_present
1919

2020
immutability:
2121
name: No test has been mutated
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-24.04
2323
steps:
24-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
2525
with:
2626
path: "new"
2727

2828
# Pull Requests
2929
- name: Checkout the target branch
30-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
3131
with:
3232
ref: "${{ github.base_ref }}"
3333
path: "old"
@@ -43,10 +43,10 @@ jobs:
4343
name: Schema validation
4444
runs-on: ubuntu-22.04
4545
steps:
46-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
46+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
4747

4848
- name: Setup nodejs
49-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
49+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
5050
with:
5151
node-version: 16
5252
cache: "yarn"
@@ -115,16 +115,16 @@ jobs:
115115
name: Lint markdown files
116116
runs-on: ubuntu-22.04
117117
steps:
118-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
118+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
119119

120120
- name: Lint markdown
121-
uses: DavidAnson/markdownlint-cli2-action@bb4bb94c73936643d73d345b48fead3e96f90a5e # v10.0.1
121+
uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19.1.0
122122
with:
123123
globs: |
124124
**/*.md
125125
126126
- name: Setup nodejs
127-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
127+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
128128
with:
129129
node-version: 16
130130
cache: "yarn"
@@ -134,9 +134,9 @@ jobs:
134134

135135
- name: Verify that markdown files are formatted correctly
136136
run: |
137-
yarn format-md
137+
yarn format-md && ruby bin/format-admonition-fences.rb
138138
if ! git diff --quiet --exit-code; then
139-
echo "please format the files with prettier, or apply the following changes:"
139+
echo "please format the files using 'yarn format-md && ruby bin/format-admonition-fences.rb', or apply the following changes:"
140140
git diff
141141
exit 1
142142
fi
@@ -145,10 +145,10 @@ jobs:
145145
name: Check links
146146
runs-on: ubuntu-latest
147147
steps:
148-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
148+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
149149

150150
- name: Check links
151-
uses: lycheeverse/lychee-action@ec3ed119d4f44ad2673a7232460dc7dff59d2421 # 1.8.0
151+
uses: lycheeverse/lychee-action@1d97d84f0bc547f7b25f4c2170d87d810dc2fb2c # 2.4.0
152152
with:
153153
args: --require-https --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36" --no-progress **/*.md **/*.html **/*.toml **/*.json
154154
fail: true
@@ -159,10 +159,10 @@ jobs:
159159
name: Lint json files
160160
runs-on: ubuntu-22.04
161161
steps:
162-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
162+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
163163

164164
- name: Setup nodejs
165-
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
165+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
166166
with:
167167
node-version: 16
168168
cache: "yarn"

.github/workflows/rebase.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212

1313
steps:
14-
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1515
with:
1616
fetch-depth: 0
1717

.github/workflows/shellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-22.04
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
1717

1818
- name: Run shellcheck
1919
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0

.lycheeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ json-schema.org
22
collinsdictionary\.com
33
papyr\.com
44
users.csc.calpoly.edu
5+
www\.udacity\.com

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ This policy was initially adopted from the Front-end London Slack community and
9090
A version history can be seen on [GitHub](https://github.com/exercism/website-copy/edit/main/pages/code_of_conduct.md).
9191

9292
_This policy is a "living" document, and subject to refinement and expansion in the future.
93-
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Slack, Twitter, email) and any other Exercism entity or event._
93+
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Discord, Forum, Twitter, email) and any other Exercism entity or event._

bin/format-admonition-fences.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env ruby
2+
3+
BACKTICK_MATCH_REGEX = /(?<fence>[`~]{3,})(?<type>exercism\/[a-z]+)(?<admonition>.*?)(?<end>\k<fence>)/m.freeze
4+
TILDE_REPLACE = '~~~~\k<type>\k<admonition>~~~~'.freeze
5+
6+
Dir.glob('exercises/**/*.md') do |filepath|
7+
contents = File.read(filepath)
8+
contents.gsub!(BACKTICK_MATCH_REGEX, TILDE_REPLACE)
9+
File.write(filepath, contents)
10+
end

canonical-data.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
" slightly reducing the amount of manually generated code. "
2323
],
2424

25-
"$schema": "http://json-schema.org/draft-04/schema#",
25+
"$schema": "http://json-schema.org/draft-07/schema#",
2626

2727
"self": {
2828
"vendor": "io.exercism",

exercises/acronym/metadata.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ title = "Acronym"
22
blurb = "Convert a long phrase to its acronym."
33
source = "Julien Vanier"
44
source_url = "https://github.com/monkbroc"
5+
deep_dive_youtube_id = "ofzqp4MFHvM"
6+
deep_dive_blurb = "We take a gentle dive into regular expressions starting with basic whitespace matching, exploring unicode, and ending with negative lookbehinds. We finish off by looking at some other approaches to Acronym including state machines."

exercises/affine-cipher/description.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Create an implementation of the affine cipher, an ancient encryption system crea
44

55
The affine cipher is a type of monoalphabetic substitution cipher.
66
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.
7-
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys.
7+
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the Atbash cipher, because it has many more keys.
88

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

@@ -18,10 +18,10 @@ E(x) = (ai + b) mod m
1818

1919
Where:
2020

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

2626
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]).
2727
In case `a` is not coprime to `m`, your program should indicate that this is an error.

exercises/all-your-base/description.md

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Instructions
2+
3+
Convert a sequence of digits in one base, representing a number, into a sequence of digits in another base, representing the same number.
4+
5+
~~~~exercism/note
6+
Try to implement the conversion yourself.
7+
Do not use something else to perform the conversion for you.
8+
~~~~
9+
10+
## About [Positional Notation][positional-notation]
11+
12+
In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**.
13+
14+
The number 42, _in base 10_, means:
15+
16+
`(4 × 10¹) + (2 × 10⁰)`
17+
18+
The number 101010, _in base 2_, means:
19+
20+
`(1 × 2⁵) + (0 × 2⁴) + (1 × 2³) + (0 × 2²) + (1 × 2¹) + (0 × 2⁰)`
21+
22+
The number 1120, _in base 3_, means:
23+
24+
`(1 × 3³) + (1 × 3²) + (2 × 3¹) + (0 × 3⁰)`
25+
26+
_Yes. Those three numbers above are exactly the same. Congratulations!_
27+
28+
[positional-notation]: https://en.wikipedia.org/wiki/Positional_notation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Introduction
2+
3+
You've just been hired as professor of mathematics.
4+
Your first week went well, but something is off in your second week.
5+
The problem is that every answer given by your students is wrong!
6+
Luckily, your math skills have allowed you to identify the problem: the student answers _are_ correct, but they're all in base 2 (binary)!
7+
Amazingly, it turns out that each week, the students use a different base.
8+
To help you quickly verify the student answers, you'll be building a tool to translate between bases.

exercises/allergies/metadata.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ title = "Allergies"
22
blurb = "Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies."
33
source = "Exercise by the JumpstartLab team for students at The Turing School of Software and Design."
44
source_url = "https://turing.edu"
5+
deep_dive_youtube_id = "OFS9sknfpkc"
6+
deep_dive_blurb = "We explore bit shifting, bitwise comparison and other binary number concepts! We also take a look at a solution using pattern matching and an interesting approach in Erlang using recursion."

exercises/alphametics/description.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Description
22

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

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

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

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

29-
Write a function to solve alphametics puzzles.
30-
3129
[alphametics]: https://en.wikipedia.org/wiki/Alphametics

exercises/alphametics/metadata.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
title = "Alphametics"
2-
blurb = "Write a function to solve alphametics puzzles."
2+
blurb = "Given an alphametics puzzle, find the correct solution."

exercises/anagram/canonical-data.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@
132132
},
133133
"expected": []
134134
},
135+
{
136+
"uuid": "630abb71-a94e-4715-8395-179ec1df9f91",
137+
"reimplements": "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c",
138+
"description": "does not detect an anagram if the original word is repeated",
139+
"property": "findAnagrams",
140+
"input": {
141+
"subject": "go",
142+
"candidates": ["goGoGO"]
143+
},
144+
"expected": []
145+
},
135146
{
136147
"uuid": "9878a1c9-d6ea-4235-ae51-3ea2befd6842",
137148
"description": "anagrams must use all letters exactly once",
@@ -205,6 +216,29 @@
205216
"candidates": ["LISTEN", "Silent"]
206217
},
207218
"expected": ["Silent"]
219+
},
220+
{
221+
"uuid": "a6854f66-eec1-4afd-a137-62ef2870c051",
222+
"description": "handles case of greek letters",
223+
"scenarios": ["unicode"],
224+
"property": "findAnagrams",
225+
"input": {
226+
"subject": "ΑΒΓ",
227+
"candidates": ["ΒΓΑ", "ΒΓΔ", "γβα", "αβγ"]
228+
},
229+
"expected": ["ΒΓΑ", "γβα"]
230+
},
231+
{
232+
"uuid": "fd3509e5-e3ba-409d-ac3d-a9ac84d13296",
233+
"description": "different characters may have the same bytes",
234+
"comments": ["a⬂ => 61 E2 AC 82", "€a => E2 82 AC 61"],
235+
"scenarios": ["unicode"],
236+
"property": "findAnagrams",
237+
"input": {
238+
"subject": "a⬂",
239+
"candidates": ["€a"]
240+
},
241+
"expected": []
208242
}
209243
]
210244
}

exercises/anagram/description.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)