Esempio n. 1
0
        private void deleteCardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node == null)
            {
                return;
            }
            Card card = node.Tag as Card;

            if (card == null)
            {
                return;
            }
            CardGroup group = node.Parent.Tag as CardGroup;

            if (group != null)
            {
                IList <CardGroupMap> cards = group.CardGroupMaps();
                foreach (CardGroupMap map in cards)
                {
                    if (map.IdCard == card.IdCard)
                    {
                        map.Remove();
                        break;
                    }
                }
            }
            UpdateHybrids();
            RemoteControl.Instance.Restart();
        }
Esempio n. 2
0
 public void Initialize()
 {
     cardsInHand.Clear();
     cardSelected = null;
     cardGroupSelectedForBattle = null;
     numberOfWins = 0;
 }
Esempio n. 3
0
 public IEnumerator CastSkill(SkillManager.Timing timing, CardGroup group)
 {
     for (int i = 0; i < group.owner.transform.childCount; i++)
     {
         yield return(group.owner.transform.GetChild(i).GetComponent <RealCard>().skill.FindAndCastSkill(timing, group, i));
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Handles navigation in wards and sets up the event model parameter.
        /// </summary>
        /// <param name="e">
        /// The <see cref="NavigatedToEventArgs"/> instance containing the event data.
        /// </param>
        /// <param name="viewModelState">
        /// The parameter is not used.
        /// </param>
        public override void PopulateViewModel()
        {
            // base.OnNavigatedTo(INavigationParameters parameters);
            // BaseEventAggregator.GetEvent<PageTitleChangedEvent>().Publish(new
            // PageTitleChangedEventArgs { PageTitle = "NameMap Detail", PageIcon =
            // CommonConstants.IconNameMaps });

            // cache the Note model TODO NameMapObject = DV.NameMapDV.GetModel(parameters as string);

            // Get basic details
            CardGroup t = new CardGroup {
                Title = "Header Details"
            };

            t.Add(new CardListLineCollection
            {
                new CardListLine("Card Type:", "Name Map Detail"),
                new CardListLine("Private:", NameMapObject.PrivAsString),
            });

            // Add Model details
            t.Add(DV.NameMapDV.GetModelInfoFormatted(NameMapObject));

            BaseHeader.Add(t);

            // BackHLinkRefNavArgument = localNavigationHelper.HLinkModelCollectionAdd(NoteObject.BackHLinkReferenceCollection);
            BaseBackLinks.Add(NameMapObject.BackHLinkReferenceCollection.GetCardGroup());
        }
Esempio n. 5
0
        private async Task <bool> DisplaySingleDealStage(GameContext gameContext, List <Player> players, int stage)
        {
            List <string> playerDealOrder = gameContext.CurRound.PlayerDealOrder
                                            .OrderBy(keyValPair => keyValPair.Key)
                                            .Select(keyValPair => keyValPair.Value)
                                            .ToList();

            // iterate through all players: cards for AI players are dealt face down and cards for human players face
            for (int i = 0; i < playerDealOrder.Count(); i++)
            {
                string    playerName       = playerDealOrder[i];
                Card      cardToTransfer   = players.Find(player => player.Name == playerName).Hand[stage];
                CardGroup destinationGroup = _playerCardGroups[playerName];
                _componentProvider.CenterShuffleCardGroup.Transfer(cardToTransfer, destinationGroup, new AnimationBehavior
                {
                    Duration  = 0.3,
                    Delay     = .125 * i,
                    Rotations = 3
                });
            }

            await _componentProvider.RunQueuedAnimations();

            return(true);
        }
Esempio n. 6
0
    /// <summary>
    /// 给定时机,让卡牌自己决定是否要发动技能
    /// </summary>
    /// <param name="timing">发动时机</param>
    /// <param name="position">卡牌位置</param>
    /// <returns></returns>
    public IEnumerator FindAndCastSkill(Timing timing, CardGroup cg, int position = -1)
    {
        /*
         * if(position == -1)  // 无法判断卡牌位置
         * {
         *  for(int i=0)
         * }
         */

        foreach (var skill in skills)
        {
            if (!dic.ContainsKey(skill.skill))
            {
                continue;                                   // debug用,排除尚未加入的技能
            }
            bool flg = false;
            foreach (Timing tim in dic[skill.skill]) //就算是同个技能,也可能有多个timing
            {
                if (tim == timing)
                {
                    flg = true;
                    break;
                }
            }
            if (!flg)
            {
                continue;
            }
            yield return(Cast(skill, cg, position));
        }
    }
        /// <summary>
        /// Handles navigation in wards and sets up the event model parameter.
        /// </summary>
        /// <param name="e">
        /// The <see cref="NavigatedToEventArgs"/> instance containing the event data.
        /// </param>
        /// <param name="viewModelState">
        /// The parameter is not used.
        /// </param>
        public override void PopulateViewModel()
        {
            // Handle HLinkKeys
            CitationObject = DV.CitationDV.GetModelFromHLinkString(BaseNavParamsHLink.HLinkKey);

            if (CitationObject != null)
            {
                BaseTitle     = CitationObject.GetDefaultText;
                BaseTitleIcon = CommonConstants.IconCitation;

                // Get media image
                HLinkHomeImageModel mediaImage = CitationObject.HomeImageHLink;
                mediaImage.CardType = DisplayFormat.MediaCardLarge;
                BaseDetail.Add(mediaImage);

                //// Get Note
                //CardGroup noteCardGroup = new CardGroup();
                //NoteCardFull noteCard = new NoteCardFull();
                //noteCard.BindingContext = CitationObject.GetFirstModel;
                //noteCardGroup.Add(noteCard);
                //BaseDetail.Add(noteCardGroup);

                // Get basic details
                CardGroup t = new CardGroup {
                    Title = "Header Details"
                };

                t.Add(new CardListLineCollection
                {
                    new CardListLine("Card Type:", "Citation Detail"),
                    new CardListLine("Date:", CitationObject.GDateContent.GetLongDateAsString),
                    new CardListLine("Page:", CitationObject.GPage),
                    new CardListLine("Confidence:", CitationObject.GConfidence.ToString(CultureInfo.CurrentCulture)),
                });

                t.Add(DV.CitationDV.GetModelInfoFormatted(CitationObject));

                BaseDetail.Add(t);

                // Add Source details
                HLinkSourceModel sourceCard = CitationObject.GSourceRef;
                sourceCard.CardType = DisplayFormat.SourceCardSmall;
                BaseDetail.Add(sourceCard);

                // If only one note (the most common case) just display it in a large format,
                // otherwise setup a list of them.
                if (CitationObject.GNoteRefCollection.Count > 0)
                {
                    // TODO Fix this NoteObject = CitationObject.GNoteRefCollection[0].DeRef;
                }

                // Add remaining details
                BaseDetail.Add(CitationObject.GMediaRefCollection.GetCardGroup());
                BaseDetail.Add(CitationObject.GNoteRefCollection.GetCardGroup());
                BaseDetail.Add(CitationObject.GTagRef.GetCardGroup());
                BaseDetail.Add(CitationObject.GSourceAttributeCollection);

                BaseDetail.Add(CitationObject.BackHLinkReferenceCollection.GetCardGroup());
            }
        }
Esempio n. 8
0
 public ExhaustSpecificCardAction(AbstractCard _targetCard, CardGroup _group, bool _isFast)
 {
     targetCard = _targetCard;
     SetValues(AbstractDungeon.Player, AbstractDungeon.Player, Amount);
     GameActionType = ActionType.Exhaust;
     group          = _group;
 }
Esempio n. 9
0
        public void TestOmahaOnePairAnalyzer()
        {
            var analyzer = new OmahaOnePairAnalyzer();

            var item11 = CreateOnePairHandGridItem(new Tuple <string, string>("", ""));
            var item12 = CreateOnePairHandGridItem(new Tuple <string, string>("", "4"));
            var cards1 = CardGroup.Parse("4c8cKcAc");

            var item21 = CreateOnePairHandGridItem(new Tuple <string, string>("", ""));
            var item22 = CreateOnePairHandGridItem(new Tuple <string, string>("", "K"));
            var item23 = CreateOnePairHandGridItem(new Tuple <string, string>("", "4"));
            var cards2 = CardGroup.Parse("KcKd4c5c");

            var item31 = CreateOnePairHandGridItem(new Tuple <string, string>("", ""));
            var item32 = CreateOnePairHandGridItem(new Tuple <string, string>("", "5"));
            var cards3 = CardGroup.Parse("5c5d9c9d");
            var cards4 = CardGroup.Parse("5d5c5h2c");
            var cards5 = CardGroup.Parse("5c5d5h5s");

            Assert.That(analyzer.Analyze(cards1, item11), Is.False);
            Assert.That(analyzer.Analyze(cards1, item12), Is.False);
            Assert.That(analyzer.Analyze(cards2, item21), Is.True);
            Assert.That(analyzer.Analyze(cards2, item22), Is.True);
            Assert.That(analyzer.Analyze(cards2, item23), Is.False);
            Assert.That(analyzer.Analyze(cards3, item31), Is.False);
            Assert.That(analyzer.Analyze(cards3, item32), Is.False);
            Assert.That(analyzer.Analyze(cards4, item31), Is.False);
            Assert.That(analyzer.Analyze(cards4, item32), Is.False);
            Assert.That(analyzer.Analyze(cards5, item31), Is.False);
            Assert.That(analyzer.Analyze(cards5, item32), Is.False);
        }
        /// <summary>
        /// Populates the view ViewModel.
        /// </summary>
        /// <returns>
        /// </returns>
        public override void PopulateViewModel()
        {
            BookMarkObject = DV.BookMarkDV.GetModelFromHLinkString(BaseNavParamsHLink.HLinkKey);

            if (BookMarkObject != null)
            {
                BaseTitle     = BookMarkObject.GetDefaultText;
                BaseTitleIcon = CommonConstants.IconBookMark;

                // Get basic details
                CardGroup t = new CardGroup {
                    Title = "Header Details"
                };

                t.Cards.Add(new CardListLineCollection
                {
                    new CardListLine("Card Type:", "BookMark Detail"),
                    new CardListLine("Private:", BookMarkObject.PrivAsString),
                    new CardListLine("Target:", BookMarkObject.GTarget),
                });

                // Add Model details
                t.Cards.Add(DV.BookMarkDV.GetModelInfoFormatted(BookMarkObject));

                BaseHeader.Add(t);

                BaseBackLinks.Add(BookMarkObject.BackHLinkReferenceCollection.GetCardGroup());
            }
        }
Esempio n. 11
0
        public void TestOmahaHoleCardStructureLowCardsAnalyzer()
        {
            var analyzer = new OmahaHoleCardStructureLowCardsAnalyzer();

            var item = new HoleCardStructureHandGridItem()
            {
                SelectedNumber = 1
            };
            var item2 = new HoleCardStructureHandGridItem()
            {
                SelectedNumber = 2
            };
            var cards  = CardGroup.Parse("Ac6d6h6s");
            var cards2 = CardGroup.Parse("Ac2c4d3s");
            var cards3 = CardGroup.Parse("KdAsAd2s");
            var cards4 = CardGroup.Parse("KdTs2s5s");

            Assert.That(analyzer.Analyze(cards, item), Is.False);
            Assert.That(analyzer.Analyze(cards, item2), Is.False);
            Assert.That(analyzer.Analyze(cards2, item), Is.False);
            Assert.That(analyzer.Analyze(cards2, item2), Is.False);
            Assert.That(analyzer.Analyze(cards3, item), Is.True);
            Assert.That(analyzer.Analyze(cards3, item2), Is.False);
            Assert.That(analyzer.Analyze(cards4, item), Is.False);
            Assert.That(analyzer.Analyze(cards4, item2), Is.True);
        }
Esempio n. 12
0
        public CardGroup GetAllAsGroupedBirthDayCardGroup()
        {
            CardGroup t = new CardGroup();

            var query = from item in DataViewData
                        orderby item.BirthDate.GetMonthDay, item.GPersonNamesCollection.GetPrimaryName.DeRef.SortName
            where ((item.IsLiving == true) && (item.BirthDate.Valid) && (item.BirthDate.ValidMonth == true) && (item.BirthDate.ValidDay == true))
            group item by(item.BirthDate.GetMonthDay) into g
            select new { GroupName = g.Key, Items = g };

            foreach (var g in query)
            {
                CardGroup info = new CardGroup
                {
                    Title = g.GroupName.ToString("MMMM dd", CultureInfo.CurrentCulture.DateTimeFormat),
                };

                foreach (var item in g.Items)
                {
                    info.Add(item.HLink);
                }

                t.Add(info);
            }

            return(t);
        }
Esempio n. 13
0
        public CardGroup GetAllAsGroupedSurnameCardGroup()
        {
            CardGroup t = new CardGroup();

            var query = from item in DataViewData
                        orderby item.GPersonNamesCollection.GetPrimaryName.DeRef.SortName
                        group item by(item.GPersonNamesCollection.GetPrimaryName.DeRef.GSurName.GetPrimarySurname) into g
                        select new { GroupName = g.Key, Items = g };

            foreach (var g in query)
            {
                CardGroup info = new CardGroup
                {
                    Title = g.GroupName,
                };

                foreach (var item in g.Items)
                {
                    info.Add(item.HLink);
                }

                t.Add(info);
            }

            return(t);
        }
Esempio n. 14
0
        /// <summary>
        /// Checks if specific omaha hole cards pass the filter
        /// </summary>
        /// <param name="cards">omaha hole cards</param>
        /// <param name="collection">collection of items that contains filter description</param>
        /// <returns></returns>
        public static bool CheckOmahaHoleCards(string cards, IEnumerable <OmahaHandGridItem> collection)
        {
            var cardsList = CardGroup.Parse(cards);
            var analyzers = OmahaHoleCardsAnalyzer.GetDefaultOmahaHoleCardsAnalyzers();

            return(collection.All(item => analyzers.First(a => a.GetRank() == item.HoleCards).Analyze(cardsList, item)));
        }
Esempio n. 15
0
    public Dictionary <CardGroup, List <Card> > RandomlyAssignCardsToGroups()
    {
        Dictionary <CardGroup, List <Card> > groupsOfCards = new Dictionary <CardGroup, List <Card> >();

        CardGroup[] groups            = isOpponent ? CardGroup.OpponentGroups() : CardGroup.PlayerGroups();
        List <Card> copyOfCardsInHand = cardsInHand.ToList();

        foreach (CardGroup group in groups)
        {
            groupsOfCards.Add(group, new List <Card>());

            List <Card> cardsNotWizard = copyOfCardsInHand.Where(card => !card.cardData.IsWizard).ToList();
            Card        randomCard     = cardsNotWizard[Random.Range(0, cardsNotWizard.Count)];

            groupsOfCards[group].Add(randomCard);
            copyOfCardsInHand.Remove(randomCard);
        }

        foreach (Card card in copyOfCardsInHand)
        {
            CardGroup randomGroup;

            do
            {
                randomGroup = groups[Random.Range(0, groups.Length)];
            } while (!CardGroup.IsValidForGroup(groupsOfCards[randomGroup], card).Item1);

            groupsOfCards[randomGroup].Add(card);
        }

        return(groupsOfCards);
    }
Esempio n. 16
0
        public CardGroup GetGroup(int id)
        {
            _logger.Info($"[GroupFacade] The group of words with id = {id} was requestet ");
            var resultGroup = new CardGroup();

            var mainCard = new Card(_dictionaryRepository.GetById(id));

            if (mainCard == null)
            {
                _logger.Error($"[GroupFacade] Main card is null with groupId {id}");
                throw new ArgumentException();
            }
            var mainCardList = new List <Card> {
                mainCard
            };
            var additionald = _cardGroupRepository.GetAdditionalCards(mainCard.Id);

            for (var i = 0; i < additionald.Count; i++)
            {
                var temp = new Card(_dictionaryRepository.GetById(additionald[i]));
                mainCardList[i].AdditinalWord = temp.RussianValue;
                if (i == additionald.Count - 1)
                {
                    temp.AdditinalWord = mainCardList[i].RussianValue;
                }
                mainCardList.Add(temp);
            }
            resultGroup.Id    = mainCard.Id;
            resultGroup.Cards = mainCardList;
            return(resultGroup);
        }
Esempio n. 17
0
        public void SetUp()
        {
            _handHistory = new HandHistory()
            {
                ComumnityCards =
                    BoardCards.ForFlop(new Card(5), new Card(14), new Card(40)),
                DateOfHandUtc        = new DateTime(2012, 3, 20, 12, 30, 44),
                DealerButtonPosition = 5,
                FullHandHistoryText  = "some hand text",
                GameDescription      =
                    new GameDescriptor(PokerFormat.CashGame,
                                       SiteName.Values.PartyPoker,
                                       GameType.NoLimitHoldem,
                                       Limit.FromSmallBlindBigBlind(10, 20, Currency.USD),
                                       TableType.FromTableTypeDescriptions(TableTypeDescription.Regular),
                                       SeatType.FromMaxPlayers(6)),
                HandActions = new List <HandAction>()
                {
                    new HandAction("Player1", HandActionType.POSTS, 0.25m, Street.Preflop)
                },
                HandId           = 141234124,
                NumPlayersSeated = 2,
                Players          = new PlayerList()
                {
                    new Player("Player1", 1000, 1),
                    new Player("Player2", 300, 5),
                },
                TableName = "Test Table",
            };
            _handHistory.Players[0].HoleCards = new HoleCards(CardGroup.Parse("Ac Ad"));
            _handHistory.Players[1].HoleCards = new HoleCards(CardGroup.Parse("Kh Qs"));

            BsonSerializer.RegisterSerializationProvider(new TestSerializationProvider());
        }
Esempio n. 18
0
        /// <summary>
        /// Handles navigation in wards and sets up the event model parameter.
        /// </summary>
        /// <param name="e">
        /// The <see cref="NavigatedToEventArgs"/> instance containing the event data.
        /// </param>
        /// <param name="viewModelState">
        /// The parameter is not used.
        /// </param>
        public override void PopulateViewModel()
        {
            TagObject = DV.TagDV.GetModelFromHLinkString(BaseNavParamsHLink.HLinkKey);

            if (!(TagObject is null))
            {
                BaseTitle     = "Tag Detail";
                BaseTitleIcon = CommonConstants.IconTag;

                // Get Headers
                CardGroup t = new CardGroup {
                    Title = "Header Details"
                };

                t.Add(new CardListLineCollection
                {
                    new CardListLine("Card Type:", "Tag Detail"),
                    new CardListLine("Name:", TagObject.GName),
                    new CardListLine("Priority:", TagObject.GPriority.ToString(System.Globalization.CultureInfo.CurrentCulture)),
                    new CardListLine("Private:", TagObject.PrivAsString),
                });

                t.Add(DV.TagDV.GetModelInfoFormatted(TagObject));

                BaseDetail.Add(t);

                // Add Details
                BaseDetail.Add(TagObject.BackHLinkReferenceCollection.GetCardGroup()); // TODO , "BackLinks");
            }

            return;
        }
        // TODO Fix this so that it is returned without calling the routine

        public CardGroup GetCardGroup1()
        {
            CardGroup t = new CardGroup
            {
                Title = "Person Names",
            };

            foreach (PersonNameModel item in Items)
            {
                t.Add(item);

                if (item.GCitationRefCollection.Count > 0)
                {
                    foreach (HLinkCitationModel citem in item.GCitationRefCollection)
                    {
                        t.Add(citem);
                    }
                }

                if (item.GNoteReferenceCollection.Count > 0)
                {
                    foreach (HLinkNoteModel nitem in item.GNoteReferenceCollection)
                    {
                        t.Add(nitem);
                    }
                }
            }

            return(t);
        }
        /// <summary>
        /// Handles navigation inwards and sets up the repository model parameter.
        /// </summary>
        public override void PopulateViewModel()
        {
            RepositoryObject = DV.RepositoryDV.GetModelFromHLink(BaseNavParamsHLink);

            if (!(RepositoryObject == null))
            {
                BaseTitle     = RepositoryObject.GetDefaultText;
                BaseTitleIcon = CommonConstants.IconRepository;

                // Get basic details
                CardGroup t = new CardGroup {
                    Title = "Header Details"
                };

                t.Add(new CardListLineCollection
                {
                    new CardListLine("Card Type:", "Repository Detail"),
                    new CardListLine("Name:", RepositoryObject.GRName),
                    new CardListLine("Type:", RepositoryObject.GType),
                });

                t.Add(DV.RepositoryDV.GetModelInfoFormatted(RepositoryObject));

                BaseDetail.Add(t);

                // Add details
                BaseDetail.Add(RepositoryObject.GNoteRefCollection.GetCardGroup());
                BaseDetail.Add(RepositoryObject.GTagRefCollection.GetCardGroup());
                BaseDetail.Add(RepositoryObject.GAddress.GetCardGroup());
                BaseDetail.Add(RepositoryObject.GURL);
                BaseDetail.Add(RepositoryObject.BackHLinkReferenceCollection.GetCardGroup());
            }
        }
Esempio n. 21
0
        public override CardGroup GetCardGroup()
        {
            CardGroup t = base.GetCardGroup();

            t.Title = Title;

            return(t);
        }
Esempio n. 22
0
    private void PlayExchange()
    {
        float pacentP = PlayerManager.Instance.persent_HP / PlayerManager.Instance.HP;
        float pacentE = GameObject.FindGameObjectWithTag("boss").GetComponent <Lucyfa>().Present_HP / GameObject.FindGameObjectWithTag("boss").GetComponent <Lucyfa>().HP
                        GameObject.FindGameObjectWithTag("boss").GetComponent <Lucyfa>().Present_HP = GameObject.FindGameObjectWithTag("boss").GetComponent <Lucyfa>().HP *pacentP;

        PlayerManager.Instance.persent_HP = PlayerManager.Instance.HP * pacentE;
        CardGroup.remove(9);
    }
        /// <summary>
        /// Populates the view ViewModel.
        /// </summary>
        /// <returns>
        /// </returns>
        public override void PopulateViewModel()
        {
            BaseCL.LogRoutineEntry("AddressDetailViewModel");

            AddressObject = DV.AddressDV.GetModelFromHLink(BaseNavParamsHLink);

            if (AddressObject.Valid)
            {
                BaseTitle = AddressObject.GetDefaultText;

                // Get media image
                HLinkHomeImageModel AddressImage = AddressObject.HomeImageHLink;
                AddressImage.CardType = DisplayFormat.MediaCardLarge;
                BaseDetail.Add(AddressImage);

                // Get Header Details
                CardGroup headerCardGroup = new CardGroup {
                    Title = "Address Details"
                };

                // Get the Name Details
                CardListLineCollection nameDetails = new CardListLineCollection
                {
                    new CardListLine("Card Type:", "Address Detail"),

                    new CardListLine("Street:", AddressObject.GStreet),
                    new CardListLine("City:", AddressObject.GCity),
                    new CardListLine("Locality:", AddressObject.GLocality),
                    new CardListLine("County:", AddressObject.GCounty),
                    new CardListLine("State:", AddressObject.GState),
                    new CardListLine("Country:", AddressObject.GCountry),

                    new CardListLine("Date:", AddressObject.GDate.ShortDate),
                    new CardListLine("Postal:", AddressObject.GPostal),
                    new CardListLine("Phone:", AddressObject.GPhone),
                };

                headerCardGroup.Add(nameDetails);

                // Add Standard details
                headerCardGroup.Add(DV.PersonDV.GetModelInfoFormatted(AddressObject));

                // Add map card
                headerCardGroup.Add(TurnAddressToURLModel());

                // Add header
                BaseDetail.Add(headerCardGroup);

                BaseDetail.Add(AddressObject.GCitationRefCollection.GetCardGroup());
                BaseDetail.Add(AddressObject.GNoteRefCollection.GetCardGroup());

                BaseDetail.Add(AddressObject.BackHLinkReferenceCollection.GetCardGroup());
            }

            return;
        }
Esempio n. 24
0
        public static CardGroupDTO ToDTO(this CardGroup cardGroup)
        {
            var groupDto = GroupToDto.Map <CardGroup, CardGroupDTO>(cardGroup);

            foreach (var card in cardGroup.CardSet)
            {
                groupDto.CardDtoSet.Add(ToDTO(card));
            }
            return(groupDto);
        }
Esempio n. 25
0
        /// <summary>
        /// Gets header as card group.
        /// </summary>
        /// <returns>
        /// CardGroup
        /// </returns>
        /// <remarks>
        /// Assume sonly one header as per the spec.
        /// </remarks>
        public override CardGroup GetAllAsCardGroup()
        {
            CardGroup t = new CardGroup();

            t.Add(HeaderDataModel);

            // Sort TODO Sort t = HLinkCollectionSort(t);

            return(t);
        }
Esempio n. 26
0
        private void AddNewCardList()
        {
            CardGroup newCardGroup = new CardGroup();


            Task.Run(async() =>
            {
                await cardGroupService.AddNewCardGroupAsync(newCardGroup);
            });
        }
Esempio n. 27
0
        public void OmahaEquityCalcTest(string boardCards, bool isHiLo, float[] equity)
        {
            BoardCards board = BoardCards.FromCards(boardCards);
            var        cards = GetHoleCards().Select(x => CardGroup.Parse(x).Select(c => c.ToString()).ToArray()).ToArray();
            OmahaEquityCalculatorMain calc = new OmahaEquityCalculatorMain(true, isHiLo);

            var result = calc.Equity(board.Select(x => x.ToString()).ToArray(), cards, new string[] { }, 0);

            var i = 0;
        }
Esempio n. 28
0
    public void refreshHandCardGroup(CardGroup model)
    {
        int index = hasHandCardGroup(model.Cards[3]);

        if (index != -1)
        {
            mHandCardGroups[index].Cards         = model.Cards;
            mHandCardGroups[index].CardGroupType = model.CardGroupType;
        }
    }
Esempio n. 29
0
        /// <summary>
        /// Calculates equity for the specified player if possible
        /// </summary>
        /// <param name="equityPlayers">Players to calculate equity</param>
        /// <param name="handHistory">Hand history</param>
        private void CalculateEquity(List <EquityPlayer> equityPlayers, List <EquityPlayer> mainPotPlayers, HandHistory handHistory, GeneralGameTypeEnum gameType, int potIndex)
        {
            var playersByName = handHistory.Players
                                .GroupBy(x => x.PlayerName)
                                .ToDictionary(x => x.Key, x => x.FirstOrDefault());

            // equity can be calculated only for player who didn't fold, whose last action was before river, whose hole cards are known
            var eligibleEquityPlayers = equityPlayers
                                        .Where(x => x.LastAction.Street != Street.River &&
                                               !x.LastAction.IsFold &&
                                               playersByName.ContainsKey(x.Name) && playersByName[x.Name].hasHoleCards)
                                        .ToList();

            // equity can't be calculated for single player
            if (eligibleEquityPlayers.Count < 2)
            {
                return;
            }

            // set known hole cards
            eligibleEquityPlayers.ForEach(p => p.HoleCards = playersByName[p.Name].HoleCards);

            try
            {
                var street = eligibleEquityPlayers.Select(x => x.LastAction.Street).Distinct().Max();

                var boardCards = CardHelper.IsStreetAvailable(handHistory.CommunityCards.ToString(), street)
                     ? handHistory.CommunityCards.GetBoardOnStreet(street)
                     : handHistory.CommunityCards;

                var deadCards = mainPotPlayers.Except(equityPlayers).Where(x => x.HoleCards != null).SelectMany(x => x.HoleCards).ToArray();

                if (handHistory.GameDescription.TableType.Contains(HandHistories.Objects.GameDescription.TableTypeDescription.ShortDeck))
                {
                    deadCards = deadCards.Concat(CardGroup.GetDeadCardsForHoldem6Plus()).ToArray();
                }

                if (pokerEvalLibLoaded)
                {
                    CalculateEquity(eligibleEquityPlayers, street, boardCards, deadCards, gameType, potIndex);
                }
                else if (gameType == GeneralGameTypeEnum.Holdem)
                {
                    CalculateHoldemEquity(eligibleEquityPlayers, street, boardCards, deadCards, potIndex);
                }
                else
                {
                    CalculateOmahaEquity(eligibleEquityPlayers, street, boardCards, gameType == GeneralGameTypeEnum.OmahaHiLo, potIndex);
                }
            }
            catch (Exception e)
            {
                LogProvider.Log.Error(this, $"Could not calculate equity for hand #{handHistory.HandId}", e);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Populate the Hub View.
        /// </summary>
        public override async Task <bool> PopulateViewModelAsync()
        {
            // Get Header CardLarge
            HLinkHeaderModel HeaderCard = DV.HeaderDV.HeaderDataModel.HLink;

            HeaderCard.CardType = DisplayFormat.HeaderCardLarge;
            BaseDetail.Add(HeaderCard);

            HLinkMediaModel HeroImage = DV.MediaDV.GetRandomFromCollection(null);

            HeroImage.CardType = DisplayFormat.MediaCardLarge;
            BaseDetail.Add(HeroImage);

            if (HeroImage == null)
            {
                DataStore.CN.NotifyAlert("No images found in this data.  Consider adding some.");
            }

            // Setup ToDo list
            ObservableCollection <NoteModel> t = DV.NoteDV.GetAllOfType(NoteModel.GTypeToDo);

            CardGroup temp = new CardGroup();

            foreach (NoteModel item in t)
            {
                temp.Add(item.HLink);
            }

            temp.Title = "ToDo list";
            BaseDetail.Add(temp);

            // Setup Latest Changes list

            // TODO fix this LatestChanges.Add(DV.BookMarkDV.GetLatestChanges());

            BaseDetail.Add(DV.CitationDV.GetLatestChanges());

            BaseDetail.Add(DV.EventDV.GetLatestChanges());

            BaseDetail.Add(DV.FamilyDV.GetLatestChanges());

            BaseDetail.Add(DV.MediaDV.GetLatestChanges());

            BaseDetail.Add(DV.NoteDV.GetLatestChanges());

            BaseDetail.Add(DV.PersonDV.GetLatestChanges());

            BaseDetail.Add(DV.PlaceDV.GetLatestChanges());

            BaseDetail.Add(DV.SourceDV.GetLatestChanges());

            BaseDetail.Add(DV.TagDV.GetLatestChanges());

            return(true);
        }
Esempio n. 31
0
 public static CardGroup SaveCardGroup(CardGroup @group)
 {
   using (ICardRepository cardRepository = new CardRepository())
   {
     cardRepository.AttachEntityIfChangeTrackingDisabled(cardRepository.ObjectContext.CardGroups, @group);
     cardRepository.ApplyChanges(cardRepository.ObjectContext.CardGroups, @group);
     cardRepository.UnitOfWork.SaveChanges();
     @group.AcceptChanges();
     return @group;
   }  
 }