Problem 141 (tricky card games)

22 views
Skip to first unread message

Emlyn Corrin

unread,
Jun 8, 2020, 8:32:01 AM6/8/20
to 4Clojure
I noticed that none of the tests check that the solution still works when a trump suit is specified but is not played, with a test something like:

(= {:suit :spade :rank 2} ((__ :heart) [{:suit :spade :rank 2}
                                        {:suit :club :rank 10}]))

this allows some solutions to be accepted which should not be valid, such as:

(fn [t]
  (fn [c]
    (apply max-key :rank
           (filter #(= (or t (:suit (first c))) (:suit %)) c))))

Reply all
Reply to author
Forward
0 new messages