当前位置:网站首页>[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))
}
}
边栏推荐
- Es- retrieve the selected field from the search
- 有个问题想请教下,我想用来同步数据库,但我看他是根据mysql 的binlog同步的,如果是大表,一
- Shell programming (script) (variable)
- Uniapp picker select the effect demo of provinces and cities (finishing)
- 原创 | ueditor1.4.3-asmx绕过waf
- Attack and defense world ----- ics-05
- GDAL image resampling
- Application of AI in testing
- DNS domain name resolution
- Detailed explanation of kubernetes network plug-in - flannel chapter
猜你喜欢
![Top101 [linked list] must be applied for interview](/img/f5/2b27d0e3fbd52dd04ffcd660c01a78.png)
Top101 [linked list] must be applied for interview

使用 “display: flex;justify-content: center;align-items: center; ” 解决流式栅格布局无法居中的问题

Installation and tutorial of MATLAB curling simulation game

ECCV 2022 | rethinking image blending for data enhancement in vision transformers

Visual studio 2019 installation and uninstallation problems

Creativity: Modern Art anonymous oil painting AI works presentation

Sales system of infant products based on SSH

MySQL select query part 2

DOM event flow

MySQL eight shares
随机推荐
Jenkins continues to integrate entry to mastery
To clarify the tax arrears: there is no tax arrears, and will continue to operate in compliance, rooted in China
01_ Education 1
Analytic hierarchy process of MATLAB
Wechat applet authorized login (including obtaining basic information and binding mobile number)
Implementation of online number or fan query of the scene
Niuke interview high frequency list (group 1) difficulty: simple & medium
Sales system of infant products based on SSH
Homologous strategy, surface longitude
Creativity: presentation of AI oil paintings with high imitation mineral pigments
[Flink] rich function
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
Original | record a loophole excavation in Colleges and Universities
The LAF protocol elephant of defi 2.0 may be one of the few profit-making means in your bear market
基于ABP实现DDD--领域逻辑和应用逻辑
Internship in 2022
Force deduction question 3
Press the switch for the minimum number of times to turn on all lights
Display: the function and effect of align content, justify content and align items under flex
Huawei | mlgoperf: ML boot inline for optimizing performance