Created
April 6, 2018 01:21
-
-
Save itacirgabral/ff4cb80def8f5bab33de8669e7131459 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cavaleiro = [1.5, 1.4, 1.3, 1.2, 1.1] | |
const casas = [ | |
[cavaleiro[0]], | |
[cavaleiro[1]], | |
[cavaleiro[2]], | |
[cavaleiro[3]], | |
[cavaleiro[4]], | |
[cavaleiro[0]], | |
[cavaleiro[1]], | |
[cavaleiro[2]], | |
[cavaleiro[3]], | |
[cavaleiro[4]], | |
[cavaleiro[0]], | |
[cavaleiro[1]], | |
[ | |
cavaleiro[2], cavaleiro[3], cavaleiro[4], cavaleiro[0], cavaleiro[1], | |
cavaleiro[2], cavaleiro[3], cavaleiro[4], cavaleiro[0], cavaleiro[1], | |
cavaleiro[2], cavaleiro[3], cavaleiro[4] | |
] | |
] | |
const extendArray = (() => { | |
const proto = Object.create(Array.prototype) | |
Object.defineProperty(proto, 'sew', { | |
value: function sew (a) { | |
(a || a === 0) && this.push(a) | |
return this | |
} | |
}) | |
return function extendArray (a) { | |
const ae = Object.assign(Object.create(proto), a) | |
Object.defineProperty(ae, 'length', { | |
value: a.length, | |
writable: true | |
}) | |
return ae | |
} | |
})() | |
const casas2 = moveCavaleiro(casas, 12, 12, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment