public void Rule_CheckPut_場あり_1枚() { _ctx._history.Clear(); _ctx._history.Add(new HE_PutCards(0, DeckGenerator.Generate(Suit.HRT, 3).ToArray())); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.CLB, 4)); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 3), SimplestRule.ERR_NOT_STRONG); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.JKR, 0)); }
public void Rule_CheckPut_場あり_2枚() { _ctx._history.Clear(); _ctx._history.Add(new HE_PutCards(0, DeckGenerator.Generate(Suit.DIA, 4, Suit.SPD, 4).ToArray())); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.CLB, 5, Suit.SPD, 5)); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.JKR, 0, Suit.SPD, 5)); // ジョーカーまじり _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 4, Suit.SPD, 4), SimplestRule.ERR_NOT_STRONG); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 5), SimplestRule.ERR_COUNT_DOESNT_MATCH); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.JKR, 0), SimplestRule.ERR_COUNT_DOESNT_MATCH); }
public void Rule_CheckPut_場あり革命中_1枚() { _ctx._history.Clear(); _ctx._history.Add(new HE_PutCards(0, DeckGenerator.Generate(Suit.CLB, 5).ToArray())); _ctx.IsKakumei = true; _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.CLB, 4)); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 5), SimplestRule.ERR_NOT_STRONG); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 6), SimplestRule.ERR_NOT_STRONG); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 2), SimplestRule.ERR_NOT_STRONG); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.JKR, 0)); }
public void Generate() { var deckGenerator = new DeckGenerator(); var cards = deckGenerator.Generate(); Assert.AreEqual(4, cards.Select(x => x.Suit).Distinct().Count()); Assert.AreEqual(13, cards.Where(x => x.Suit == "Clubs").Select(x => x.Rank).Distinct().Count()); Assert.AreEqual(13, cards.Where(x => x.Suit == "Diamonds").Select(x => x.Rank).Distinct().Count()); Assert.AreEqual(13, cards.Where(x => x.Suit == "Hearts").Select(x => x.Rank).Distinct().Count()); Assert.AreEqual(13, cards.Where(x => x.Suit == "Spades").Select(x => x.Rank).Distinct().Count()); }
public void Rule_CheckPut_場あり革命中_2枚() { _ctx._history.Clear(); _ctx._history.Add(new HE_PutCards(0, DeckGenerator.Generate(Suit.DIA, 2, Suit.SPD, 2).ToArray())); _ctx.IsKakumei = true; _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.CLB, 1, Suit.SPD, 1)); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.CLB, 3, Suit.SPD, 3)); _assertCheckPutCardsIsOK(DeckGenerator.Generate(Suit.CLB, 3, Suit.JKR, 0)); // ジョーカーまじり _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 2, Suit.DIA, 2), SimplestRule.ERR_NOT_STRONG); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 2, Suit.JKR, 2), SimplestRule.ERR_NOT_STRONG); // ジョーカーまじり _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.CLB, 5), SimplestRule.ERR_COUNT_DOESNT_MATCH); _assertCheckPutCardsIsNG(DeckGenerator.Generate(Suit.JKR, 0), SimplestRule.ERR_COUNT_DOESNT_MATCH); }
private void DrawHand() { m_generator.Generate(); m_currentHand = m_generator.GetHand(); m_currentAvailableCarriages = new List <Carriage>(); for (int i = 0; i < m_currentHand.Count; i++) { Carriage carriage = CreateCarriage(m_currentHand[i]); carriage.OnSelect += OnCarriageSelected; carriage.transform.SetParent(m_carriageContainer); m_currentAvailableCarriages.Add(carriage); } m_carriageContainer.GetComponent <CarriageMenu>().Init(); }
public void Card_FromCardString() { var test = DeckGenerator.Generate( Suit.CLB, 5, Suit.DIA, 7, Suit.JKR, 0, Suit.SPD, 1, Suit.SPD, 13, Suit.HRT, 11, Suit.HRT, 12 ); string[] str = new[] { "C5", "D7", "JK", "SA", "SK", "HJ", "HQ" }; for (int i = 0; i < str.Length; i++) { Assert.AreEqual(test.ElementAt(i), Card.FromString(str[i])); } }
public override void OnInspectorGUI() { DeckGenerator deck = (DeckGenerator)target; if (DrawDefaultInspector()) { } if (GUILayout.Button("Generate")) { deck.ConstructDeck(); deck.Generate(); } if (GUILayout.Button("Shuffle")) { deck.Shuffle(); } }
public void Rule_CanAgari_革命中() { _ctx.IsKakumei = true; Assert.AreEqual(CheckResults.Ok, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.CLB, 2))); Assert.AreEqual(CheckResults.Ok, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.JKR, 0, Suit.DIA, 1))); Assert.AreEqual(CheckResults.Ok, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.HRT, 4, Suit.JKR, 0, Suit.DIA, 4))); // 階段 Assert.AreEqual(CheckResults.Ok, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.HRT, 6, Suit.HRT, 4, Suit.HRT, 5))); Assert.AreEqual(CheckResults.Ok, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.DIA, 5, Suit.JKR, 0, Suit.DIA, 4, Suit.DIA, 6))); Assert.AreEqual(CheckResults.Ok, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.DIA, 2, Suit.DIA, 1, Suit.DIA, 13))); // ジョーカー Assert.AreEqual(KaidanRule.ERROR_JOKER_AGARI, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.JKR, 0))); Assert.AreEqual(KaidanRule.ERROR_JOKER_AGARI, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.JKR, 0, Suit.JKR, 0))); // 3あがり Assert.AreEqual(KaidanRule.ERROR_2_AGARI, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.HRT, 3))); Assert.AreEqual(KaidanRule.ERROR_2_AGARI, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.DIA, 3, Suit.SPD, 3))); Assert.AreEqual(KaidanRule.ERROR_2_AGARI, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.DIA, 3, Suit.JKR, 0, Suit.CLB, 3))); // 3を含む階段 Assert.AreEqual(KaidanRule.ERROR_2_AGARI, _rule.CanAgari(_ctx, DeckGenerator.Generate(Suit.CLB, 4, Suit.CLB, 5, Suit.CLB, 3))); }
public void Card_FromCardsetString() { var test = DeckGenerator.Generate( Suit.CLB, 5, Suit.DIA, 7, Suit.JKR, 0, Suit.SPD, 1, Suit.SPD, 13, Suit.HRT, 11, Suit.HRT, 12 ); string str = "CA C5 D7 JK SA SK HJ HQ"; var ret = DeckGenerator.FromCardsetString(str, 2); Assert.AreEqual(test.Count(), ret.Count()); for (int i = 0; i < test.Count(); i++) { Assert.AreEqual(test.ElementAt(i), ret.ElementAt(i)); } }
public void Rule_CheckPut_場あり_パス() { _ctx._history.Clear(); _ctx._history.Add(new HE_PutCards(0, DeckGenerator.Generate(Suit.JKR, 03).ToArray())); _assertCheckPutCardsIsOK(new Card[] { }); }