aboutsummaryrefslogtreecommitdiffstats
path: root/ltg.ml
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2011-06-19 08:53:03 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2011-06-19 08:53:03 -0400
commit61ab6e1e47f3337468486e9fcf41044cd6fade22 (patch)
treead08c2171159875613f44de6751d23a5b2b2075e /ltg.ml
parent3ffcb6a1c060ee43ec37dc70826096f5780f6585 (diff)
parentda15834dc54ec936745347e3f04d563a4bb6ace4 (diff)
downloadicfp2011-61ab6e1e47f3337468486e9fcf41044cd6fade22.tar.gz
Merge branch 'master' of github.com:Zaran/icfp2011
Diffstat (limited to 'ltg.ml')
-rw-r--r--ltg.ml17
1 files changed, 15 insertions, 2 deletions
diff --git a/ltg.ml b/ltg.ml
index d3b7473..1da6295 100644
--- a/ltg.ml
+++ b/ltg.ml
@@ -22,10 +22,23 @@ let read_move () = Scanf.scanf "%d\n" (fun d -> match d with
let play_move () = ()
+let automatic player =
+ let aux i slot =
+ if slot.vitality = -1 then begin
+ Game.right_apply_bis player I i;
+ slot.vitality <- 0;
+ slot.field <- id
+ end
+ in
+ if player = 0 then
+ Array.iteri aux player0
+ else
+ Array.iteri aux player1
+
let do_round =
if me = 0
- then fun () -> play_move (); read_move ()
- else fun () -> read_move (); play_move ()
+ then fun () -> automatic 0; play_move (); automatic 1; read_move ()
+ else fun () -> automatic 0; read_move (); automatic 1; play_move ()
let _ =