public void Reset() { hand = new List <Karta>(); remainingCards = new CardCounter(); remainingCards.hand = hand; kupio = false; kupioKaznene = false; return; }
public ulong key() { ulong ret = 0; ret += counter.key() * 10000000000; foreach (Karta k in hand) { ret += CardCounter.brojToNumber(k.Broj) * 100 * ((uint)Math.Pow(100, ((uint)((int)k.Boja)))); } if (penalty) { ret += 10000000000000000000; } return(ret); }
public Board(Board board, IMove move) : this() { counter = new CardCounter(board.counter); talon = move; enemyHand = board.enemyHand; this.hand = new List <Karta>(board.hand); if (board.yourTurn) { foreach (Karta k in move.Karte) { hand.Remove(k); } } else { foreach (Karta k in move.Karte) { counter.remove(k); } enemyHand--; } if (move.Tip == TipPoteza.BacaKartu && move.Karte.Last().Broj == "7") { penalty = true; } else { penalty = false; } if (move.Tip == TipPoteza.BacaKartu && (move.Karte.Last().Broj == "A" || move.Karte.Last().Broj == "8")) { yourTurn = board.yourTurn; } else { yourTurn = !board.yourTurn; } }
public CardCounter(CardCounter copy) { Suits = new List <Karta> [4]; Numbers = new List <Karta> [13]; for (int i = 0; i < 4; i++) { Suits[i] = new List <Karta>(); Suits[i].AddRange(copy.Suits[i]); } for (int i = 0; i < 13; i++) { Numbers[i] = new List <Karta>(); Numbers[i].AddRange(copy.Numbers[i]); } numOfRemCard = 52; numOfRemCard = copy.numOfRemCard; hand = new List <Karta>(); if (copy.hand != null && copy.hand.Count > 0) { hand.AddRange(copy.hand); } }
public Board(IMove lastMove, bool turn, List <Karta> yourHand, int enemy, CardCounter used, bool kaznene) : this() { lock (Gilgamesh._locker) { counter = new CardCounter(used); talon = lastMove; hand = new List <Karta>(yourHand); /* * if (yourHand != null && yourHand.Count > 0) * { * hand.AddRange(yourHand); * }*/ enemyHand = enemy; counter.remove(lastMove.Karte); yourTurn = turn; if (lastMove.Tip == TipPoteza.BacaKartu && lastMove.Karte.Count > 0 && (lastMove.Karte.Last().Broj == "7" || (lastMove.Karte.Last().Broj == "2" && lastMove.Karte.Last().Boja == Boja.Tref)) && !kaznene) { penalty = true; } } }