Skip to content

markusait/randomGrid

Repository files navigation

#RandomGrid

Using Javascript to calculate a random grid. Like in Sodoku the challenge was to allow only for unique numbers in each row and column hence the only duplicates occur in traveses

Example

var n = 9

[ [ 2, 3, 4, 7, 5, 9, 6, 1, 8 ],
  [ 1, 2, 3, 4, 6, 5, 7, 8, 9 ],
  [ 5, 1, 6, 3, 2, 4, 8, 9, 7 ],
  [ 7, 8, 9, 5, 1, 2, 3, 4, 6 ],
  [ 9, 5, 7, 6, 8, 3, 1, 2, 4 ],
  [ 3, 7, 8, 9, 4, 1, 2, 6, 5 ],
  [ 4, 6, 2, 8, 9, 7, 5, 3, 1 ],
  [ 6, 9, 1, 2, 7, 8, 4, 5, 3 ],
  [ 8, 4, 5, 1, 3, 6, 9, 7, 2 ] ]

the most efficient one is fastGrid.js

About

Calculating a random Grid with N numbers in which each column and row has only unique numbers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published