86 lines
2.2 KiB
Markdown
86 lines
2.2 KiB
Markdown
---
|
|
title: Zhang-Suen thinning algorithm
|
|
id: 594810f028c0303b75339ad7
|
|
challengeType: 5
|
|
videoUrl: ''
|
|
localeTitle: ''
|
|
---
|
|
|
|
## Description
|
|
undefined
|
|
|
|
## Instructions
|
|
undefined
|
|
|
|
## Tests
|
|
<section id='tests'>
|
|
|
|
```yml
|
|
tests:
|
|
- text: ''
|
|
testString: 'assert.equal(typeof thinImage, "function", "<code>thinImage</code> must be a function");'
|
|
- text: ''
|
|
testString: 'assert(Array.isArray(result), "<code>thinImage</code> must return an array");'
|
|
- text: ''
|
|
testString: 'assert.equal(typeof result[0], "string", "<code>thinImage</code> must return an array of strings");'
|
|
- text: ''
|
|
testString: 'assert.deepEqual(result, expected, "<code>thinImage</code> must return an array of strings");'
|
|
|
|
```
|
|
|
|
</section>
|
|
|
|
## Challenge Seed
|
|
<section id='challengeSeed'>
|
|
|
|
<div id='js-seed'>
|
|
|
|
```js
|
|
const testImage = [
|
|
' ',
|
|
' ################# ############# ',
|
|
' ################## ################ ',
|
|
' ################### ################## ',
|
|
' ######## ####### ################### ',
|
|
' ###### ####### ####### ###### ',
|
|
' ###### ####### ####### ',
|
|
' ################# ####### ',
|
|
' ################ ####### ',
|
|
' ################# ####### ',
|
|
' ###### ####### ####### ',
|
|
' ###### ####### ####### ',
|
|
' ###### ####### ####### ###### ',
|
|
' ######## ####### ################### ',
|
|
' ######## ####### ###### ################## ###### ',
|
|
' ######## ####### ###### ################ ###### ',
|
|
' ######## ####### ###### ############# ###### ',
|
|
' '];
|
|
|
|
function thinImage(image) {
|
|
// Good luck!
|
|
}
|
|
|
|
```
|
|
|
|
</div>
|
|
|
|
|
|
### After Test
|
|
<div id='js-teardown'>
|
|
|
|
```js
|
|
console.info('after the test');
|
|
```
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
## Solution
|
|
<section id='solution'>
|
|
|
|
```js
|
|
// solution required
|
|
```
|
|
</section>
|