2018-09-30 23:01:58 +01:00
---
id: 5900f4ca1000cf542c50ffdc
2018-10-20 21:02:47 +03:00
title: 'Problem 349: Langton''s ant'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302008
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-10-08 01:01:53 +01:00
An ant moves on a regular grid of squares that are coloured either black or white.
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
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:
2020-11-27 19:02:05 +01:00
\- 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.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
\- 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.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant?
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`euler349()` should return 115384615384614940.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert.strictEqual(euler349(), 115384615384614940);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
function euler349() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
euler349();
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```