fix(curriculum): clean-up Project Euler 221-240 (#42839)
* fix: clean-up Project Euler 221-240 * 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:
@ -10,16 +10,24 @@ dashedName: problem-227-the-chase
|
||||
|
||||
"The Chase" is a game played with two dice and an even number of players.
|
||||
|
||||
The players sit around a table; the game begins with two opposite players having one die each. On each turn, the two players with a die roll it. If a player rolls a 1, he passes the die to his neighbour on the left; if he rolls a 6, he passes the die to his neighbour on the right; otherwise, he keeps the die for the next turn. The game ends when one player has both dice after they have been rolled and passed; that player has then lost.
|
||||
The players sit around a table; the game begins with two opposite players having one die each. On each turn, the two players with a die roll it.
|
||||
|
||||
If the player rolls a 1, he passes the die to his neighbour on the left.
|
||||
|
||||
If the player rolls a 6, he passes the die to his neighbour on the right.
|
||||
|
||||
Otherwise, he keeps the die for the next turn.
|
||||
|
||||
The game ends when one player has both dice after they have been rolled and passed; that player has then lost.
|
||||
|
||||
In a game with 100 players, what is the expected number of turns the game lasts? Give your answer rounded to ten significant digits.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler227()` should return 3780.618622.
|
||||
`theChase()` should return `3780.618622`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler227(), 3780.618622);
|
||||
assert.strictEqual(theChase(), 0.618622);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +35,12 @@ assert.strictEqual(euler227(), 3780.618622);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler227() {
|
||||
function theChase() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler227();
|
||||
theChase();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user