(define (Score X Y)
(list (count list? (map (lambda (y) (member y X)) Y))
(count zero? (map - X Y))))
; <--- Is there a better way? (using equal? instead of - ) ?
FYI, here is an interesting paper about playing Mastermind using a SAT solver, beating other approaches. Mastermind turns out to be well-known
to be NP-complete (a quick web search found that). https://www.seas.upenn.edu/~ncollina/Mastermind.pdf
What are some relevant sections in Knuth's book [Satisfiability] ?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 433 |
Nodes: | 16 (2 / 14) |
Uptime: | 63:54:28 |
Calls: | 9,092 |
Calls today: | 1 |
Files: | 13,412 |
Messages: | 6,025,661 |