/board.js Secret
Created
November 19, 2019 12:54
Revisions
-
melcor76 created this gist
Nov 19, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // Transpose matrix, p is the Piece. for (let y = 0; y < p.shape.length; ++y) { for (let x = 0; x < y; ++x) { [p.shape[x][y], p.shape[y][x]] = [p.shape[y][x], p.shape[x][y]]; } } // Reverse the order of the columns. p.shape.forEach(row => row.reverse());