aboutsummaryrefslogtreecommitdiff
path: root/judge/core.ml
diff options
context:
space:
mode:
Diffstat (limited to 'judge/core.ml')
-rw-r--r--judge/core.ml16
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;