chore(learn): Applied MDX format to Chinese curriculum files (#40462)

This commit is contained in:
Randell Dawson
2020-12-16 00:37:30 -07:00
committed by GitHub
parent 873fce02a2
commit 9ce4a02a41
1665 changed files with 58741 additions and 88042 deletions

View File

@ -1,69 +1,49 @@
---
id: 5951ed8945deab770972ae56
title: 河内的塔
challengeType: 5
videoUrl: ''
title: 河内的塔
---
## Description
<section id="description">任务: <p>解决<a href="https://en.wikipedia.org/wiki/Towers_of_Hanoi" title="wpTowers_of_Hanoi">河内塔</a>问题。 </p><p>您的解决方案应该接受光盘数量作为第一个参数,并使用三个字符串来识别三个光盘堆栈中的每一个,例如<code>towerOfHanoi(4, &#39;A&#39;, &#39;B&#39;, &#39;C&#39;)</code> 。该函数应该返回一个包含移动列表的数组数组source - &gt; destination。例如数组<code>[[&#39;A&#39;, &#39;C&#39;], [&#39;B&#39;, &#39;A&#39;]]</code>表示第一个移动是将光盘从堆栈A移动到C第二个移动是移动一个从堆栈B到A的光盘</p></section>
# --description--
## Instructions
<section id="instructions">
</section>
任务:
## Tests
<section id='tests'>
解决[河内塔](https://en.wikipedia.org/wiki/Towers_of_Hanoi "wpTowers_of_Hanoi")问题。
```yml
tests:
- text: <code>towerOfHanoi</code>是一个功能。
testString: assert(typeof towerOfHanoi === 'function');
- text: <code>towerOfHanoi(3, ...)</code> 应该返回7招。
testString: assert(res3.length === 7);
- text: <code>towerOfHanoi(3, "A", "B", "C")</code>应返回[[“A”“B”][“A”“C”][“B”“C”][ “A” “B”][ “C” “A”][ “C” “B”][ “A” “B”]]“)。
testString: assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves);
- text: <code>towerOfHanoi(5, "X", "Y", "Z")</code>第10 <code>towerOfHanoi(5, "X", "Y", "Z")</code>应为Y - &gt; X.
testString: assert.deepEqual(res5[9], ['Y', 'X']);
- text: <code>towerOfHanoi(7, "A", "B", "C")</code>前十个动作是[[“A”“B”][“A”“C”][“B”“C”] [ “A” “B”][ “C” “A”][ “C” “B”][ “A” “B”][ “A” “C”] [ “B” “C”][ “B” “A”]]“)。
testString: assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves);
您的解决方案应该接受光盘数量作为第一个参数,并使用三个字符串来识别三个光盘堆栈中的每一个,例如`towerOfHanoi(4, 'A', 'B', 'C')` 。该函数应该返回一个包含移动列表的数组数组source - > destination。例如数组`[['A', 'C'], ['B', 'A']]`表示第一个移动是将光盘从堆栈A移动到C第二个移动是移动一个从堆栈B到A的光盘
```
# --hints--
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
`towerOfHanoi`是一个功能。
```js
function towerOfHanoi (n, a, b, c) {
// Good luck!
return [[]];
}
assert(typeof towerOfHanoi === 'function');
```
</div>
### After Test
<div id='js-teardown'>
`towerOfHanoi(3, ...)` 应该返回7招。
```js
console.info('after the test');
assert(res3.length === 7);
```
</div>
</section>
## Solution
<section id='solution'>
`towerOfHanoi(3, "A", "B", "C")`应返回\[[“A”“B”][“A”“C”][“B”“C”][ “A” “B”][ “C” “A”][ “C” “B”][ “A” “B”]]“)。
```js
// solution required
assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves);
```
/section>
`towerOfHanoi(5, "X", "Y", "Z")`第10 `towerOfHanoi(5, "X", "Y", "Z")`应为Y - > X.
```js
assert.deepEqual(res5[9], ['Y', 'X']);
```
`towerOfHanoi(7, "A", "B", "C")`前十个动作是\[[“A”“B”][“A”“C”][“B”“C”][ “A” “B”][ “C” “A”][ “C” “B”][ “A” “B”][ “A” “C”][ “B” “C”][ “B” “A”]]“)。
```js
assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves);
```
# --solutions--