Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KeepRubyWeird 2015: Prepare yourself against Zo...

KeepRubyWeird 2015: Prepare yourself against Zombie epidemic

Christophe Philemotte

October 26, 2015
Tweet

More Decks by Christophe Philemotte

Other Decks in Programming

Transcript

  1. stm = StateTransitionMachine.new # create states: # - susceptible #

    - infected # - zombie # - dead # create transitions # set default initial state
  2. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  3. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  4. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  5. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  6. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  7. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  8. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  9. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end
  10. steps = 100 agents = create_the_agents steps.times do agents.each do

    |agent| agent.act; agent.age end agents.each { |agent| agent.commit } remove_the_deads(agents) end