# Let's make draw poker with ruby ~ Preparation ~

## Trigger

When I saw this, I thought it was a good challenge, so I made a comment. Do I have the technical ability to give advice? Isn't it still the side to receive advice?

How do you design and implement it when you think about it? While reorganizing I decided to make it because I was staring at myself

I use ruby for work, but when I first joined the company, what was ruby? Because it was a level that I only knew about the name I hope I can look back on that as well.

## First, organize the rules of poker

Reference: https://playingcards.jp/game_rules/drawpoker_rules.html

### Card used

--Are there 1 ~ 13 + jokers for all suits? --This time I will go without joker ――Maybe I will add it?

### player

--`2..7` people

### rule

1. Distribute 5 cards from the deck to each player --Each player does not show 5 cards around
2. Each player can exchange as many cards as he / she wants only once.
3. Show each player's hand, and the victory or defeat is decided according to the combination (role) of the hand ――Originally, there is a bet here, and it will be a game to get this ――This time, I will not bet for the time being

### Role

――It will be a strong role in order from the top below --Royal Straight Flush --Align 10, J, Q, K, A with the same mark --Straight flush ――With the same mark, 5 numbers are consecutive --Four Card --There are 4 cards with the same number

• Full house ――You can make one pair of three cards --Flash --There are 5 cards with the same mark
• straight --Five numbers are consecutive regardless of the mark -(10-J-Q-K-A is straight, but Q-K-A-2-3 is not straight -That is, K and A are continuous, but those containing K-A-2 are not straight) --Three cards --There are 3 cards with the same number --Two pairs --There are two sets of cards with the same number --One pair --There is only one set of cards with the same number ――If two players make the same role, the stronger card that makes up the role wins. --The strong ranking of cards is A, K, Q, J, 10 ~ 2. ――The strong ranking of the suit is Spade Heart Diamond Clover ――If the cards that make up the role are the same, the stronger the card that is not used in the role wins.

### Question

――Will you reveal the discarded card? --It seems that it will not be released ――What is the comparison between full houses? --In the case of full houses, the rank of a set of 3 cards ――How do you compare straights? --Compare with the strongest card --Straight tricks -> Note: Only Ace can be used as the top or bottom rank card. The strongest straight is A-K-Q-J-T (Ace High) and the weakest straight is 5-4-3-2-A (Five High).

reference

• https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q11159415671
• https://www.pokerstars.com/ja/poker/games/rules/hand-rankings/?no_redirect=1

## Determining the implementation range this time

――Since there are no bets, it is not a continuous game, but one game. --Since it is troublesome to create screens etc. and the purpose is to design and implement ruby classes, it will be executed on the console. ――If you don't make all players exchange, it will be difficult to play with the first 5 cards, so all players will be controlled by the performer (meaning of the game w).

## Determining the mounting environment

--Use ruby 2.6.5 --Use test-unit ――I usually use only rspec at work, so I'll try to touch it.

## Arrangement of characters

I don't know how to express it properly, but I will try to divide it into things and things that are not things (= concept).

--Card

• player

### concept

--Deck --All cards --Hand --Each player's hand (5 cards) dealt from the deck --Role --Combination in your hand --Has the following --Type of role --Strength in the role

## Source

https://github.com/rytkmt/ruby_poker

I'm going to make it from now on, so I just made it empty. from here. I'm looking forward to it.