-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rb
46 lines (41 loc) · 962 Bytes
/
main.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
require_relative 'lib/deck'
require_relative 'lib/game'
require_relative 'lib/console'
require_relative 'lib/player'
require_relative 'lib/dealer'
puts 'Добро пожаловать в игру BlackJack'
choice = nil
game = Game.new
player = Player.new('Alexey', game)
dealer = Dealer.new('Дилер', game)
until choice == 'q'
Console.menu(player, dealer)
choice = STDIN.gets.chomp
if game.status
case choice
when 'h'
player.hit
when 's'
dealer.hit
game.status = false
when 'q'
puts 'bye!'
exit
else
puts 'Такой команды нет'
end
else
case choice.downcase
when 'r'
game = Game.new
player = Player.new('Alexey', game)
dealer = Dealer.new('Дилер', game)
game.status = true
when 'q'
puts 'bye!'
exit
else
puts 'Такой команды нет'
end
end
end