aboutsummaryrefslogtreecommitdiff
path: root/judge
diff options
context:
space:
mode:
Diffstat (limited to 'judge')
-rw-r--r--judge/dummy_game.ml2
-rw-r--r--judge/dummy_player.ml8
-rw-r--r--judge/main.ml54
3 files changed, 59 insertions, 5 deletions
diff --git a/judge/dummy_game.ml b/judge/dummy_game.ml
index c5be248..29fe88b 100644
--- a/judge/dummy_game.ml
+++ b/judge/dummy_game.ml
@@ -14,7 +14,7 @@ module Dummy : GAME = struct
let op = other_player p in
(g-1, l@[p, xx],
if g - 1 = 0 then
- if Random.int 100 = 0 then Eliminated p
+ if Random.int 10 = 0 then Eliminated p
else if Random.int 2 = 0 then Won p
else if Random.int 2 = 0 then Won op
else Tie
diff --git a/judge/dummy_player.ml b/judge/dummy_player.ml
index 09b13aa..44a24ce 100644
--- a/judge/dummy_player.ml
+++ b/judge/dummy_player.ml
@@ -9,6 +9,14 @@ let words = [|
"meme pas peur"; "python FTW"; "savanne!";
"le lion mange le lion"; "canard"; "tennis";
"sauve qui peut!"; "bref..."; "j'approuve.";
+ "I AM YOUR FATHER!"; "j'aime les patates";
+ "viens au tableau s'il te plait!";
+ "je suis contre"; "j'approuve"; "horreur";
+ "consternation"; "mensonge!"; "ah la honte!";
+ "s'pas faux..."; "tigre du bengale"; "c'est la guerre!";
+ "Hitler"; "Staline"; "Nazi!"; "Communiste!";
+ "Le Pen au pouvoir!"; "deux anges passent"; "radio";
+ "j'ai une grosse courgette"; "bouilloire"; "morning coffee";
|]
let expect mgs =
diff --git a/judge/main.ml b/judge/main.ml
index ef73ec5..ac22602 100644
--- a/judge/main.ml
+++ b/judge/main.ml
@@ -51,8 +51,26 @@ end = struct
(fun () -> C.add_rounds(); curr_view := MatchList false),
!curr_view
)
- | MatchList _, 'v' -> curr_view := ViewLastGame
- | ViewLastGame, '\t' -> curr_view := MatchList false
+ | MatchList _, 'v' when C.games () <> [] -> curr_view := ViewLastGame
+ | MatchList _, 'n' when C.games () <> [] ->
+ curr_view := NavGame ((List.hd (C.games())), 0)
+ | NavGame (g, n), 'b' when n > 0 ->
+ curr_view := NavGame (g, n-1)
+ | NavGame (g, n), 'f' when n < List.length (C.hist g) - 1 ->
+ curr_view := NavGame (g, n+1)
+ | NavGame (g, _), 'n' ->
+ let rec dx = function
+ | gg::pg::_ when pg == g -> curr_view := NavGame (gg, 0)
+ | _::l -> dx l
+ | [] -> ()
+ in dx (C.games())
+ | NavGame (g, _), 'p' ->
+ let rec dx = function
+ | pg::gg::_ when pg == g -> curr_view := NavGame (gg, 0)
+ | _::l -> dx l
+ | [] -> ()
+ in dx (C.games())
+ | ViewLastGame, '\t' | NavGame _, '\t' -> curr_view := MatchList false
| Question(_, y, n), 'y' -> y()
| Question(_, y, n), 'n' -> curr_view := n
| v, 'q' ->
@@ -146,8 +164,36 @@ end = struct
G.display_game (C.g g) (p1n, p2n)
| _ -> ()
and nav_game_disp g n =
- (* TODO *)
- ()
+ let p1n, p2n = C.pn g in
+ text1 1 p1c p1n;
+ text2 1 p2c p2n;
+ text4 1 grey "match list >";
+ hl();
+ let put_st i g =
+ let cx = 10 * i + 30 in
+ let cy = size_y () - 60 in
+ begin match G.s g with
+ | TurnOf p ->
+ set_color (pc p);
+ draw_circle cx cy 2
+ | Won p ->
+ set_color (pc p);
+ draw_circle cx cy 2;
+ draw_circle cx cy 4
+ | Tie ->
+ set_color black;
+ draw_circle cx cy 4
+ | Eliminated p ->
+ set_color (pc p);
+ draw_segments [| cx - 3, cy - 3, cx + 4, cy + 4; cx - 3, cy + 3, cx + 4, cy - 4 |]
+ end;
+ if i = n then begin
+ set_color black;
+ fill_circle cx (cy-10) 2;
+ G.display_game g (p1n, p2n)
+ end
+ in
+ List.iteri put_st (List.rev (C.hist g))
end