Skip to content

Instantly share code, notes, and snippets.

@jkutner
Created December 6, 2010 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkutner/729756 to your computer and use it in GitHub Desktop.
Save jkutner/729756 to your computer and use it in GitHub Desktop.
score([], DukesInDeck, DuchiesInDeck, Score) :-
Score is DukesInDeck*DuchiesInDeck.
score([duchy|Rest], DukesInDeck, DuchiesInDeck, Score) :-
Y is DuchiesInDeck+1,
score(Rest, DukesInDeck, Y, X),
Score is 3+X.
score([duke|Rest], DukesInDeck, DuchiesInDeck, Score) :-
Y is DukesInDeck+1,
score(Rest, Y, DuchiesInDeck, Score).
score(Deck, Score) :-
score(Deck, 0, 0, Score).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment