Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % We don't need to know the sequence -- all we need is the separate entries of the strategy guide
- guide(a, y).
- guide(b, x).
- guide(c, z).
- % We don't need to keep track of the rules or separate scoring -- all we need is a 9-item table with pre-calculated scores for every combination
- score(a, x, 4).
- score(a, y, 8).
- score(a, z, 3).
- score(b, x, 1).
- score(b, y, 5).
- score(b, z, 9).
- score(c, x, 7).
- score(c, y, 2).
- score(c, z, 6).
- % Now go through all entries in the guide, look up their scores and sum those scores
- total_score(TotalScore) :- findall(Score, (guide(ElfChoice, MyChoice), score(ElfChoice, MyChoice, Score)), ScoreList), sum_list(ScoreList, TotalScore).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement