Files
freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-227-the-chase.english.md
Valeriy 79d9012432 fix(curriculum): quotes in tests (#18828)
* fix(curriculum): tests quotes

* fix(curriculum): fill seed-teardown

* fix(curriculum): fix tests and remove unneeded seed-teardown
2018-10-20 23:32:47 +05:30

1.3 KiB

id, challengeType, title
id challengeType title
5900f44f1000cf542c50ff61 5 Problem 227: The Chase

Description

"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.

In a game with 100 players, what is the expected number of turns the game lasts? Give your answer rounded to ten significant digits.

Instructions

Tests

tests:
  - text: <code>euler227()</code> should return 3780.618622.
    testString: assert.strictEqual(euler227(), 3780.618622, '<code>euler227()</code> should return 3780.618622.');

Challenge Seed

function euler227() {
  // Good luck!
  return true;
}

euler227();

Solution

// solution required