class Nikoli.Sudoku extends Nikoli.Game constructor: (@board, @name = 'sudoku') -> super @board, @name errors: -> solution = @toArray() errors = [] for i in [0...solution.length] row = solution[i] for j in [0...row.length] cell = new Nikoli.Cell(i, j, solution) if cell.value == 0 errors.push {row: i, column: j, message: 'The cell has no value.'} else if cell.rowDuplicates() || cell.columnDuplicates() || cell.squareDuplicates({x: Math.floor(i/3)*3, y: Math.floor(j/3)*3}, 3) errors.push {row: i, column: j, message: 'The number appears more than once in the row, column or square.'} errors generate: (game, solution = false) -> @game = game if game? @grid.innerHTML = @game.map((row) -> '