Menu

[Solved]Need Help Assignment Standard Ml Sml Language Task Write Program Accepts List Five Numbers Q37117931

I need help with this assignment in Standard ML(SML) Language:

Your task is to write a program that accepts a list of fivenumbers between one and six (representing five dice) and appliesYahtzee scoring rules to determine the best outcome. (Assume thisis the final combination of values; there is no re-rolling orreplacing.)

We are only concerning ourselves with the bottom half of theYahtzee scoring sheet, with scoring is as follows:

  • Yahtzee (5 of a kind) – 50 points
  • Large Straight (either 1-2-3-4-5 or 2-3-4-5-6) – 40 points
  • Small Straight (4 sequential numbers) – 30 points
  • Full House (2 of one number and 3 of another number) – 25points
  • Four of a Kind – sum of all five dice
  • Three of a Kind – sum of all five dice
  • Chance – sum of all five dice

(For reference, see: http://www.wikihow.com/Play-Yahtzee)

Always pick the highest scoring option (be careful – while FullHouse is the correct option for 2-2-3-3-3, three of a kind isbetter for 5-5-6-6-6). In cases where the score would be the same,follow the ordering in the list above, and always pick the optionhighest on the list (so if you have 4-4-4-4-2, pick four of a kind,even though three of a kind and chance would result in the samescore).

The point distribution is as follows:

  • Identifying matching-based hands (three of a kind, four of akind, full house, Yahtzee) – 10 points
  • Identifying “run”-based hands (small and large straights) – 10points
  • Identifying when “chance” should be used – 5 points
  • Choosing the highest-scoring and highest-ranking option – 5points

In all categories, partial credit will be awarded for attemptsthat are partially correct (for example, being able to identifythree of a kind, but not a full house, or not always picking theright scoring category).

Here are a couple of examples of the expected output:

Function call: yahtzee [2, 4, 1, 4, 4];

Output: (three-of-a-kind, 15)

Function call: yahtzee [2, 4, 1, 4, 3]

Output: (small-straight, 30)

Function call: yahtzee [2, 4, 4, 4, 2,]

Output: (“full house”, 30)

Expert Answer


Answer to I need help with this assignment in Standard ML (SML) Language: Your task is to write a program that accepts a list of f… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *