Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. puts 'Hlello world'
  2. ends = 0
  3. year = 1
  4. human = 0
  5. human2 = 0
  6. human3 = 0
  7. humanNumberInt = 0
  8. humanDeadInt = 0
  9. family = Hash.new #1:father, 2:mother, 3:son, 4:daughter, 5:brother, 6:sister, 7:uncle, 8:aunt, 9:cousin, 10:grandfather, 11:grandmother, 12:grandson, 13:granddaughter
  10. personCreated = []
  11. humanNumber = []
  12. isMarried = []
  13. marriedTo = []
  14. childrenBorn = []
  15. alive = []
  16. gender = []
  17. age = []
  18. str = []
  19. agi = []
  20. int = []
  21. wis = []
  22. lastName = []
  23. firstName = []
  24. firstNameOptionsMale = ["Bob", "Carl", "Frank", "Joe", "John", "Mike", "Hank", "Louis", "Tim", "Kevin", "Dende", "Andrew", "Dan", "Evan", "Zach", "Steve", "Thomas", "Satan", "Nick", "Jesus"]
  25. firstNameOptionsFemale = ["Abby", "Claudia", "Bianca", "Gabrielle", "Elissa", "Erin", "Katherine", "Mabel", "Ona", "Rachelle", "Cindi", "Terresa"]
  26. lastNameOptions = ["Helix", "Obama", "Smith", "Brown", "Johnson", "Lee", "Wilson", "Martin", "Patel", "Taylor", "Wong", "Campbell", "Williams", "Thompson", "Jones", "Miller", "Davis", "Jackson", "White", "Lopez", "Harris", "Clark", "Allen", "Wright", "Baker", "Hill", "Parker"]
  27. while human < 10 do
  28. gender[human]=rand(2)+1
  29. if gender[human] ==1
  30. firstName[human]=firstNameOptionsMale[rand(firstNameOptionsMale.length)]
  31. elsif gender[human] ==2
  32. firstName[human]=firstNameOptionsFemale[rand(firstNameOptionsFemale.length)]
  33. end
  34. alive[human]=1
  35. childrenBorn[human]=1
  36. isMarried[human]=0
  37. marriedTo[human]=-1
  38. age[human]=rand(15)+17
  39. personCreated[human]=1
  40. lastName[human]=lastNameOptions[rand(lastNameOptions.length)]
  41. humanNumber[human]=humanNumberInt
  42. humanNumberInt+=1
  43. puts "#{firstName[human] + " " + lastName[human]}"
  44. puts "gender #{gender[human]}"
  45. puts "alive #{alive[human]}"
  46. puts "isMarried #{isMarried[human]}"
  47. puts "age #{age[human]}"
  48. puts "humanNumber #{humanNumber[human]}"
  49. human+=1
  50. puts " "
  51.  
  52. end
  53. human=0
  54. while ends < 400 do
  55. puts "------------------------------\nACCOUNCEMENTS YEAR #{year}\n------------------------------"
  56. while human<humanNumberInt do
  57. if alive[human]==1
  58. age[human]+=1
  59. #puts age[human]
  60. end
  61. human+=1
  62. end
  63. human=0
  64. while human<humanNumberInt do
  65. if (alive[human]==1 && rand(10000)+1<=(3^(age[human])))
  66. alive[human]=0
  67. puts "#{firstName[human]} #{lastName[human]} has died"
  68. humanDeadInt+=1
  69. end
  70. human+=1
  71. end
  72. human=0
  73. while human2<humanNumberInt do
  74. while human<humanNumberInt do
  75. if (gender[human] != gender[human2] && isMarried[human] ==0 && isMarried[human2] ==0 && personCreated[human] == 1 && personCreated[human2] == 1 && age[human] >=18 && age[human2]>=18 && alive[human]==1 && alive[human2]==1)
  76. #puts human
  77. #puts human2
  78. marriedTo[human]=humanNumber[human2]
  79. marriedTo[human2]=humanNumber[human]
  80. isMarried[human]=1
  81. isMarried[human2]=1
  82. #puts firstName[human] + " " + lastName[human] + " and " + firstName[marriedTo[human]] + " " + lastName[marriedTo[human]] + " are now married"
  83. if (gender[human] == 2)
  84. # puts firstName[human] + " " + lastName[human] + " is now named " + firstName[human] + " " + lastName[marriedTo[human]]
  85. lastName[human]=lastName[marriedTo[human]]
  86. else
  87. # puts firstName[marriedTo[human]] + " " + lastName[marriedTo[human]] + " is now named " + firstName[marriedTo[human]] + " " + lastName[human]
  88. lastName[marriedTo[human]]=lastName[human]
  89. end
  90. end
  91. human+=1
  92. end
  93. human2+=1
  94. human=0
  95. end
  96. human=0
  97. human2=0
  98. while human<humanNumberInt do
  99. if (isMarried[human] == 1 && marriedTo[human] != -1 && gender[human] == 2 && personCreated[human] ==1 && alive[human] ==1 && alive[marriedTo[human]]==1 && age[human]<64 && age[marriedTo[human]]<64)
  100. if (rand(childrenBorn[human]*8)+1==(1))
  101. human2=humanNumberInt
  102. gender[human2]=rand(2)+1
  103. if gender[human2] ==1 #boy born
  104. firstName[human2]=firstNameOptionsMale[rand(firstNameOptionsMale.length)]
  105. family[[human,human2]]=3 #mother:son
  106. family[[human,human2]]=3
  107. family[[human,human2]]=3
  108. else gender[human2] ==2 #girl born
  109. firstName[human2]=firstNameOptionsFemale[rand(firstNameOptionsFemale.length)]
  110. family[[human,human2]]=4 #mother:daughter
  111. end
  112. family[[human2,human]]=2 #child:mother
  113. family[[human2,marriedTo[human]]]=1 #child:father
  114. lastName[human2]=lastName[human]
  115. childrenBorn[human2]=1
  116. alive[human2]=1
  117. isMarried[human2]=0
  118. marriedTo[human2]=-1
  119. age[human2]=0
  120. personCreated[human2]=1
  121. humanNumber[human2]=humanNumberInt
  122. humanNumberInt+=1
  123. #puts firstName[human] + " " + lastName[human] + " has given birth to " + firstName[human2] + " " + lastName[human2]
  124. end
  125. end
  126. human+=1
  127. end
  128. human=0
  129. human2=0
  130. year+=1
  131. ends+=1
  132. end
  133. puts "total: #{humanNumberInt}"
  134. puts "alive: #{humanNumberInt-humanDeadInt}"
  135. puts "dead: #{humanDeadInt}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement