Guest User

Untitled

a guest
Jul 30th, 2014
609
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Fill in the defect rates and decay factor however.
  2. # Decay factor is 1-f: if 10% fewer people defect in generation n+1 than generation n, set defector_decay_factor to 0.9.
  3. # Pulled the stats here from http://www.patheos.com/blogs/lovejoyfeminism/2012/01/quiverfull-outbreeding-the-world.html
  4. # Quiverfulls currently have a high defect rate, and Amish currently have a low defect rate...
  5. # ...so change the strings in the puts commands as necessary.
  6. # Could be modified to have specific decay factors for each defect rate, but I didn't do that.
  7. atheists = 90000000
  8. atheist_birth_rate = 2.0
  9. christians = 8000000
  10. christian_birth_rate = 4.0
  11. quiverfulls = 2000000
  12. quiverfull_birth_rate = 8.0
  13. a_c_defect_rate = 0.0
  14. a_q_defect_rate = 0.0
  15. c_a_defect_rate = 0.0
  16. c_q_defect_rate = 0.0
  17. q_a_defect_rate = 0.0
  18. q_c_defect_rate = 0.0
  19. generations = 3
  20. defector_decay_factor = 1.0
  21.  
  22. def percent(n, total)
  23. return ((n.to_f / total) * 100).round
  24. end
  25.  
  26. def round(n)
  27. return (n / 1000000).round.to_s + " million"
  28. end
  29.  
  30. total = atheists + christians + quiverfulls
  31.  
  32. (generations+1).times do |i|
  33. puts "Generation #{i}"
  34. puts "Atheists: #{percent(atheists, total)}%, #{round(atheists)}, decay rates = #{a_c_defect_rate.round(2)}, #{a_q_defect_rate.round(2)}"
  35. puts "Christians: #{percent(christians, total)}%, #{round(christians)}, decay rates = #{c_a_defect_rate.round(2)}, #{c_q_defect_rate.round(2)}"
  36. puts "Quiverfulls: #{percent(quiverfulls, total)}%, #{round(quiverfulls)}, decay rates = #{q_a_defect_rate.round(2)}, #{q_c_defect_rate.round(2)}"
  37. puts ''
  38.  
  39. atheists = (atheists / 2) * atheist_birth_rate
  40. christians = (christians / 2) * christian_birth_rate
  41. quiverfulls = (quiverfulls / 2) * quiverfull_birth_rate
  42. total = atheists + christians + quiverfulls
  43.  
  44. a_c_defectors = atheists * a_c_defect_rate
  45. a_q_defectors = atheists * a_q_defect_rate
  46. c_a_defectors = christians * c_a_defect_rate
  47. c_q_defectors = christians * c_q_defect_rate
  48. q_a_defectors = quiverfulls * q_a_defect_rate
  49. q_c_defectors = quiverfulls * q_c_defect_rate
  50.  
  51. atheists -= a_c_defectors
  52. christians += a_c_defectors
  53. atheists -= a_q_defectors
  54. quiverfulls += a_q_defectors
  55.  
  56. christians -= c_a_defectors
  57. atheists += c_a_defectors
  58. christians -= c_q_defectors
  59. quiverfulls += c_q_defectors
  60.  
  61. quiverfulls -= q_a_defectors
  62. atheists += q_a_defectors
  63. quiverfulls -= q_c_defectors
  64. christians += q_c_defectors
  65.  
  66. a_c_defect_rate = a_c_defect_rate * defector_decay_factor
  67. a_q_defect_rate = a_q_defect_rate * defector_decay_factor
  68. c_a_defect_rate = c_a_defect_rate * defector_decay_factor
  69. c_c_defect_rate = c_q_defect_rate * defector_decay_factor
  70. q_a_defect_rate = q_a_defect_rate * defector_decay_factor
  71. q_c_defect_rate = q_c_defect_rate * defector_decay_factor
  72. end
RAW Paste Data