fix(curriculum): clean-up Project Euler 201-220 (#42826)

* fix: clean-up Project Euler 201-220

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-15 09:20:31 +02:00
committed by GitHub
parent 505c3b7c6c
commit eef1805fe6
20 changed files with 254 additions and 156 deletions

View File

@ -8,24 +8,33 @@ dashedName: problem-220-heighway-dragon
# --description--
Let D0 be the two-letter string "Fa". For n≥1, derive Dn from Dn-1 by the string-rewriting rules:
Let $D_0$ be the two-letter string "Fa". For $n ≥ 1$, derive $D_n$ from $D_{n - 1}$ by the string-rewriting rules:
"a" → "aRbFR" "b" → "LFaLb"
- "a" → "aRbFR"
- "b" → "LFaLb"
Thus, D0 = "Fa", D1 = "FaRbFR", D2 = "FaRbFRRLFaLbFR", and so on.
Thus, $D_0$ = "Fa", $D_1$ = "FaRbFR", $D_2$ = "FaRbFRRLFaLbFR", and so on.
These strings can be interpreted as instructions to a computer graphics program, with "F" meaning "draw forward one unit", "L" meaning "turn left 90 degrees", "R" meaning "turn right 90 degrees", and "a" and "b" being ignored. The initial position of the computer cursor is (0,0), pointing up towards (0,1).
Then Dn is an exotic drawing known as the Heighway Dragon of order n. For example, D10 is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps.
Then $D_n$ is an exotic drawing known as the Heighway Dragon of order $n$. For example, $D_{10}$ is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps.
What is the position of the cursor after 1012 steps in D50 ? Give your answer in the form x,y with no spaces.
<img class="img-responsive center-block" alt="drawing of the Heighway Dragon after 500 steps" src="https://cdn.freecodecamp.org/curriculum/project-euler/heighway-dragon.gif" style="background-color: white; padding: 10px;">
What is the position of the cursor after ${10}^{12}$ steps in $D_{50}$? Give your answer as a string in the form `x,y` with no spaces.
# --hints--
`euler220()` should return 139776, 963904.
`heighwayDragon()` should return a string.
```js
assert.strictEqual(euler220(), 139776, 963904);
assert(typeof heighwayDragon() === 'string');
```
`heighwayDragon()` should return the string `139776,963904`.
```js
assert.strictEqual(heighwayDragon(), '139776,963904');
```
# --seed--
@ -33,12 +42,12 @@ assert.strictEqual(euler220(), 139776, 963904);
## --seed-contents--
```js
function euler220() {
function heighwayDragon() {
return true;
}
euler220();
heighwayDragon();
```
# --solutions--