diff --git a/src/falling_sand/rules.rs b/src/falling_sand/rules.rs index d7febc6..1c61742 100644 --- a/src/falling_sand/rules.rs +++ b/src/falling_sand/rules.rs @@ -40,10 +40,16 @@ pub struct FallingSandRules { impl Default for FallingSandRules { fn default() -> Self { - // Pre-computed air-sand rules + // Pre-computed rules + // I should really start building a tool for this instead of manually calculating it huh let rule_config = RuleConfig { - element_groups: vec![vec![Element::Air], vec![Element::Sand]], + element_groups: vec![ + vec![Element::Air], + vec![Element::Sand], + vec![Element::Water], + ], rules: vec![ + // Air/Sand ([0, 1, 0, 0], [0, 0, 0, 1]), ([0, 1, 0, 1], [0, 0, 1, 1]), ([0, 1, 1, 0], [0, 0, 1, 1]), @@ -53,6 +59,62 @@ impl Default for FallingSandRules { ([1, 1, 0, 0], [0, 0, 1, 1]), ([1, 1, 0, 1], [0, 1, 1, 1]), ([1, 1, 1, 0], [1, 0, 1, 1]), + // Air/Water + ([0, 2, 0, 0], [0, 0, 0, 2]), + ([0, 2, 0, 2], [0, 0, 2, 2]), + ([0, 2, 2, 0], [0, 0, 2, 2]), + ([2, 0, 0, 0], [0, 0, 2, 0]), + ([2, 0, 0, 2], [0, 0, 2, 2]), + ([2, 0, 2, 0], [0, 0, 2, 2]), + ([2, 2, 0, 0], [0, 0, 2, 2]), + ([2, 2, 0, 2], [0, 2, 2, 2]), + ([2, 2, 2, 0], [2, 0, 2, 2]), + ([0, 2, 2, 2], [2, 0, 2, 2]), + ([2, 0, 2, 2], [0, 2, 2, 2]), + // Air/Sand/Water + ([0, 1, 0, 2], [0, 0, 2, 1]), + ([0, 1, 1, 2], [0, 2, 1, 1]), + ([0, 1, 2, 0], [0, 0, 2, 1]), + ([0, 1, 2, 1], [2, 0, 1, 1]), + ([0, 1, 2, 2], [0, 2, 2, 1]), + ([0, 2, 0, 1], [0, 0, 2, 1]), + ([0, 2, 1, 0], [0, 0, 1, 2]), + ([0, 2, 1, 1], [2, 0, 1, 1]), + ([0, 2, 1, 2], [2, 0, 1, 2]), + ([0, 2, 2, 1], [2, 0, 2, 1]), + ([1, 0, 0, 2], [0, 0, 1, 2]), + ([1, 0, 1, 2], [0, 2, 1, 1]), + ([1, 0, 2, 0], [0, 0, 1, 2]), + ([1, 0, 2, 1], [2, 0, 1, 1]), + ([1, 0, 2, 2], [2, 0, 1, 2]), + ([1, 1, 0, 2], [0, 2, 1, 1]), + ([1, 1, 1, 2], [1, 2, 1, 1]), + ([1, 1, 2, 0], [2, 0, 1, 1]), + ([1, 1, 2, 1], [2, 1, 1, 1]), + ([1, 1, 2, 2], [2, 2, 1, 1]), + ([1, 2, 0, 0], [0, 0, 1, 2]), + ([1, 2, 0, 1], [0, 2, 1, 1]), + ([1, 2, 0, 2], [0, 2, 1, 2]), + ([1, 2, 1, 0], [0, 2, 1, 1]), + ([1, 2, 1, 2], [2, 2, 1, 1]), + ([1, 2, 2, 0], [0, 2, 1, 2]), + ([1, 2, 2, 1], [2, 2, 1, 1]), + ([1, 2, 2, 2], [2, 2, 1, 2]), + ([2, 0, 0, 1], [0, 0, 2, 1]), + ([2, 0, 1, 0], [0, 0, 1, 2]), + ([2, 0, 1, 1], [0, 2, 1, 1]), + ([2, 0, 1, 2], [0, 2, 1, 2]), + ([2, 0, 2, 1], [0, 2, 2, 1]), + ([2, 1, 0, 0], [0, 0, 2, 1]), + ([2, 1, 0, 1], [2, 0, 1, 1]), + ([2, 1, 0, 2], [2, 0, 2, 1]), + ([2, 1, 1, 0], [2, 0, 1, 1]), + ([2, 1, 1, 2], [2, 2, 1, 1]), + ([2, 1, 2, 0], [2, 0, 2, 1]), + ([2, 1, 2, 1], [2, 2, 1, 1]), + ([2, 1, 2, 2], [2, 2, 2, 1]), + ([2, 2, 0, 1], [0, 2, 2, 1]), + ([2, 2, 1, 0], [2, 0, 1, 2]), ], }; let rules = rule_config.compile();