Added rules for Water

This commit is contained in:
Jarrod Doyle 2024-01-31 16:05:28 +00:00
parent 6c423f69c2
commit 45bf018375
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 64 additions and 2 deletions

View File

@ -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();