Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: perdasilva <[email protected]>
  • Loading branch information
perdasilva committed Jan 2, 2023
1 parent 5451fa3 commit 6197176
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/sudoku/sudoku.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (s Sudoku) GetVariables(ctx context.Context, _ input.EntitySource) ([]deppy
for row := 0; row < 9; row++ {
for col := 0; col < 9; col++ {
for n := 0; n < 9; n++ {
variable := input.NewSimpleVariable(deppy.Identifier(GetID(row, col, n)))
variable := input.NewSimpleVariable(GetID(row, col, n))
variables[variable.Identifier()] = variable
inorder = append(inorder, variable)
}
Expand All @@ -67,7 +67,7 @@ func (s Sudoku) GetVariables(ctx context.Context, _ input.EntitySource) ([]deppy
for col := 0; col < 9; col++ {
ids := make([]deppy.Identifier, 9)
for n := 0; n < 9; n++ {
ids[n] = deppy.Identifier(GetID(row, col, n))
ids[n] = GetID(row, col, n)
}
// randomize order to create new sudoku boards every run
rand.Shuffle(len(ids), func(i, j int) { ids[i], ids[j] = ids[j], ids[i] })
Expand All @@ -84,10 +84,10 @@ func (s Sudoku) GetVariables(ctx context.Context, _ input.EntitySource) ([]deppy
for n := 0; n < 9; n++ {
for row := 0; row < 9; row++ {
for colA := 0; colA < 9; colA++ {
idA := deppy.Identifier(GetID(row, colA, n))
idA := GetID(row, colA, n)
variable := variables[idA]
for colB := colA + 1; colB < 9; colB++ {
variable.AddConstraint(constraint.Conflict(deppy.Identifier(GetID(row, colB, n))))
variable.AddConstraint(constraint.Conflict(GetID(row, colB, n)))
}
}
}
Expand All @@ -97,10 +97,10 @@ func (s Sudoku) GetVariables(ctx context.Context, _ input.EntitySource) ([]deppy
for n := 0; n < 9; n++ {
for col := 0; col < 9; col++ {
for rowA := 0; rowA < 9; rowA++ {
idA := deppy.Identifier(GetID(rowA, col, n))
idA := GetID(rowA, col, n)
variable := variables[idA]
for rowB := rowA + 1; rowB < 9; rowB++ {
variable.AddConstraint(constraint.Conflict(deppy.Identifier(GetID(rowB, col, n))))
variable.AddConstraint(constraint.Conflict(GetID(rowB, col, n)))
}
}
}
Expand All @@ -114,11 +114,11 @@ func (s Sudoku) GetVariables(ctx context.Context, _ input.EntitySource) ([]deppy
// all numbers
for n := 0; n < 9; n++ {
for i, offA := range offs {
idA := deppy.Identifier(GetID(x+offA.x, y+offA.y, n))
idA := GetID(x+offA.x, y+offA.y, n)
variable := variables[idA]
for j := i + 1; j < len(offs); j++ {
offB := offs[j]
idB := deppy.Identifier(GetID(x+offB.x, y+offB.y, n))
idB := GetID(x+offB.x, y+offB.y, n)
variable.AddConstraint(constraint.Conflict(idB))
}
}
Expand Down

0 comments on commit 6197176

Please sign in to comment.