Files
freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-349-langtons-ant.english.md
Randell Dawson a7eb800450 fix(curriculum): Remove unnecessary assert message argument from English Coding Interview Prep challenges - Project Euler - 04 (#36418)
* fix: removed assert msg argument-4

* fix: remove double quotes surrounding testString code

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
2019-07-27 07:34:19 -05:00

1.2 KiB

id, challengeType, title
id challengeType title
5900f4ca1000cf542c50ffdc 5 Problem 349: Langton's ant

Description

An ant moves on a regular grid of squares that are coloured either black or white. The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves from square to adjacent square according to the following rules: - if it is on a black square, it flips the color of the square to white, rotates 90 degrees counterclockwise and moves forward one square. - if it is on a white square, it flips the color of the square to black, rotates 90 degrees clockwise and moves forward one square.

Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant?

Instructions

Tests

tests:
  - text: <code>euler349()</code> should return 115384615384614940.
    testString: assert.strictEqual(euler349(), 115384615384614940);

Challenge Seed

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

euler349();

Solution

// solution required