* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
---
|
|
id: 5900f4841000cf542c50ff97
|
|
title: 'Problem 280: Ant and seeds'
|
|
challengeType: 5
|
|
forumTopicId: 301931
|
|
dashedName: problem-280-ant-and-seeds
|
|
---
|
|
|
|
# --description--
|
|
|
|
A laborious ant walks randomly on a 5x5 grid. The walk starts from the central square. At each step, the ant moves to an adjacent square at random, without leaving the grid; thus there are 2, 3 or 4 possible moves at each step depending on the ant's position.
|
|
|
|
At the start of the walk, a seed is placed on each square of the lower row. When the ant isn't carrying a seed and reaches a square of the lower row containing a seed, it will start to carry the seed. The ant will drop the seed on the first empty square of the upper row it eventually reaches.
|
|
|
|
What's the expected number of steps until all seeds have been dropped in the top row? Give your answer rounded to 6 decimal places.
|
|
|
|
# --hints--
|
|
|
|
`euler280()` should return 430.088247.
|
|
|
|
```js
|
|
assert.strictEqual(euler280(), 430.088247);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
function euler280() {
|
|
|
|
return true;
|
|
}
|
|
|
|
euler280();
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
// solution required
|
|
```
|