E4. prop_candidates_correct?

39 views
Skip to first unread message

albin.h...@gmail.com

unread,
Nov 30, 2018, 11:27:51 AM11/30/18
to 2018 Functional Programming TDA452 / DIT 143
Hello,

It seems that QuickCheck generates faulty sudokus for the prop_candidates_correct function. (We assume that it is because it uses the given C2 assignment).

For example:
Sudoku {rows = [
[Just 7,Just 3,Just 8,Just 2,Nothing,Just 7,Just 5,Just 7,Just 7],
[Just 2,Just 4,Just 1,Just 8,Just 3,Just 3,Just 5,Just 5,Just 7],
[Just 9,Just 8,Just 9,Just 4,Just 2,Just 3,Just 5,Just 4,Just 2],
[Just 4,Just 1,Nothing,Just 3,Nothing,Just 9,Just 2,Just 4,Just 3],
[Just 9,Nothing,Just 4,Just 5,Just 9,Just 1,Just 7,Just 1,Just 7],
[Just 5,Just 3,Just 5,Just 4,Just 5,Just 8,Just 5,Just 5,Just 1],
[Just 1,Just 1,Just 6,Just 9,Nothing,Just 3,Just 3,Just 3,Just 2],
[Just 7,Just 9,Just 7,Just 6,Just 5,Just 6,Just 9,Just 9,Just 9],
[Just 2,Just 9,Just 4,Just 9,Just 5,Just 7,Just 8,Just 9,Just 7]
]}

(There are four "Just 7":s in the first row)

How should we solve this? We cannot just ignore these since there is a very low probability that any of the 100 generated sudokus are correct.

Best regards,
Albin & Victor

Thomas Hallgren

unread,
Nov 30, 2018, 12:01:08 PM11/30/18
to albin.h...@gmail.com, 2018 Functional Programming TDA452 / DIT 143
Hello,

There are very few empty squares in the example you gave. In C1, the suggestion is that the function cell should generate 90% empty squares. If you do that, perhaps you will get enough useful test data to obtain 100 successful tests of prop_candidates_correct...

Best regards,
Thomas H

albin.h...@gmail.com

unread,
Nov 30, 2018, 12:04:42 PM11/30/18
to 2018 Functional Programming TDA452 / DIT 143
Hi,

Aha! We accidentally read it the other way around, thanks!

Best regards,
Albin & Victor
Reply all
Reply to author
Forward
0 new messages