Skip to content

Instantly share code, notes, and snippets.

💼
Making games

Tymon Oziemblewski Tymski

💼
Making games
Block or report user

Report or block Tymski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View kropki.js
createArray = (x, y, fill = 0) => {
for (var ary = []; ary.push(Array(x).fill(fill)) < y;);
return ary;
}
board = createArray(10, 10, 3);
display = (ary = board) => console.table(ary) // function that draws the board in the console
has4 = (ary) => ary.filter(x => x >= 4).length > 0 // Is there a 4 or more in 1 dimensional array?
Has4 = (ary = board) => ary.filter((x) => has4(x)).length > 0 // Is there a 4 or more in 2 dimensional array?
split = () => {
let board2 = createArray(10, 10);
@Tymski
Tymski / pipe.js
Last active Aug 2, 2017
JavaScript pipe, object oriented pipe declaration with example, pipeline
View pipe.js
//Pipe definition:
Object.defineProperty(Object.prototype, 'pipe',{
value: function(...f){ return f.reduce((val, fun) => fun(val), this)},
writable: true,
configurable: true,
enumerable: false
});
//Easier logging to console:
log = console.log;
You can’t perform that action at this time.