当前位置:网站首页>[golang from introduction to practice] poker licensing game
[golang from introduction to practice] poker licensing game
2022-07-25 04:17:00 【A programmer who can vibrate knives】
Poker licensing game
Function is introduced
Poker licensing is achieved
Effect display

Programming ideas
1、 List all colors and card sizes , Cross multiply =52 card ;52 + Big 、 Xiao Wang = 54 card
2、 Deal cards to everyone one by one , until 17 Zhang . Choose randomly from the total cards each time 1 Zhang , Send it to the player and delete it from the total card
3、 Three people each 17 After Zhang Fa , from 3 Choose one person at random as the landlord , And finally 3 Give him a card
Source code
package main
import (
"fmt"
"math/rand"
"time"
)
var color = []string{
"", "", "", ""}
var size = []string{
"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"}
var total []string
var fapai = [][]string{
{
}, {
}, {
}}
func main() {
// Generate 54 card
for _, v := range color {
for _, v2 := range size {
total = append(total, v+v2)
}
}
total = append(total, " King ")
total = append(total, " Xiao Wang ")
for index, _ := range fapai {
for i := 0; i < 17; i++ {
rand.Seed(time.Now().Unix())
intt := rand.Intn(len(total))
fapai[index] = append(fapai[index], total[intt])
total = append(total[:intt], total[intt+1:]...)
}
}
boss := rand.Intn(2)
fapai[boss] = append(fapai[boss], total...)
for k, v := range fapai {
fmt.Println(" The player ", k, " card :", v, " length ", len(v))
}
}
边栏推荐
- [matlab] solve the mex error there was a problem creating the mex file for real time execution, please ensure y
- Deep learning Titanic (beginner) kaggle Liu er's homework Lesson 8
- Implementing DDD based on ABP -- domain logic and application logic
- 基于ABP实现DDD--领域逻辑和应用逻辑
- Interview question 08.07. Permutation and combination of non repeated strings DFS method
- 弹性布局(display:flex下 align-content、justify-content、align-items三个属性的作用和效果
- Which securities company is better to open an account? Is it safe to open an account on your mobile phone
- Huawei cloud from entry to actual combat | cloud rapid site establishment service and enterprise host security service
- Application of AI in testing
- Divide candy Huawei od JS
猜你喜欢

MySQL eight shares
![Function and technical principle of data desensitization [detailed explanation]](/img/bb/5890d8fd140982ea7b994942093cc7.png)
Function and technical principle of data desensitization [detailed explanation]

Digital collections can go further without hype

Xrrunner, a domestic performance testing tool for palm smart, officially unveiled qecon

Emergency response stack

Creativity: presentation of AI oil paintings with high imitation mineral pigments

Customized view considerations

Chapter 3 business function development (modify the remarks of market activities)

After the failure of listing in Hong Kong, tuba rabbit terminated its gem IPO, and the founder responded

300. Longest increasing subsequence
随机推荐
13. Talk about the expiration strategy of redis
Niuke interview high frequency list (group 1) difficulty: simple & medium
[Flink] aggregation operator
Debezium series: in depth interpretation of important JMX indicators of debezium
Visual studio 2019 installation and uninstallation problems
How to test cookies
Emergency response stack
You are only one SQL statement away from the tdengine Developer Conference!
Debezium series: when there are a large number of DML operations in the record source database, the debezium consumption data time lags behind the data generation time by several hours
Math. Random, switch selection structure
ES(8.1)认证题目
Which stock exchange has the lowest commission? Is online account manager safe to open an account
Bond network card mode setting
Fifth day of force deduction
基于ABP实现DDD--领域逻辑和应用逻辑
C language: Escape Character
Solve "nothing added to commit but untracked files present"“
Which securities company do retail investors choose for stock speculation? Is it safe to open an account on your mobile phone
Memory leak due to improper handling of custom view
Codewars notes