public int DealerRound(int I, Computer com, Human p)
        {
            try
            {
                Clear();//清庄家手牌
                Casino.Deliver(dealerhand, j, I);
                I++;
                j++;
                Casino.Deliver(dealerhand, j, I);
                I++;
                j++;
                while ((sum = GetSum(dealerhand)) < 17)
                {
                    Casino.Deliver(dealerhand, j, I);
                    I++;
                    j++;
                    if ((sum = GetSum(dealerhand)) > 21)
                    {
                        throw (new DealerBusted("DealerBusted"));
                    }
                }
            }
            catch (DealerBusted)
            {
                flag++;
                switch (com.Flag)
                {
                case 0:
                    if (com.Knock == "d")
                    {
                        com.Win   += 2;
                        com.HTrend = Abs(com.HTrend - 8);
                        com.DTrend = Abs(com.DTrend + 24);
                        com.STrend = Abs(com.STrend - 8);
                        com.RTrend = Abs(com.RTrend - 8);
                        if (com.HTrend < 22)
                        {
                            com.HTrend += 21;
                        }
                        if (com.DTrend < 22)
                        {
                            com.DTrend += 21;
                        }
                        if (com.STrend < 22)
                        {
                            com.STrend += 21;
                        }
                        if (com.RTrend < 22)
                        {
                            com.RTrend += 21;
                        }
                    }
                    else if (com.IfViceExp == 0)
                    {
                        com.Win   += 1;
                        com.HTrend = Abs(com.HTrend - 4);
                        com.DTrend = Abs(com.DTrend - 4);
                        com.STrend = Abs(com.STrend + 12);
                        com.RTrend = Abs(com.RTrend - 4);
                        if (com.HTrend < 22)
                        {
                            com.HTrend += 21;
                        }
                        if (com.DTrend < 22)
                        {
                            com.DTrend += 21;
                        }
                        if (com.STrend < 22)
                        {
                            com.STrend += 21;
                        }
                        if (com.RTrend < 22)
                        {
                            com.RTrend += 21;
                        }
                    }
                    else
                    {
                        com.Win    += 1;
                        com.HTrend  = Abs(com.HTrend + 12);
                        com.DTrend  = Abs(com.DTrend - 4);
                        com.STrend  = Abs(com.STrend - 4);
                        com.RTrend  = Abs(com.RTrend - 4);
                        com.HTrend1 = Abs(com.HTrend1 - 12);
                        com.STrend1 = Abs(com.STrend1 + 12);
                        if (com.HTrend < 22)
                        {
                            com.HTrend += 21;
                        }
                        if (com.DTrend < 22)
                        {
                            com.DTrend += 21;
                        }
                        if (com.STrend < 22)
                        {
                            com.STrend += 21;
                        }
                        if (com.RTrend < 22)
                        {
                            com.RTrend += 21;
                        }
                        if (com.HTrend1 < 22)
                        {
                            com.HTrend1 += 21;
                        }
                        if (com.STrend1 < 22)
                        {
                            com.STrend1 += 21;
                        }
                    }
                    Console.WriteLine("Dealer Burst!Computer Win!");
                    break;

                case 1:
                    break;
                }
                switch (p.Flag)
                {
                case 0:
                    if (p.Knock == "d")
                    {
                        p.Win += 2;
                    }
                    else
                    {
                        p.Win += 1;
                    }
                    Console.WriteLine("Dealer Burst!You Win!");
                    break;

                case 1:
                    break;
                }
            }
            finally
            {
            }
            return(flag);
        }
        //人工操作玩家回合
        public int PersonRound(int I)
        {
            try
            {
                Clear();//清玩家手牌
                //int tmp = 0;
                Console.WriteLine("Human Round:");
                Casino.Deliver(playerhand, j, I);//1st Card 发第一张
                j++;
                I++;
                Casino.Deliver(playerhand, j, I);//2nd Card 发第二张
                j++;
                I++;
                sum = GetSum(playerhand); //累积求和
                if (sum == 21)            //21点直接结束,不改变任何倾向,因为与操作无关
                {
                    ifmainexpexist = 1;
                    throw (new YouGotABlackJack("You Got A Black Jack"));
                }
                else
                {
                    //ReadTendency(0);//模式0==读取主经验库
                    //knock = RandomMainTrend(htrend, dtrend, strend, rtrend);//根据倾向,计算机进行随机判断
                    //Console.WriteLine("The computer selects {0}", knock);
                    QandA();//预留的人工应答界面
                    switch (knock)
                    {
                    case "h":
                        while (knock == "h")
                        {
                            Casino.Deliver(playerhand, j, I);
                            I++;
                            j++;
                            if ((sum = GetSum(playerhand)) > 21 && ifviceexpexist == 0)
                            {
                                throw (new YouBursted("You Bursted"));
                            }
                            //ifviceexpexist = 2;
                            //vicemark = 0;
                            //ReadTendency(1);
                            //knock = RandomViceTrend(htrend1, strend1);
                            QandA();
                            //Console.WriteLine("The computer selects {0}", knock);
                            //Console.ReadKey();
                        }
                        break;

                    //case 'p':
                    case "d":
                        Casino.Deliver(playerhand, j, I);
                        I++;
                        j++;
                        sum = GetSum(playerhand);
                        if (sum > 21)
                        {
                            throw (new YouBursted("You Bursted"));
                        }
                        break;

                    case "r":
                        throw (new YouSurrender("You Surrender"));

                    default:
                        break;
                    }
                }
            }
            catch (YouGotABlackJack)
            {
                win += 1.5;
                flag++;
                Console.WriteLine("Good Fortune Sir!!");
            }
            catch (YouBursted)
            {
                if (knock == "d")
                {
                    lose += 2;
                    flag++;
                }
                else if (ifviceexpexist == 0)
                {
                    lose += 1;
                    flag++;
                }
                else
                {
                    lose += 1;
                    flag++;
                }
                Console.WriteLine("You Burst!");
            }
            catch (YouSurrender)
            {
                lose += 0.5;
                flag++;
                Console.WriteLine("You Surrender.");
            }
            finally
            {
            }
            return(I);
        }
        //电脑控制的玩家回合
        public int PlayerRound(int I)
        {
            try
            {
                Clear();//清玩家手牌
                IfMainExp = 0;
                IfViceExp = 0;
                int tmp = 0;
                Console.WriteLine("Computer Round:");
                Casino.Deliver(playerhand, j, I);//1st Card 发第一张
                I++;
                j++;
                Casino.Deliver(playerhand, j, I);//2nd Card 发第二张
                I++;
                j++;
                sum = GetSum(playerhand); //累积求和
                if (sum == 21)            //21点直接结束,不改变任何倾向,因为与操作无关
                {
                    ifmainexpexist = 1;
                    throw (new YouGotABlackJack("Computer Got A Black Jack"));
                }
                else
                {
                    ReadTendencyFromSql(0, CardCombination);                 //模式0==读取主经验库
                    knock = RandomMainTrend(htrend, dtrend, strend, rtrend); //根据倾向,计算机进行随机判断
                    Console.WriteLine("The computer selects {0}", knock);
                    //QandA();//预留的人工应答界面
                    //Console.ReadKey();
                    switch (knock)
                    {
                    case "h":
                        while (knock == "h")
                        {
                            Casino.Deliver(playerhand, j, I);
                            I++;
                            j++;
                            if ((sum = GetSum(playerhand)) > 21 && ifviceexpexist == 0)
                            {
                                throw (new YouBursted("Computer Bursted"));
                            }
                            if (sum > 21)
                            {
                                tmp = playerhand[j - 1];
                                playerhand[j - 1] = 0;
                                sum = GetSum(playerhand);
                                throw (new YouBursted("Computer Bursted"));
                            }
                            if (ifviceexpexist == 3)
                            {
                                tmp = playerhand[j - 1];
                                playerhand[j - 1] = 0;
                                sum     = GetSum(playerhand);
                                htrend1 = Abs(htrend1 + 6);
                                strend1 = Abs(strend1 - 6);
                                EditTendencyToSql(4, sum);
                                playerhand[j - 1] = tmp;
                                sum = GetSum(playerhand);
                            }
                            ifviceexpexist = 2;
                            ReadTendencyFromSql(1, sum);
                            knock = RandomViceTrend(htrend1, strend1);
                            //p.QandA();
                            Console.WriteLine("The Computer selects {0}", knock);
                            //Console.ReadKey();
                        }
                        break;

                    //case 'p':
                    case "d":
                        Casino.Deliver(playerhand, j, I);
                        I++;
                        j++;
                        sum = GetSum(playerhand);
                        if (sum > 21)
                        {
                            throw (new YouBursted("Computer Bursted"));
                        }
                        break;

                    case "r":
                        throw (new YouSurrender("Computer Surrender"));

                    default:
                        break;
                    }
                }
            }
            catch (YouGotABlackJack)
            {
                win += 1.5;
                flag++;
                Console.WriteLine("Good Fortune Sir!!");
            }
            catch (YouBursted)
            {
                if (knock == "d")
                {
                    lose += 2;
                    flag++;
                    htrend = Abs(htrend + 8);
                    dtrend = Abs(dtrend - 24);
                    strend = Abs(strend + 8);
                    rtrend = Abs(rtrend + 8);
                    if (htrend < 22)
                    {
                        htrend += 21;
                    }
                    if (dtrend < 22)
                    {
                        dtrend += 21;
                    }
                    if (strend < 22)
                    {
                        strend += 21;
                    }
                    if (rtrend < 22)
                    {
                        rtrend += 21;
                    }
                }
                else if (ifviceexpexist == 0)
                {
                    lose += 1;
                    flag++;
                    htrend = Abs(htrend - 12);
                    strend = Abs(strend + 8);
                    rtrend = Abs(rtrend + 4);
                    if (htrend < 22)
                    {
                        htrend += 21;
                    }
                    if (dtrend < 22)
                    {
                        dtrend += 21;
                    }
                    if (strend < 22)
                    {
                        strend += 21;
                    }
                    if (rtrend < 22)
                    {
                        rtrend += 21;
                    }
                }
                else
                {
                    lose += 1;
                    flag++;
                    htrend  = Abs(htrend + 12);
                    dtrend  = Abs(dtrend - 4);
                    strend  = Abs(strend - 4);
                    rtrend  = Abs(rtrend - 4);
                    htrend1 = Abs(htrend1 - 12);
                    strend1 = Abs(strend1 + 12);
                    if (htrend < 22)
                    {
                        htrend += 21;
                    }
                    if (dtrend < 22)
                    {
                        dtrend += 21;
                    }
                    if (strend < 22)
                    {
                        strend += 21;
                    }
                    if (rtrend < 22)
                    {
                        rtrend += 21;
                    }
                    if (htrend1 < 22)
                    {
                        htrend1 += 21;
                    }
                    if (strend1 < 22)
                    {
                        strend1 += 21;
                    }
                }
                Console.WriteLine("Computer Burst!");
            }
            catch (YouSurrender)
            {
                lose += 0.5;
                flag++;
                htrend = Abs(htrend + 2);
                dtrend = Abs(dtrend + 2);
                strend = Abs(strend + 2);
                rtrend = Abs(rtrend - 6);
                if (htrend < 22)
                {
                    htrend += 21;
                }
                if (dtrend < 22)
                {
                    dtrend += 21;
                }
                if (strend < 22)
                {
                    strend += 21;
                }
                if (rtrend < 22)
                {
                    rtrend += 21;
                }
                Console.WriteLine("Computer Surrender.");
            }
            finally
            {
                Console.WriteLine("**********************************************");
            }
            return(I);
        }