Un bon schéma vaut mieux qu'un long discours.


Un bon code vaut mieux qu'un long discours. Le numérotage des quadrants ne facilite pas les rotations, mais bon.
let rec inverse a = match a with | Feuille Blanc -> Feuille Noir | Feuille Noir -> Feuille Blanc | Noeud (c1,c2,c3,c4) -> Noeud (inverse c1, inverse c2, inverse c3, inverse c4) ;; (* 3 -> 4 -> 2 -> 1 *) let rec rotate a = match a with | Feuille _ -> a | Noeud (c1,c2,c3,c4) -> Noeud (rotate c2,rotate c4, rotate c1, rotate c3) ;; (* 1 -> 2 -> 4 -> 3 *) let rec antirotate a = match a with | Feuille _ -> a | Noeud (c1,c2,c3,c4) -> Noeud (antirotate c3,antirotate c1, antirotate c4, antirotate c2) ;;