(* Sym├ętrie verticale d'un quad-tree *)

type quad = White | Black | Node of quad * quad * quad * quad

let node = function
  | White, White, White, White -> White
  | Black, Black, Black, Black -> Black
  | q1, q2, q3, q4 -> Node (q1, q2, q3, q4)

let rec mirror = function
  | White | Black as q -> q
  | Node (q1, q2, q3, q4) -> node (mirror q2, mirror q1, mirror q4, mirror q3)

This document was generated using caml2html