Exemplo n.º 1
0
        /// <summary>
        /// 원매
        /// </summary>
        /// <param name="playResult"></param>
        public void CheckBigRoad(ref BaccaratResultInfo playResult)
        {
            playResult.Big_Road = playResult.ResultType == BaccaratResultType.Player ? PatternType.Negative
                    : playResult.ResultType == BaccaratResultType.Banker ? PatternType.Positive : PatternType.neutral;

            if (PlayResults.Count == 0)
            {
                var newColumn = new List <BaccaratResultInfo>();
                newColumn.Add(playResult);
                PlayResults.Add(newColumn);
                return;
            }

            var latestColumn      = PlayResults[PlayResults.Count - 1];
            var latestBigRoadType = latestColumn.FirstOrDefault(elem => elem.Big_Road != PatternType.neutral)?.Big_Road;

            if (latestBigRoadType == null || // 시작이 타이일 경우
                playResult.Big_Road == PatternType.neutral ||
                latestBigRoadType == playResult.Big_Road)
            {
                latestColumn.Add(playResult);
            }
            else // 새로운 줄 시작
            {
                var newColumn = new List <BaccaratResultInfo>();
                newColumn.Add(playResult);
                PlayResults.Add(newColumn);
            }
        }
Exemplo n.º 2
0
        private void PostProcessBaccaratPlay(BaccaratResultInfo playResult)
        {
            // PlayerCard
            for (int i = 0; i < playResult.PlayerCards.Count; i++)
            {
                var card      = playResult.PlayerCards[i];
                var cardColor = GetBrushForCardShape(card.Shape);
                _palyerShape[i].Content           = card.Shape;
                _palyerShape[i].Foreground        = cardColor;
                _palyerNumber[i].Content          = card.Number;
                _palyerNumber[i].Foreground       = cardColor;
                _lbl_player_result_number.Content = playResult.PlayerValue;
            }

            // BankerCard
            for (int i = 0; i < playResult.BankerCards.Count; i++)
            {
                var card      = playResult.BankerCards[i];
                var cardColor = GetBrushForCardShape(card.Shape);
                _bankerShape[i].Content           = card.Shape;
                _bankerShape[i].Foreground        = cardColor;
                _bankerNumber[i].Content          = card.Number;
                _bankerNumber[i].Foreground       = cardColor;
                _lbl_banker_result_number.Content = playResult.BankerValue;
            }

            ProcessBeadPlateOutput(ref Bead_Plate_Results, ref _grd_bead_plate, playResult.ResultType, playResult, "⓿");        // 6매
            ProcessPatternOutput(ref Big_Road_Results, ref _grd_Big_Road, playResult.Big_Road, playResult, "⓿");                // 원매
            ProcessPatternOutput(ref Big_Eye_Boy_Results, ref _grd_big_eye_boy, playResult.Big_Eye_Boy, playResult, "❶");       // 1군
            ProcessPatternOutput(ref Small_Road_Results, ref _grd_small_road, playResult.Small_Road, playResult, "O");          // 2군
            ProcessPatternOutput(ref Cockroach_Pig_Results, ref _grd_cockroach_pig, playResult.Cockroach_Pig, playResult, "/"); // 3군
        }
