let transition_rule rule_num =
let tr = Eca.transition_rule rule_num in
let config = [|false; false; false|] in
let neighbours = [|[||];[|0;2|]|] in
let table = Array.init 64 (fun i ->
let eb = extract_bit i in
let state_a =
config.(0) <- eb 5;
config.(1) <- eb 3;
config.(2) <- eb 1;
tr neighbours config 1 in
let state_b =
config.(0) <- eb 4;
config.(1) <- eb 2;
config.(2) <- eb 0;
tr neighbours config 1 in
(int_of_bool state_a) lsl 1 + int_of_bool state_b) in
fun neighbours configuration cell ->
let n = neighbours.(cell) in
assert (Array.length n = 2);
let g = configuration.(n.(0)) in
let m = configuration.(cell) in
let d = configuration.(n.(1)) in
let index = g lsl 4 + m lsl 2 + d in
table.(index)