Implementing poker little by little in Ruby Part 1

I want to implement poker in Ruby

As I learned about Ruby little by little, I started thinking that I wanted to create a program that would work. Anyway, I will write with an emphasis on moving. Something strange or should I usually do this? Please comment if you have any advice.

Completed form

Draw poker When several players sit at the table, the dealer deals five cards, makes one card change, and competes for the victory or defeat of the role.

Part 1 goal

The dealer comes in, deals the cards, and the player gets five cards.

Preparation

There are a total of 52 playing cards, 4 types of suits and 13 cards, and JOKER cannot be inserted. Save each card in an associative array {suit: ❤︎, num: 4}.

flow

Game Start Part 1~ The dealer shuffles and prepares the deck. The dealer hands the deck the top five cards to the player. The player receives a card from the dealer. Part 1~ Game over

Try to extract the class

Dealers, decks (cards of playing cards), players

Write down the behavior of the class

Dealer prepares deck Dealer.initialize (Deck.new) Dealer shuffles the deck Dealer.shuffle Dealer gives the card to the player Dealer.deal (Player, number of sheets) Player saves the cards received in his hand Player.initialize (hands) Display the player's hand on the screen Player.show

Part 1 code

https://github.com/paraizo2424/poker_game/commit/850e102e661605787db6a853447c342e693807d4

next time

Part 2

Recommended Posts

Implementing poker little by little in Ruby Part 2
Implementing poker little by little in Ruby Part 1
Implementing poker little by little in Ruby Part 4
Implementing poker little by little in Ruby Part 3
Class in Ruby
Heavy in Ruby! ??
Write a test by implementing the story of Mr. Nabeats in the world with ruby
About eval in Ruby
Output triangle in Ruby
Variable type in ruby
Fast popcount in Ruby