Exemplo n.º 3
0
        public void DealingForBanker(ref BaccaratResultInfo playResult, TrumpCardInfo player_3rdCard)
        {
            // 뱅커 합이 0, 1, 2일 경우 무조건 한장 더 받는다.
            if (playResult.BankerValue < 3)
            {
                playResult.BankerCards.Add(PopCard());
                return;
            }

            if (playResult.BankerValue == 7 ||
                player_3rdCard == null)
            {
                return;
            }

            // 뱅커 합이 3일때
            else if (playResult.BankerValue == 3)
            {
                // 플레이어 세번째 카드가 8이 아니면 한장 더 받는다.
                if (player_3rdCard.BaccaratNumber != 8)
                {
                    playResult.BankerCards.Add(PopCard());
                }
            }
            // 뱅커 합이 4일때
            else if (playResult.BankerValue == 4)
            {
                // 플레이어 세번째 카드가 2, 3, 4, 5, 6, 7이면 한장 더 받는다.
                if (player_3rdCard.BaccaratNumber != 0 &&
                    player_3rdCard.BaccaratNumber != 1 &&
                    player_3rdCard.BaccaratNumber != 8 &&
                    player_3rdCard.BaccaratNumber != 9)
                {
                    playResult.BankerCards.Add(PopCard());
                }
            }
            // 뱅커 합이 5일때
            else if (playResult.BankerValue == 5)
            {
                // 플레이어 세번째 카드가 4, 5, 6, 7이면 한장 더 받는다.
                if (player_3rdCard.BaccaratNumber == 4 ||
                    player_3rdCard.BaccaratNumber == 5 ||
                    player_3rdCard.BaccaratNumber == 6 ||
                    player_3rdCard.BaccaratNumber == 7)
                {
                    playResult.BankerCards.Add(PopCard());
                }
            }
            // 뱅커 합이 6일때
            else if (playResult.BankerValue == 6)
            {
                // 플레이어 세번째 카드가 6, 7이면 한장 더 받는다.
                if (player_3rdCard.BaccaratNumber == 6 ||
                    player_3rdCard.BaccaratNumber == 7)
                {
                    playResult.BankerCards.Add(PopCard());
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 중국점 3군
        /// </summary>
        /// <param name="playResult"></param>
        public void CheckCockroachPig(ref BaccaratResultInfo playResult)
        {
            if (PlayResults.Count < 4 ||
                playResult.Big_Road == PatternType.neutral)
            {
                playResult.Cockroach_Pig = PatternType.neutral;
                return;
            }

            var latestColumn       = PlayResults[PlayResults.Count - 1];
            var latestColumnRowCnt = latestColumn.Where(elem => elem.Big_Road != PatternType.neutral).Count();

            if (latestColumnRowCnt == 1) // 새로운 줄 시작일 경우
            {
                if (PlayResults.Count == 4)
                {
                    playResult.Cockroach_Pig = PatternType.neutral;
                    return;
                }

                // 비교 컬럼
                latestColumn       = PlayResults[PlayResults.Count - 2];
                latestColumnRowCnt = latestColumn.Where(elem => elem.Big_Road != PatternType.neutral).Count();

                // 기준 컬럼
                var fiducialColumn       = PlayResults[PlayResults.Count - 5];
                var fiducialColumnRowCnt = fiducialColumn.Where(elem => elem.Big_Road != PatternType.neutral).Count();

                if (latestColumnRowCnt == fiducialColumnRowCnt)
                {
                    playResult.Cockroach_Pig = PatternType.Positive;
                }
                else
                {
                    playResult.Cockroach_Pig = PatternType.Negative;
                }
            }
            else
            {
                // 기준 컬럼
                var fiducialColumn       = PlayResults[PlayResults.Count - 4];
                var fiducialColumnRowCnt = fiducialColumn.Where(elem => elem.Big_Road != PatternType.neutral).Count();

                if (fiducialColumnRowCnt >= latestColumnRowCnt)
                {
                    playResult.Cockroach_Pig = PatternType.Positive;
                }
                else if ((latestColumnRowCnt - fiducialColumnRowCnt) > 1)
                {
                    playResult.Cockroach_Pig = PatternType.Positive;
                }
                else
                {
                    playResult.Cockroach_Pig = PatternType.Negative;
                }
            }
        }
Exemplo n.º 5
0
        public void DealingForPlayer(ref BaccaratResultInfo playResult, out TrumpCardInfo thirdCards)
        {
            thirdCards = null;

            if (playResult.PlayerValue == 6 ||
                playResult.PlayerValue == 7)
            {
                return;
            }

            // 플레이어 패가 5이하라면 한장 더 받는다.
            thirdCards = PopCard();
            playResult.PlayerCards.Add(thirdCards);
        }
Exemplo n.º 6
0
 public void DecideBaccaratResult(ref BaccaratResultInfo playResult)
 {
     if (playResult.PlayerValue > playResult.BankerValue)
     {
         playResult.ResultType = BaccaratResultType.Player;
     }
     else if (playResult.PlayerValue < playResult.BankerValue)
     {
         playResult.ResultType = BaccaratResultType.Banker;
     }
     else
     {
         playResult.ResultType = BaccaratResultType.Tie;
     }
 }
Exemplo n.º 7
0
        public BaccaratResultInfo PlayNext()
        {
            if (!IsPlayable())
            {
                return(null);
            }

            var playResult = new BaccaratResultInfo
            {
                GameSeq     = ++GameSeq,
                PlayerCards = new List <TrumpCardInfo>(),
                BankerCards = new List <TrumpCardInfo>(),
            };

            // Dealing
            int cardCounting = 0;

            do
            {
                ++cardCounting;
                if (cardCounting % 2 == 1)
                {
                    playResult.PlayerCards.Add(PopCard());
                }
                else
                {
                    playResult.BankerCards.Add(PopCard());
                }
            } while (cardCounting < 4);

            if (playResult.PlayerValue < 8 &&
                playResult.BankerValue < 8)
            {
                DealingForPlayer(ref playResult, out TrumpCardInfo player_3rdCard);
                DealingForBanker(ref playResult, player_3rdCard);
            }

            // Decide
            DecideBaccaratResult(ref playResult);
            CheckBigRoad(ref playResult);      // 원매
            CheckBigEyeBoy(ref playResult);    // 중국점 1군
            CheckSmallRoad(ref playResult);    // 중국점 2군
            CheckCockroachPig(ref playResult); // 중국점 3군

            return(playResult);
        }
Exemplo n.º 8
0
        private void ProcessPatternOutput(ref List <List <PatternType> > patternResults, ref GridControl grd_control, PatternType patternType, BaccaratResultInfo playResult, string outputValue)
        {
            if (patternType == PatternType.neutral)
            {
                return;
            }

            if (patternResults.Count == 0)
            {
                var newLine = new List <PatternType>();
                newLine.Add(patternType);
                patternResults.Add(newLine);
            }
            else
            {
                var latestLine = patternResults[patternResults.Count - 1];
                var linePatten = latestLine.First();
                if (linePatten == patternType)
                {
                    latestLine.Add(patternType);
                }
                else
                {
                    var newLine = new List <PatternType>();
                    newLine.Add(patternType);
                    patternResults.Add(newLine);
                }
            }

            // Output to cell
            var latest = patternResults[patternResults.Count - 1];

            grd_control.Model[latest.Count, patternResults.Count].Foreground  = GetBrushForPatternType(patternType);
            grd_control.Model[latest.Count, patternResults.Count].CellValue   = outputValue;
            grd_control.Model[latest.Count, patternResults.Count].ShowTooltip = true;
            grd_control.Model[latest.Count, patternResults.Count].ToolTip     = $"seq: {playResult.GameSeq}, player: {playResult.PlayerValue}, banker: {playResult.BankerValue}";
        }
Exemplo n.º 9
0
        private void ProcessBeadPlateOutput(ref List <List <BaccaratResultType> > bead_Plate_Results, ref GridControl grd_control, BaccaratResultType resultType, BaccaratResultInfo playResult, string outputValue)
        {
            if (bead_Plate_Results.Count == 0)
            {
                var newLine = new List <BaccaratResultType>();
                newLine.Add(resultType);
                bead_Plate_Results.Add(newLine);
            }
            else
            {
                var latestLine = bead_Plate_Results[bead_Plate_Results.Count - 1];
                if (latestLine.Count == 6)
                {
                    var newLine = new List <BaccaratResultType>();
                    newLine.Add(resultType);
                    bead_Plate_Results.Add(newLine);
                }
                else
                {
                    latestLine.Add(resultType);
                }
            }

            // Output to cell
            var latest = bead_Plate_Results[bead_Plate_Results.Count - 1];

            grd_control.Model[latest.Count, bead_Plate_Results.Count].Foreground  = GetBrushForResultType(resultType);
            grd_control.Model[latest.Count, bead_Plate_Results.Count].CellValue   = outputValue;
            grd_control.Model[latest.Count, bead_Plate_Results.Count].ShowTooltip = true;
            grd_control.Model[latest.Count, bead_Plate_Results.Count].ToolTip     = $"seq: {playResult.GameSeq}, player: {playResult.PlayerValue}, banker: {playResult.BankerValue}";
        }