diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-11-09 22:59:41 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-11-09 22:59:41 +0100 |
commit | 4b900a9624cef9c28d556f2852f27720602a7c99 (patch) | |
tree | ccf3ef72b88f76d5a3e0d6098aecc93d3ea9d0a5 /judge/core.ml | |
parent | b0923738e8d46a073274318f74715cb5ca6cc8bc (diff) | |
download | CompetIA-4b900a9624cef9c28d556f2852f27720602a7c99.tar.gz CompetIA-4b900a9624cef9c28d556f2852f27720602a7c99.zip |
Add display functions...
Diffstat (limited to 'judge/core.ml')
-rw-r--r-- | judge/core.ml | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/judge/core.ml b/judge/core.ml index 8b437d3..0f665c2 100644 --- a/judge/core.ml +++ b/judge/core.ml @@ -24,11 +24,14 @@ module type GAME = sig type game (* immutable structure *) val name : string (* ex: Morpion récursif *) - val id : string (* ex: morpion_rec *) + val id : string (* ex: morpion_rec *) - val new_game : game * game_status + val new_game : game - val turn : game -> player -> string -> (game * game_status) + val turn : game -> player -> string -> game + val s : game -> game_status + + val display_game : game -> (string * string) -> unit end module type CORE = sig @@ -237,8 +240,8 @@ module Core (G: GAME) : CORE = struct in let p1 = open_c (Hashtbl.find players p1) in let p2 = open_c (Hashtbl.find players p2) in - let g, s = G.new_game in - let g = { p1; p2; hist = [g]; s } in + let g = G.new_game in + let g = { p1; p2; hist = [g]; s = G.s g } in r_games := g::(!r_games) in let can_launch, cannot_launch = List.partition @@ -284,7 +287,8 @@ module Core (G: GAME) : CORE = struct p.s <- StandBy !game_time; | Play act, Thinking (time, beg_r) -> let end_r = Unix.gettimeofday () in - let new_g, new_s = G.turn (List.hd g.hist) pi act in + let new_g = G.turn (List.hd g.hist) pi act in + let new_s = G.s new_g in send_m p OK; send_m op (Play act); g.s <- new_s; |