diff options
Diffstat (limited to 'judge/main.ml')
-rw-r--r-- | judge/main.ml | 54 |
1 files changed, 50 insertions, 4 deletions
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 |