Skip to content

Instantly share code, notes, and snippets.

@becker1701
Created December 27, 2015 00:21
Show Gist options
  • Save becker1701/e3db10f8de9c02af19c5 to your computer and use it in GitHub Desktop.
Save becker1701/e3db10f8de9c02af19c5 to your computer and use it in GitHub Desktop.
module Hands
# Actions is mixed into Hand class
# @cards is a Hand instance variable that is an array of Card objects
module Actions
def hit(stock)
def double(stock)
def split(player, stock)
end
module Compare
def player_wins(other)
def player_ties(other)
def player_looses(other)
def result_multiplier(other)
end
module Calculate
def value(dealer: false, game_over: false)
def adjust_aces(value)
end
class Hand
include Hands::Actions
include Hands::Compare
include Hands::Calculate
# ...
end
end
# Hands::Hand.new for a new hand object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment