import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
public class Doudizhu {
public static void main(String[]args){
// Store playing cards
// Brand category + Corresponding to the design and color
HashMap<Integer, String> pooker = new HashMap<Integer,String>();
// The number of the card
ArrayList<Integer> pookerNum = new ArrayList<Integer>();
// Brand category
String[] nums = {"2","A","K","Q","J","10","9","8","7","6","5","4","3"};
String[] colors = {" black "," red "," mei "," Fang "};
int index = 2;
for(String num:nums){
for(String color:colors){
pooker.put(index, color+num);
pooker.put(0, " King ");
pooker.put(1, " Xiao Wang ");
// Shuffle . Out of order
ArrayList<Integer> player1 = new ArrayList<Integer>();
ArrayList<Integer> player2 = new ArrayList<Integer>();
ArrayList<Integer> player3 = new ArrayList<Integer>();
ArrayList<Integer> bottom = new ArrayList<Integer>();
// Simulated split
for(int i=0;i<pookerNum.size();i++){
// Pack the cards
// Look at cards
look(" At the end of card ",bottom, pooker);
public static void look(String name,ArrayList<Integer> player,HashMap<Integer, String> pooker){
System.out.print(name+": ");
for(Integer key:player){
String value = pooker.get(key);
System.out.print(value+" ");

java The simulation fights the landlord to deal the card to see the card more related article

  1. java Deal and shuffle the cards

    One   Shuffle the cards in a simulated fight against the landlord 1. Case needs According to the rules of fighting against landlords , Complete the shuffle action . Specific rules : 1. assemble 54 A playing card 2. take 54 Shuffle the cards 3. Three players participate in the game , Three people touch the cards alternately , Everyone 17 card , The last three ...

  2. Java Deal and shuffle the cards

    package cn.itcast_04; import java.util.ArrayList; import java.util.Collections; import java.util.Has ...

  3. java aggregate -- Deal and shuffle the cards

    import java.util.*; /** * @Date: 2020/6/17 19:53 */public class Test04 { public static void main(Str ...

  4. Java Learning notes 34( Set frame eight : Comprehensive case : Simulate the shuffling of landlords )

    The rules : 1.54 A playing card , There are colors and designs 2. The order is out of order , Deal cards one by one , One person 17 Zhang , Keep three cards as a card 3. Look at cards : By size 2A....43 Print in order Example : package demo; import java ...

  5. Java The code of the program ,List、Map Applications of collections

    Java Flexible use of collective storage List Collective storage 54 Number Map <key,value> key The corresponding number is , value yes The suit of the card ( Red Square plum black )+ A specific card , such as Spade 2 use 2 ...

  6. Java Simulate a fight against the landlord

    Simulate a fight against the landlord public class M1 { public static void main(String args[]) { DouDiZhu02(); } private static void ...

  7. Java Simulate a fight against the landlord ( Implement size sorting )

    import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Li ...

  8. Java To deal with landlords (Collections Application of tool class )

    package com.doudou_01; import java.util.ArrayList; import java.util.Collections; import java.util.Li ...

  9. php It's easy to understand how to deal cards in a simulated fight

    Idle to be bored , I wrote this method , I'm familiar with php An array of operations for , Please give me more advice .$arr Array , There seems to be a problem , should 2=>' Square piece 2',3=>' The plum blossom 2',4=>' Red hearts 2',5=>' black ...

Random recommendation

  1. High availability 、 Load balanced mysql Clustering solutions

    High availability . Load balanced mysql Clustering solutions One .mysql Market share Two .mysql Why is it so popular 3、 ... and .mysql The advantages and disadvantages of database system Four . Network server requirements 5、 ... and . What is? mysql The cluster of 6、 ... and . what ...

  2. HDU 5084 HeHe -- Looking for a regular

    The question : Give the matrix M, seek M*M Matrix r That's ok c Number of columns , Each query is related to the result of the previous query . solution : Look at the matrix and see , Make ans = M*M, be ans[x][y] = (n-1-x Each value of the row )*(n-1+y Each of the columns ...

  3. Linux mysql Common operation command

    original text : 1.linux Under boot MySQL The order of :mysqladmin start ...

  4. Robotium Automated test report generation

    Use Robotium When testing , To export visual test results , have access to junitreport To achieve junitreport Download address : ...

  5. #define and typedef stay windows Application on

    typedef Application typedef It's used in computer programming languages to define simple aliases for complex declarations . The following code defines some common types of aliases typedef int INT; typedef unsigned int ...

  6. Scrapy The use of selectors in

    Official documents : Using selectors Constructing selectors R ...

  7. according to Power BI Desktop( preview ) Report page creation tool tips in

    according to Power BI Desktop Report page created in , Create intuitive and rich report tool tips , These tips are displayed when you hover over a visual object .  By creating a report page to be used as a tool tip , Make custom tool tips include visual objects . Images and in ...

  8. cf1139D. Steps to One(dp)

    The question Topic link from \([1, M]\) Choose random numbers from the list , Asking makes all numbers gcd=1 Expected steps of Sol An obvious idea is to set \(f[i]\) Indicates that the current number is \(i\), Expected number of operation rounds , Direct enumeration when transferring gcd \(f ...

  9. yii2 Alibaba cloud SMS aliyun-dysms

    aliyun-dysms install composer require "saviorlv/yii2-dysms:dev-master" Or add the following code in composer.json In file ...

  10. 3、 ... and 、 file IO—— system call ( To continue )

    3.2.4 read function --- Reading documents read( Read data from an open file ) #include<unistd.h> ssize_t read(int fd, void * buf, siz ...