Go Fish/OCaml: Difference between revisions
m
Fixed syntax highlighting.
(Created page with '{{collection|Go Fish}}Category:OCaml <lang ocaml>type pip = Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King | Ace let pips = …') |
m (Fixed syntax highlighting.) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1:
{{collection|Go Fish}}
<
Jack | Queen | King | Ace
let pips = [Two; Three; Four; Five; Six; Seven; Eight; Nine; Ten;
Line 38:
let pip_of_card (pip, _) = (pip)
let deck =
Line 146 ⟶ 147:
Printf.printf "choose from 1 to %d\n%!" n;
let get_int() =
try
with Failure "int_of_string" -> raise Exit
in
Line 199 ⟶ 200:
*)
opponent <- List.sort (fun _ _ -> Random.int 9 - Random.int 9) opponent;
method give_cards (_cards : card list) =
Line 314 ⟶ 315:
Printf.printf "player a has %d books\n" (player_a#books_length);
Printf.printf "player b has %d books\n" (player_b#books_length);
;;</
|