-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.rb
75 lines (62 loc) · 1.18 KB
/
interface.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
class Interface
attr_reader :choice
def victory_report
puts 'You win'
end
def defeat_report
puts 'You lose'
end
def draw_report
puts 'Draw'
end
def insufficient
puts 'Insufficient funds'
end
def wrong_try_again
puts 'Choice is wrong. Try again'
end
def dealer_points_message(player)
puts "Dealer points: #{player.hand.sum}"
end
def user_points_message(player)
puts "Your points: #{player.hand.sum}"
end
def message_to_continue
puts 'Do you want to continue? y/n'
@choice = gets.chomp
end
def selection_error
puts 'Choose from the offered options'
end
def unknown_dealer_cards
puts %(
Dealer cards:
1.**
2.**
)
end
def user_chioce
puts %(
1. Skip
2. Take card
3. Open cards
)
@choice = gets.chomp
end
def enter_name
puts 'Enter name: '
@name = gets.chomp
end
def dealer_cards_message(dealer)
puts 'Dealer cards:'
dealer.hand.cards.each do |card|
puts "#{card.face}#{card.suit}"
end
end
def user_cards_message(user)
puts 'Your cards:'
user.hand.cards.each do |card|
puts "#{card.face}#{card.suit}"
end
end
end