matrix.js - addyh/tetris GitHub Wiki

Matrix Functions

  • Bool arraysEqual(Array a, Array b)

    • Are two arrays/matrices equal?
    • Used to to rotate the piece matrices (If array is 'this' ... make it 'this')
  • Array makeMatrix(Int shape)

    • Return a (4x4) array with 0's representing empty spaces,
    • and 1's forming the defined shape (S, Z, L, etc)
  • Array rotatedPiece(Array matrixCopy)

    • Return the rotated version of a piece matrix