aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2011-06-18 17:28:28 +0200
committerThibaut Horel <thibaut.horel@gmail.com>2011-06-18 17:28:28 +0200
commitf2641ef2a62654e31820e9549e1cace4c58845ae (patch)
tree995a847ca3a1f3c3b9b6295ff617e67050e07a0c
parent7389bcafe52ad5f92f84983ad2781ddfbcec7158 (diff)
downloadicfp2011-f2641ef2a62654e31820e9549e1cace4c58845ae.tar.gz
Basic ltg progam.
Main loop reading opponent moves.
-rw-r--r--ltg.ml29
1 files changed, 29 insertions, 0 deletions
diff --git a/ltg.ml b/ltg.ml
new file mode 100644
index 0000000..e5de957
--- /dev/null
+++ b/ltg.ml
@@ -0,0 +1,29 @@
+let me = int_of_string Sys.argv.(1)
+
+let opponent = match me with
+ | 0 -> 1
+ | 1 -> 0
+ | _ -> failwith "Wrong player_number"
+
+let read_move () = Scanf.scanf "%d\n" (fun d -> match d with
+ | 1 -> Scanf.scanf "%s\n%d\n" (fun s d -> ())
+ | 2 -> Scanf.scanf "%d\n%s\n" (fun d s -> ())
+ | _ -> failwith "Wrong move number"
+)
+
+let play_move () = ()
+
+let do_round =
+ if me = 0
+ then fun () -> play_move (); read_move ()
+ else fun () -> read_move (); play_move ()
+
+
+let _ =
+ let round = ref 1 in
+ while !round <= 100000 do
+ Printf.printf "Round %d\n========" !round;
+ print_newline ();
+ do_round ();
+ incr round
+ done \ No newline at end of file