Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple sample backbone js app. It finds solutions to the classic Rooks Problem. I am implementing this for the awesome folks over http://www.catalystclass.com.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
css
design
js
lib
spec
README.md
SpecRunner.html
index.html

README.md

n-rooks

The total number of ways of placing n nonattacking rooks on an n x n chess board is n!

This solution has some interesting implications in pure and applied combinatorics, group theory, number theory, and statistical analysis.

Exercise: n-rooks solutions calculator

  • Develop an n-rooks solutions calculator by implementing backbone.js, and underscore.js and using jasmine for testing your code
  • Make sure to drive out your logic first by writing jasmine specs for your models
    • Your models should capture all the details of the problem
  • Views should be implemented with mustache or with similar templating tool
  • Should render an 8x8 chessboard (n is 8 by default for this exercise)
    • Use the unicode chess rook symbol to render rooks (example: ♖)
    • Allow the user to pick the color of the rook
    • Render the chessboard with html and css (no images)
  • Should calculate and keep track of all solutions
    • Should allow the user to change a default calculation timeout of 30s
    • Should keep track of all solutions discovered before the timeout period
    • Should allow the user to view calculated solutions by using the arrow keys

Extra Credit:

  • Display the timer as your validator/solver calculates valid solutions
  • Use your timer code that you wrote as a guideline to implement a faster algorithm
  • After you implement a more optimal solution, allow the user to pick the different algorithm

Extra-Extra Credit:

  • Allow the user to destroy cells on the chessboard (make holes) by clicking on them - damaged chessboard problem
  • Based on destroyed cells, write a polynomial-time [O(n^k)] algorithm, to find the maximum number of non-attacking rooks that may be placed on the board

Super-Extra Credit:

  • Give the user the ability to pick between queens and rooks (n-queens problem)
  • Implement the non-attacking queens solver

References

Something went wrong with that request. Please try again.