Advertisement
Guest User

Untitled

a guest
Mar 1st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.71 KB | None | 0 0
  1. type plate = int * int * int ;;
  2. type game_statu =
  3.    Non_term of int
  4.   |P1 of int
  5.   |P2 of int
  6.   |Match_nul of int;;
  7.  
  8. let init a:plate =(0,a,a);;
  9.  
  10. let display a:plate =
  11.   match a with
  12.     |(-1,p1,p2) -> (" ","X"," "," "," ")
  13.     |(-0,p1,p2) -> (" "," ","X"," "," ")
  14.     |(1,p1,p2) -> (" "," "," ","X"," ")
  15.     |(a,p1,p2) when a < (-1) -> print_string "le joueur 1 a gagner"
  16.     |(_,p1,p2) -> print_string "le joueur 2 a gagner"
  17. in
  18. print_string "le joueur 1 a:";
  19. print_int p1;
  20. print_newline();
  21. print_string "| "^c^" |";
  22. print_newline();
  23. print_string "| "^d^" |";
  24. print_newline();
  25. print_string "| "^e^" |";
  26. print_newline();
  27. print_string "le joueur 2 a"
  28. print_int p2;;
  29.  
  30. display (0,20,50);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement