(* Rotation d'un quad-tree de 90 degrés dans le sens direct *)

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 rotate = function
  | White | Black as q ->
      q
  | Node (q1, q2, q3, q4) ->
      node (rotate q2, rotate q4, rotate q1, rotate q3)

This document was generated using caml2html