-
Notifications
You must be signed in to change notification settings - Fork 0
/
turn.rb
37 lines (29 loc) · 876 Bytes
/
turn.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require './question'
require './player'
class Turn
attr_accessor :question, :player
def initialize(player)
@question = Question.new
@player = player
end
def current_turn
puts "-----------NEW TURN-----------"
print "#{self.question.decide_question[0]}"
puts ""
print "#{self.player.name}: "
player_answer = gets.chomp
if player_answer == self.question.decide_question[1].to_s
@ans = true
puts "#{self.player.name}'s answer was....#{@ans}!"
else
@ans = false
self.player.wrong
puts "#{self.player.name}'s answer was....#{@ans}!"
if (self.player.life == 1)
puts "#{self.player.name} now has only #{self.player.life} life left!"
else
puts "#{self.player.name} now has #{self.player.life} lives left."
end
end
end
end