freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-349-langtons-ant.ch...

56 lines
1.3 KiB
Markdown
Raw Normal View History

---
id: 5900f4ca1000cf542c50ffdc
challengeType: 5
title: 'Problem 349: Langton"s ant'
videoUrl: ''
localeTitle: 问题349兰顿的蚂蚁
---
## Description
<section id="description">蚂蚁在规则的方格网格上移动,方格网格为黑色或白色。蚂蚁总是朝向一个主要方向(左,右,上或下),并根据以下规则从正方形移动到相邻正方形: - 如果它在黑色方块上它将方形的颜色翻转为白色逆时针旋转90度向前移动一个方格。 - 如果它在白色方块上它将方块的颜色翻转为黑色顺时针旋转90度并向前移动一个方格。 <p>从一个完全是白色的网格开始在蚂蚁1018次移动后有多少个方块是黑色的 </p></section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler349()</code>应该返回115384615384614940。
testString: 'assert.strictEqual(euler349(), 115384615384614940, "<code>euler349()</code> should return 115384615384614940.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler349() {
// Good luck!
return true;
}
euler349();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>