diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2014-11-16 12:44:32 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2014-11-16 12:44:32 +0100 |
commit | 80475db04ef557abc6d7e1cb708a954d501f4f3a (patch) | |
tree | 0fc15d06f0f468c1da1d987131e98cedc9e914f4 /judge/morpion_rec.ml | |
parent | 0e83991e3f8739ec00d744f038fdfaea2b60c98e (diff) | |
download | CompetIA-80475db04ef557abc6d7e1cb708a954d501f4f3a.tar.gz CompetIA-80475db04ef557abc6d7e1cb708a954d501f4f3a.zip |
Diffstat (limited to 'judge/morpion_rec.ml')
-rw-r--r-- | judge/morpion_rec.ml | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/judge/morpion_rec.ml b/judge/morpion_rec.ml index a46b7f9..49e6544 100644 --- a/judge/morpion_rec.ml +++ b/judge/morpion_rec.ml @@ -195,9 +195,13 @@ module G = struct List.iter (fun p -> sdf (margin (subpos box p) 6) (getp1 mor p)) all_p1; disp_l 2 box (reduct mor) - let display_game (s, mor, q) (pn1, pn2) = + let gbox () = let cx, cy = center() in let box = cx - 200, cy - 200, cx + 200, cy + 200 in + box + + let display_game (s, mor, q) (pn1, pn2) = + let box = gbox () in disp_r (disp_r (disp_l 1)) box mor; begin match q, s with | Some p, TurnOf player -> @@ -207,6 +211,18 @@ module G = struct | _ -> () end + let in_box (x1, y1, x2, y2) (x, y) = + (x >= x1 && x <= x2 && y >= y1 && y <= y2) + + let gui_act_at g xy = + let box = gbox () in + try + let pg = List.find (fun p -> in_box (subpos box p) xy) all_p1 in + let sbox = subpos box pg in + let pp = List.find (fun p -> in_box (subpos sbox p) xy) all_p1 in + encode (pg, pp) + with Not_found -> "" + end |