package com.genlot.ninglottery.game.d3.bean;

import com.genlot.ninglottery.game.bet.BetNumber;

import java.util.Collections;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;

/**
 * @author ZhuYongKang
 * @description 组选3胆拖
 * @date 2019/10/16
 */
public class BaseBox3 extends BaseD3{

    @Override
    public void random(int... args) {
        clear();
        int dan = args[0];
        int tuo = args[1];
        //胆 必须相同
        Random rand = new Random();
        int anInt = rand.nextInt(10);
        BetNumber number = new BetNumber(String.valueOf(anInt));
        number.setType(BetNumber.DAN);
        while (mDanList.size() < dan) {
            mDanList.add(number);
        }
        //拖 不含胆
        Set<Integer> tuoSet = new TreeSet<>();
        while (tuoSet.size() < tuo) {
            int num = rand.nextInt(10);
            if (anInt != num) {
                tuoSet.add(num);
            }
        }
        for (int i : tuoSet) {
            BetNumber tuoNumber = new BetNumber(String.valueOf(i));
            tuoNumber.setType(BetNumber.CHECKED);
            mTuoList.add(tuoNumber);
        }
    }
}
