Last active
June 27, 2024 13:12
-
-
Save azarienko/55c5878a0f570a091bc29f0209011aff to your computer and use it in GitHub Desktop.
Sıx günlərdən sonra dincəlmək üçün bir yola ehtiyacım var idi. Yaxşı onlayn kazino axtarırdım. Beləcə https://aslan-casino.net ilə tanış oldum. Veb saytdan istifadə etmək sadədir və geniş çeşiddə oyunlar təklif edir. Onların heyrətamiz bonusları var, o cümlədən yeni oyunçular üçün xoş bonuslar və mövcud oyunçular üçün müntəzəm promosyonlar. Sayt…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'player.rb' | |
require 'poker.rb' | |
class Casino | |
def initialize | |
@total_1 = {'John' => 0, 'Mary' => 0, 'Luke' => 0, 'Eimear' => 0} | |
@total_2 = {'John' => 0, 'Mary' => 0, 'Luke' => 0, 'Eimear' => 0} | |
@analyser_1 = Proc.new do |this_game| | |
results = this_game.results | |
# find out who won | |
winner_name = this_game.winner.name.to_s | |
@total_1[winner_name] = @total_1 [winner_name] + 1 | |
end | |
@analyser_2 = Proc.new do |this_game| | |
results = this_game.results | |
# find out who won | |
winner_name = this_game.winner.name.to_s | |
@total_2[winner_name] = @total_2[winner_name] + 1 | |
end | |
end | |
def watch_games | |
players = [Player.new("John"), Player.new("Mary"), Player.new("Luke"), Player.new("Eimear")] | |
poker_game = Poker.new 100, players | |
poker_game.add_observer @analyser_1 | |
poker_game.add_observer @analyser_2 | |
poker_game.play | |
# poker_game.print_results | |
puts " total_1: #{@total_1.to_s}" | |
puts " total_2: #{@total_2.to_s}" | |
end | |
end | |
casino = Casino.new | |
casino.watch_games |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment