let transition_rule nb_states threshold neighbours configuration cell =
let state = configuration.(cell) in
let successor = (succ state) mod nb_states in
let counter = ref 0 in
let n = neighbours.(cell) in
for i=0 to pred (Array.length n) do
if configuration.(n.(i)) = successor then incr counter
done;
if !counter >= threshold then successor else state