0%

Problem 349


Problem 349


Langton’s ant

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?


兰顿的蚂蚁

一只蚂蚁在涂有黑色或白色的普通网格方格上移动。
蚂蚁总是朝向四种基本方向(左、右、上、下)之一,每次遵循以下规则移动到相邻的方格:

  • 如果它在黑色方格上,它将方格的颜色变为白色,逆时针旋转90度,向前移动一个方格。
  • 如果它在白色方格上,它将方格的颜色变为黑色,顺时针旋转90度,向前移动一个方格。

从全白的网格开始,在蚂蚁移动1018次之后,有多少个方格是黑色的?