diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-11-10 20:03:58 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-11-10 20:03:58 +0100 |
commit | e4fe9fdf42bde26609ed3c53b012f911e225b971 (patch) | |
tree | e0d9e9c78ae1c6e1b5454e7c83cc0fbcfb4fbfa9 | |
parent | 9aa8b3a702c65f47033651e770ab3755a0210c16 (diff) | |
parent | 3fdf270456da15447c5a57851610888e2f510574 (diff) | |
download | CompetIA-e4fe9fdf42bde26609ed3c53b012f911e225b971.tar.gz CompetIA-e4fe9fdf42bde26609ed3c53b012f911e225b971.zip |
Merge branch 'master' into ocaml-3.12
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | judge/main.ml | 2 | ||||
-rw-r--r-- | judge/morpion_rec.ml | 9 |
3 files changed, 7 insertions, 6 deletions
@@ -108,6 +108,8 @@ Les commandes sont les suivantes : - p : partie précédente (prev) - f : coup suivant (forward) - b : coup précédent (back) + - a : début de partie + - z : fin de partie Le morpion récursif diff --git a/judge/main.ml b/judge/main.ml index 85c09b6..61735f0 100644 --- a/judge/main.ml +++ b/judge/main.ml @@ -75,6 +75,8 @@ end = struct curr_view := NavGame (g, n+1) | NavGame (g, n), 'f' when n = List.length (C.hist g) - 1 -> curr_view := NavGame (g, -1) + | NavGame(g, _), 'a' -> curr_view := NavGame(g, 0) + | NavGame(g, _), 'z' -> curr_view := NavGame(g, -1) | ViewLastGame, '\t' | NavGame _, '\t' -> curr_view := MatchList false | Question(_, y, n), 'y' -> y() | Question(_, y, n), 'n' -> curr_view := n diff --git a/judge/morpion_rec.ml b/judge/morpion_rec.ml index c7ca480..cb23821 100644 --- a/judge/morpion_rec.ml +++ b/judge/morpion_rec.ml @@ -111,11 +111,10 @@ module G = struct let full_pm m = List.for_all (fun p -> getp1 m p <> Empty) all_p1 - let possibilities (s, m, lg) = let pg_poss = match lg with | None -> all_p1 - | Some x -> if full_pm (getp1 m x) then all_p1 else [x] + | Some x -> [x] in List.flatten (List.map (fun pg -> @@ -132,9 +131,7 @@ module G = struct | TurnOf player when (match pgo with | None -> true - | Some x when full_pm (getp1 m x) -> true - | Some x when pg = x -> true - | _ -> false) + | Some x -> pg = x) && getp m (pg, pp) = Empty -> let op = other_player player in @@ -145,7 +142,7 @@ module G = struct | O -> Won P2 | T -> Tie in - (new_s, new_m, Some pp) + (new_s, new_m, if full_pm (getp1 new_m pp) then None else Some pp) | TurnOf x -> (Eliminated x, m, pgo) | _ -> raise (Eliminated_ex "not someone's turn!") |