diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-11-10 10:46:37 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-11-10 10:46:37 +0100 |
commit | 80e625a9c8d33c71fe69a375c211868fcc1938a5 (patch) | |
tree | f516d701cc8cb50e9a1d003afe6e7d1f05b457ca /judge/dummy_game.ml | |
parent | d343fcb803e955504b0d6b5c9c852620886c2994 (diff) | |
download | CompetIA-80e625a9c8d33c71fe69a375c211868fcc1938a5.tar.gz CompetIA-80e625a9c8d33c71fe69a375c211868fcc1938a5.zip |
Start work on players!
Diffstat (limited to 'judge/dummy_game.ml')
-rw-r--r-- | judge/dummy_game.ml | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/judge/dummy_game.ml b/judge/dummy_game.ml index 1e72682..4ac4eac 100644 --- a/judge/dummy_game.ml +++ b/judge/dummy_game.ml @@ -1,16 +1,15 @@ open Core open Main -module Dummy : GAME = struct +module G : GAME = struct type game = int * (player * string) list * game_status let new_game = (10, [], TurnOf P1) - let play (g, l, s0) p xx = - if s0 <> TurnOf p || g <= 0 then - (g, l, Eliminated p) - else + let play (g, l, s0) xx = + match s0 with + | TurnOf p when g > 0 -> let op = other_player p in (g-1, l@[p, xx], if g - 1 = 0 then @@ -21,6 +20,8 @@ module Dummy : GAME = struct else TurnOf op ) + | TurnOf x -> (g, l, Eliminated x) + | _ -> raise (Eliminated_ex "not someone's turn!") let s (_, _, s) = s @@ -46,10 +47,3 @@ module Dummy : GAME = struct let name = "Dummy game for testing purposes" end - -module C = Core(Dummy) -module Main = Juge(C) - -let () = - Random.self_init (); - Main.run () |