Go Fish/Haskell: Difference between revisions

m
Fixed syntax highlighting.
m (categorization now in master page)
m (Fixed syntax highlighting.)
 
Line 2:
If possible, the AI will randomly select a rank known to be in the human's hand (a card in the AI's hand that the human has asked for before and the AI hasn't asked for before). If there are no known ranks, a rank is randomly selected from the AI's hand.
 
<langsyntaxhighlight lang="haskell">import Char
import IO
import Data.Map (Map)
Line 140:
drawN n hand deck = iterate (uncurry draw) (hand, deck) !! (n-1)
 
handToCards = concatMap (\(r,ss) -> map (flip (,) r) $ S.toList ss) . M.assocs</langsyntaxhighlight>
9,476

edits