kgautreaux/blog

An ocean of noise

Modeling dog brains in Ruby

Shaleah and I were talking about how our dogs think and so I threw together a few programs to illustrate their (ahem) thought process. [sourcecode language='ruby'] def at_the_park @doggies = ["Lucy", "Thena"] if location != park @doggies.get_in_car elsif location == park @doggies.continue_running_around_and_rolling_in_dead_things else tail.wag end end [/sourcecode]

Thena finally figured out that getting in the car when it's in the garage takes you to the park, but getting in the car at the park takes you away from the park.

[sourcecode language='ruby'] def head_scratching lucy = Dog.new(:intelligence => false) if head_scratched == true tongue.lick_scratcher elsif head_scratched == false lucy.stick_head_in_potential_scratchers_crotch_until_they_give_in else look_on_face = dumb end end [/sourcecode]

I think this one is pretty self explanatory.