Tressette You are given the types: type colore = Spade | Coppa | Bastoni | Denari ;; type valore = Ace | Two | Three | Four | Five | Six | Seven | Jack | Knight | King ;; type mazzo = Null | Carta of carta and carta ={ c : colore ; v : valore ; mutable tl : mazzo };; (see the picture with cards) a. Write a function points : mazzo -> int = that given a deck of cards calculates its point score. The scoring is as follows: Ace is worth 1 point; Two, Three, King, Knight, Jack are each worth 1 3 ; and the rest do not contribute the the point total. The total point score is equal to the sum of the individual points, rounded down at the end.
Tressette
You are given the types:
type colore = Spade | Coppa | Bastoni | Denari ;;
type valore = Ace | Two | Three | Four | Five | Six |
Seven | Jack | Knight | King ;;
type mazzo = Null | Carta of carta and carta ={ c : colore ; v
: valore ; mutable tl : mazzo };;
(see the picture with cards)
a. Write a function points : mazzo -> int = that given a deck of cards calculates its point score. The scoring is as follows: Ace is worth 1 point; Two, Three, King, Knight, Jack are each worth 1 3 ; and the rest do not contribute the the point total. The total point score is equal to the sum of the individual points, rounded down at the end.
b. Write a function max_cards : mazzo -> mazzo = that takes a deck of cards and filters out everything except the greatest cards by value (valore) of each color. The order of cards by value is as follows: Three > Two > Ace > King > Knight > Jack > Seven > Six > Five > Four.
Due to the size of the output, lists like generate_cards 20 2023 are not shown, but can be generated with the use of the attached function.
Step by step
Solved in 5 steps with 2 images