Skip to content

Instantly share code, notes, and snippets.

View scyclow's full-sized avatar
💭
$$$

Steve Pikelny scyclow

💭
$$$
View GitHub Profile
def test(x)
print x
end
def generate_players(number_players, chips):
#creates dictionary of players, starting with the dealer (the 0th player).
#0th item in list is the value of the hand,
#1st is the actual 1st and 2nd cards held
#2nd is number of high aces
#3rd is the number of chips left
players = [[0, [None,None], 0, 999999999999]]
i = 1
while i<= number_players:
# player number: value, cards in hand, number of high aces, chips
class Player
@@num_players = 0
def initialize(chips)
@value = 0 #numeric value of current hand
@cards = [nil,nil] #space for first two cards
@high_aces = 0
@chips = chips
@@num_players += 1
end
#here we would define player-specific methods
class Player
attr_accessor @@num_players
@@num_players = 0
def initialize(chips)
@value = 0 #numeric value of current hand
@cards = [nil,nil] #space for first two cards
@high_aces = 0
@chips = chips
@@num_players += 1
class Player
attr_accessor @@num_players
@@num_players = 0
def initialize(chips)
@value = 0 #numeric value of current hand
@cards = [] #space for first two cards
@high_aces = 0
@chips = chips
@@num_players += 1
class Player
attr_accessor :value, :cards, :chips
@@num_players = 0
def initialize(chips)
@value = 0 #numeric value of current hand
@cards = [] #space for first two cards
@high_aces = 0
@chips = chips
@@num_players += 1
class Parent
def initialize
@type = "parent"
puts "Initializing #{type}"
end
def parent_method1
puts "this is a parent method"
end
class Parent
def initialize
@type = "parent"
puts "Initializing #{type}"
end
def parent_method1
puts "this is a parent method"
end
class Parent
def initialize
@type = "parent"
puts "Initializing #{type}"
end
def parent_method1
puts "this is a parent method"
end
class Parent
def initialize
@type = "parent"
puts "Initializing parent. What're you gonna do about it?"
end
end
Parent.new
#=> Initializing parent. What're you gonna do about it?