diff options
Diffstat (limited to 'judge/main.ml')
-rw-r--r-- | judge/main.ml | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/judge/main.ml b/judge/main.ml index ac22602..ea7c2ef 100644 --- a/judge/main.ml +++ b/judge/main.ml @@ -53,23 +53,28 @@ end = struct ) | 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) + let g = List.hd (C.games()) in + curr_view := NavGame (g, -1) | NavGame (g, _), 'n' -> let rec dx = function - | gg::pg::_ when pg == g -> curr_view := NavGame (gg, 0) + | gg::pg::_ when pg == g -> curr_view := NavGame (gg, -1) | _::l -> dx l | [] -> () in dx (C.games()) | NavGame (g, _), 'p' -> let rec dx = function - | pg::gg::_ when pg == g -> curr_view := NavGame (gg, 0) + | pg::gg::_ when pg == g -> curr_view := NavGame (gg, -1) | _::l -> dx l | [] -> () in dx (C.games()) + | NavGame (g, n), 'b' when n > 0 -> + curr_view := NavGame (g, n-1) + | NavGame (g, n), 'b' when n = -1 -> + curr_view := NavGame (g, List.length (C.hist g) - 1) + | NavGame (g, n), 'f' when n < List.length (C.hist g) - 1 && n <> -1 -> + curr_view := NavGame (g, n+1) + | NavGame (g, n), 'f' when n = List.length (C.hist g) - 1 -> + 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 @@ -169,6 +174,7 @@ end = struct text2 1 p2c p2n; text4 1 grey "match list >"; hl(); + let n = if n = -1 then List.length (C.hist g) -1 else n in let put_st i g = let cx = 10 * i + 30 in let cy = size_y () - 60 in |