Blackjack Ruby console game
After completing this assignment, you should…
- Use control-flow (having the computer make decisions)
- Create a user interface
- Use data-flow (your deck is a unique set of resources)
After completing this assignment, you be able to effectively use
- Classes
- Arrays
- Console / Terminal
#... snip
suits = [:hearts, :diamonds, :spades, :clubs]
suits.each do |suit|
(2..10).each do |value|
@cards << Card.new(suit, value)
end
@cards << Card.new(suit, "J")
@cards << Card.new(suit, "Q")
@cards << Card.new(suit, "K")
@cards << Card.new(suit, "A")
end
- A repo containing at least:
blackjack.rb
: your game classcard.rb
: your Card classdeck.rb
: your Deck class
To submit your assignment:
- Create a gist, with 1 file per class
- Submit a link to it to this gist as a GitHub Issue here
- You should create classes for your data, and use methods instead of having one big loop
- don't consider Aces as possible 1's ... they are always 11s
- This is a 2 hand game (dealer and player)
- no splitting or funny business
- 1 deck in the game
- 52 card deck
- NO WILDS
- New deck every game
- deck must be shuffled every game
- no betting at all
- must have suits (ace of diamonds)
- Dealer hits if less than 16, otherwise dealer stays
- You enter what you play
- No if you get 5 cards you win funnybusiness
- get as close to 21 without going over
- Must beat the dealer
- you can see 1 of dealers cards, while you are playing
- If you get blackjack, you win automagically