dibber

1.7.0 • Public • Published

dibber

Rotate Two-Dimensional Arrays of uniform size (matrices) 90° forward, useful for fixing programs that confuse programming with mathematics.

Example

//input
[ [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ],
  [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ],
  [ 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 ],
  [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ],
  [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ] ]
//output (rotated 90°)
[ [ 0, 0, 0, 0, 0 ],
  [ 1, 1, 1, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 1, 1, 1 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 1, 1, 1, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 1, 1, 1 ],
  [ 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0 ] ]

Readme

Keywords

none

Package Sidebar

Install

npm i dibber

Weekly Downloads

4

Version

1.7.0

License

ISC

Unpacked Size

36.1 kB

Total Files

6

Last publish

Collaborators

  • fantasyui.com