You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ColumnConstraint.cs 515B

1234567891011121314151617181920
  1. using uqac_ia_sudoku_csp.Interfaces;
  2. namespace uqac_ia_sudoku_csp.Solver.Constraints
  3. {
  4. public class ColumnConstraint : IConstraint
  5. {
  6. public bool Check(Board board, int x, int y)
  7. {
  8. var cell = board.GetNumber(x, y).Value;
  9. for (var yy = 0; yy < board.Size; ++yy)
  10. {
  11. if (cell == board.GetNumber(x, yy) && yy != y)
  12. {
  13. return false;
  14. }
  15. }
  16. return true;
  17. }
  18. }
  19. }