Skip to content

Done functions dragonCurve and rotateMatrix, added some tests.#4

Open
davydoka wants to merge 2 commits into
front-camp-2018:masterfrom
davydoka:master
Open

Done functions dragonCurve and rotateMatrix, added some tests.#4
davydoka wants to merge 2 commits into
front-camp-2018:masterfrom
davydoka:master

Conversation

@davydoka

Copy link
Copy Markdown

No description provided.

Comment thread src/dragon-curve/index.js
export const dragonCurve = n => {
// logic...
};
const invert = st => [...st].map(i => i === '0' ? 1 : 0).reverse().join('');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good!

// logic...
return arr.length !== 0 && arr.length === arr[0].length
? arr[0].map((elem, i) => arr.map( elem => elem[i]))
: new Error('this is not a square matrix');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const rotateMatrix = arr => {
	return arr.map((_, i) => arr.map(elem => elem[i]))
};


describe('rotateMatrix::', () => {
// need to implement
it('should return a rotated matrix', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants