let id_to_array rule_num =
if (rule_num < 0 || rule_num > 63) then failwith "rrpcs_2d requires a rule number between 0 and 63 (inclusive).";
let eb = Femtolib.Pervasives.extract_bit rule_num in
let x = eb 0 in
let result = Array.make 32 x in
let set transition_result = List.iter (fun i -> result.(i) <- transition_result) in
set (not x) [31];
let x = eb 1 in set x [2;4;8;16]; set (not x) [3;5;9;17];
let x = eb 2 in set x [10;24;20;6]; set (not x) [11;25;21;7];
let x = eb 3 in set x [18;12]; set (not x) [19;13];
let x = eb 4 in set x [14;26;28;22]; set (not x) [15;27;29;23];
let x = eb 5 in set x [30]; set (not x) [31];
result