DEV Community


Discussion on: Critique My Code: Sudoku Solver in Go

moopet profile image
Ben Sinclair

I don't know go, but the first file I saw was this:

func newCell(puzzle *Puzzle, value, row, column int) Cell {
    return Cell{
        puzzle:         puzzle,
        value:          value,
        x:              row,
        y:              column,
        possibleValues: []int{1, 2, 3, 4, 5, 6, 7, 8, 9},

and my first thought was, why are the co-ordinates sometimes x and y and sometimes row and column... especially when x normally denotes the columnar position? Does it not matter for the purposes of the solution whether the board is rotated 90 degrees or is this going to cause problems later in the code?

mas profile image
Sam P Author • Edited

I do see what you mean here - I think that specific case is the result of the method parameter names being the wrong way round. It doesn't affect the solving but I'll be sure to fix it in the next commit. Thanks for catching this!