let score_bowls bowls =
let rec score_bowls' frame l =
let nextframe = score_bowls' (frame+1)
match l with
| _ when frame = 11 -> 0
| [10;s] -> 10 + s + s
| 10 :: s :: n :: tail -> 10 + s + n + nextframe (s :: n :: tail )
| f :: s :: n :: tail -> f + s + (if((f+s)=10) then n else 0) + nextframe (n :: tail)
| _ -> List.fold_right (fun x y -> x + y) l 0
score_bowls' 1 bowls
4 comments:
hehehe... I just found something cool...
(fun x y -> x + y)
can be replaced with just
(+)
even better!
I'm becoming more acquainted with it better! Cheers, keep doing awesome!
scape room in Romeoville
This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… New Jersey escape room
Post a Comment