Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Author:Zachary Williams
- #Date: 10-1-12 19:57
- #Chain of Command ROTC study guide
- #titles array
- t=["The President of the United States","Vice President of the United States","Secretary of State","Secretary of Defense",
- "Secretary of the Navy","Chairman, Joint Chiefs of Staff","Chief of Naval Operations","Commandant of the Marine Corps",
- "Master Chief Petty Officer of the Navy","Sergeant Major of the Marine Corps","Commander of Naval Education and Training Command",
- "Commander of Naval Service Training Command","NJROTC Area 12 Commander","Senior Naval Science Instructor","Naval Science Instructor"]
- #names array
- n=["The Honorable Barack Obama","The Honorable Joseph Biden","The Honorable Hillary Clinton","The Honorable Leon Panetta",
- "The Honorable Ray Mabus","General Martin Dempsey","Admiral Jonathan Greenert","General James Amos",
- "Master Chief Petty Officer Michael Stevens","Sergeant Major Michael Barrett","Rear Admiral Donald Quin","Rear Admiral David Steindl",
- "Commander Rusty Hibbard","Captain William Wilkerson","First Sergeant Lorenzo Cox"]
- #used array
- u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
- #score, set to 0 at beginning of each play through
- score=0
- def PickPerson
- getPerson=rand(15)
- CheckUsed(getPerson)
- end
- def CheckUsed(num)
- picks=0
- if num == 0
- picks=0
- Quiz(num)
- else
- PickPerson
- picks=picks+1
- if picks >= 15
- puts "You have answered all the questions!"
- FinalScore(score)
- end
- end
- end
- def Quiz(num)
- puts "Who is your " + t[num] + "?"
- print "Answer: "
- while tries <= 3
- answer=gets.chomp
- if answer == n[num]
- puts "Correct! +10 pts"
- QuizScore
- elsif answer == "exit"
- break
- else
- tries=tries+1
- end
- end
- end
- def QuizScore
- score=score+1
- PickPerson
- end
- def FinalScore(s)
- finalScore=s*10
- print "Your final score is "
- return finalScore
- end
- PickPerson()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement