public override int CompareToOffsuitHand(OffsuitHandBase other) { var otherHighCard = other as HighCard; if (otherHighCard == null) { return(HandRank.CompareTo(other.HandRank)); } if (Card1 != otherHighCard.Card1) { return(Card1.CompareTo(otherHighCard.Card1)); } if (Card2 != otherHighCard.Card2) { return(Card2.CompareTo(otherHighCard.Card2)); } if (Card3 != otherHighCard.Card3) { return(Card3.CompareTo(otherHighCard.Card3)); } if (Card4 != otherHighCard.Card4) { return(Card4.CompareTo(otherHighCard.Card4)); } return(Card5.CompareTo(otherHighCard.Card5)); }
/**************************************************************************************** * Method: ShuffleButton_Click() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: disable shuffle button, for loop to choose new cards, while loop to * ensure no two cards chosen are the same, displays cards to the screen. * Input(s)/Output(s): No inputs, outputs new cards to the screen. * *************************************************************************************/ private void ShuffleButton_Click(object sender, RoutedEventArgs e) { // Disable the Shuffle Button so it cannot be clicked twice. ShuffleButton.IsEnabled = false; // Advise the user to choose a card WinText.Text = "Choose a card"; // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } // While loop to ensure no duplicate cards are chosen while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2]) { // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } } // Display the cards Card1.DisplayCard(Cards[0]); Card2.DisplayCard(Cards[1]); Card3.DisplayCard(Cards[2]); }
private void Start_Click(object sender, RoutedEventArgs e) { StatusMessage.Text = "Choose a card"; PickCard1.IsEnabled = true; PickCard2.IsEnabled = true; PickCard3.IsEnabled = true; Shuffle.IsEnabled = true; for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(2, 14); Cards[i] = CardValue; } while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2]) { for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(2, 14); Cards[i] = CardValue; } } Card1.DisplayCard(Cards[0]); Card2.DisplayCard(Cards[1]); Card3.DisplayCard(Cards[2]); }
public void MoveState(int index) { GameObject Card1; GameObject Card2; if (State == "Inicial") { baraja[index].GetComponent <Cardscript>().Toggle(); CardsUp[0] = index; State = "carta_descubierta"; } else if (State == "carta_descubierta" && CardsUp[0] != index) { baraja[index].GetComponent <Cardscript>().Toggle(); CardsUp[1] = index; Card1 = baraja[CardsUp[0]]; Card2 = baraja[CardsUp[1]]; if ((Card1.GetComponent <Cardscript>().Value) == (Card2.GetComponent <Cardscript>().Value)) { Debug.Log("Las cartas son pareja."); parejas++; Marcador.GetComponent <Text>().text = "Parejas " + parejas; //Desactivar las cartas baraja[CardsUp[0]].gameObject.SetActive(false); baraja[CardsUp[1]].gameObject.SetActive(false); State = "Inicial"; if (parejas == 5) { Marcador.GetComponent <Text>().text = "Fin del Juego"; } else { Marcador.GetComponent <Text>().text = "Parejas " + parejas; } } //NO ACIERTO else { //baraja[CardsUp[1]].GetComponent<Cardscript>().Toggle(); baraja[CardsUp[0]].GetComponent <Cardscript>().Toggle(); baraja[CardsUp[1]].GetComponent <Cardscript>().Toggle(); State = "Inicial"; //Dar la vuelta a las cartas. } } }
public static bool operator !=(Card Card1, Card Card2) { if (Card1.IsValid() && Card2.IsValid()) { if (Card1.Mask != Card2.Mask) { return(true); } } return(false); }
public void Open() { GetComponent <CardManagerScr>().Box1(); Bground.SetActive(false); Bgroundopen.SetActive(true); TempCard = new List <Card>(); for (int i = 0; i < 6; i++) { TempCard.Add(CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]); } //card1 = CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]; card1 = TempCard[0]; Card1 = Instantiate(cardpref, CardField1, false); Card1.GetComponent <CardInfoScr>().ShowCardInfo(card1); // GetComponent<SaveScript>().CollectionCardTemp.Add(card1); // Debug.Log(GetComponent<SaveScript>().sv.CollectionCard.Count); //card2 = CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]; card2 = TempCard[1]; Card2 = Instantiate(cardpref, CardField2, false); Card2.GetComponent <CardInfoScr>().ShowCardInfo(card2); // GetComponent<SaveScript>().CollectionCardTemp.Add(card2); //card3 = CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]; card3 = TempCard[2]; Card3 = Instantiate(cardpref, CardField3, false); Card3.GetComponent <CardInfoScr>().ShowCardInfo(card3); // GetComponent<SaveScript>().CollectionCardTemp.Add(card3); //card4 = CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]; card4 = TempCard[3]; Card4 = Instantiate(cardpref, CardField4, false); Card4.GetComponent <CardInfoScr>().ShowCardInfo(card4); // GetComponent<SaveScript>().CollectionCardTemp.Add(card4); //card5 = CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]; card5 = TempCard[4]; Card5 = Instantiate(cardpref, CardField5, false); Card5.GetComponent <CardInfoScr>().ShowCardInfo(card5); // GetComponent<SaveScript>().CollectionCardTemp.Add(card5); //card6 = CardManager.AllCards[Random.Range(0, CardManager.AllCards.Count)]; card6 = TempCard[5]; Card6 = Instantiate(cardpref, CardField6, false); Card6.GetComponent <CardInfoScr>().ShowCardInfo(card6); // GetComponent<SaveScript>().CollectionCardTemp.Add(card6); // GetComponent<SaveScript>().SaveData(); }
private void DisplayCards() { Card1.DisplayCard(game.PlayerHand[0].CardName); Card2.DisplayCard(game.PlayerHand[1].CardName); Card3.DisplayCard(game.PlayerHand[2].CardName); upFaced.DisplayCard(game.upFacedCard.CardName); Card4.DisplayCard(game.ComputerHand[0].CardName); Card5.DisplayCard(game.ComputerHand[1].CardName); Card6.DisplayCard(game.ComputerHand[2].CardName); }
private void DisplayCards() { Card1.DisplayCard(game.PlayerHand[0].CardName); Card2.DisplayCard(game.PlayerHand[1].CardName); Card3.DisplayCard(game.PlayerHand[2].CardName); Card4.DisplayCard(game.PlayerHand[3].CardName); Card5.DisplayCard(game.PlayerHand[4].CardName); Card6.DisplayCard(game.PlayerHand[5].CardName); Card7.DisplayCard(game.PlayerHand[6].CardName); Card8.DisplayCard(game.PlayerHand[7].CardName); UpCard.DisplayCard(game.upFacedCard.CardName); BackCard.DisplayCard("DC"); }
private void ShowCards() { Card1.DisplayCards(0); Card2.DisplayCards(1); Card3.DisplayCards(2); compCard1.DisplayCards(3); compCard2.DisplayCards(3); compCard3.DisplayCards(3); compCard1.IsEnabled = false; compCard2.IsEnabled = false; compCard3.IsEnabled = false; }
private void SetupGame() { Start.IsEnabled = true; PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; Card1.DisplayCard(1); Card2.DisplayCard(1); Card3.DisplayCard(1); PlayerCard.DisplayCard(1); CPUCard.DisplayCard(1); StatusMessage.Text = "Press Start!"; }
private void PickCard3_Click(object sender, RoutedEventArgs e) { PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; PlayerCard.DisplayCard(Cards[2]); Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); int PlayerIndex = Cards[2]; GameRules(PlayerIndex); }
public void OnHideShowCardsEventHandler() { if (HideToggleButtonText == "Hide") { Card1.SetVisible(false); Card2.SetVisible(false); HideToggleButtonText = "Show"; } else if (HideToggleButtonText == "Show") { Card1.SetVisible(true); Card2.SetVisible(true); HideToggleButtonText = "Hide"; } base.StateHasChanged(); }
/**************************************************************************************** * Method: SetupGame() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: This method enables/disables starting buttons, sets up the backs of the * cards, and tells the user to press the start button. * Input(s)/Output(s): No inputs, outputs a card picture and a message to the screen. * *************************************************************************************/ private void SetupGame() { // Ensure only the start game button is waiting to be pressed StartGameButton.IsEnabled = true; PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; ShuffleButton.IsEnabled = false; // Start the game seeing the backs of the cards Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); ChosenCard.DisplayCard(14); OpponentCard.DisplayCard(14); // Notify User to press Start Game Button WinText.Text = "Click The Start Game Button!"; PlayerScoreText.Text = $"Player Score: {PlayerScore}"; OpponentScoreText.Text = $"Opponent Score: {OpponentScore}"; }
/**************************************************************************************** * Method: Start_Click() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: Display the back of cards, enable buttons, for loop to pick new cards, * while loop to ensure no two cards picked were the same, output cards to the screen. * Input(s)/Output(s): No inputs, removes text message, enables buttons, outputs new * cards to the screen. * *************************************************************************************/ private void Start_Click(object sender, RoutedEventArgs e) { // Set the text of the start Game Button back to "Start Game" and clear the Card Value text Box StartGameButton.Content = "Start Game"; CardValueText.Text = "Card Value = "; // Start the game seeing the backs of the cards ChosenCard.DisplayCard(14); OpponentCard.DisplayCard(14); // Advise the user to choose a card WinText.Text = "Choose a card"; // Enable the game buttons PickCard1.IsEnabled = true; PickCard2.IsEnabled = true; PickCard3.IsEnabled = true; ShuffleButton.IsEnabled = true; // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } // While loop to ensure no duplicate cards are chosen while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2]) { // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } } // Display Cards Card1.DisplayCard(Cards[0]); Card2.DisplayCard(Cards[1]); Card3.DisplayCard(Cards[2]); }
/**************************************************************************************** * Method: PickCard3Button_Click() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: Disables buttons, puts chosen card in box, changes 3 cards to display * the back of the card, runs the ApplyGameRules() method. * Input(s)/Output(s): Input - button is clicked, Output: Back of cards displayed, chosen * card is placed in ChosenCard Box. * *************************************************************************************/ private void PickCard3Button_Click(object sender, RoutedEventArgs e) { // Disable other buttons once a card has been chosen PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; ShuffleButton.IsEnabled = false; // Put chosen card in the Chosen Card box ChosenCard.DisplayCard(Cards[2]); // Show the back of cards in the 3 upper boxes Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); // Player Index Chosen int PlayerIndex = Cards[2]; // Run the rules of the game ApplyGameRules(PlayerIndex); }
public bool IsValid() { if (Street < 1 || Street > 3) { return(false); } if (Street == 1) { return(Card1.IsValid() && Card2.IsValid() && Card3.IsValid()); } if (Street == 2) { return(Card1.IsValid() && Card2.IsValid() && Card3.IsValid() && Card4.IsValid()); } if (Street == 3) { return(Card1.IsValid() && Card2.IsValid() && Card3.IsValid() && Card4.IsValid() && Card5.IsValid()); } return(false); }
public void AddCardInCardComparison(Card2 card2) { cardComparison.Add(card2); }
private void DisplayCards() { Card1.DisplayCard($"{game.PlayerCards[0]}C"); Card2.DisplayCard($"{game.PlayerCards[1]}C"); Card3.DisplayCard($"{game.PlayerCards[2]}C"); }
public bool IsValid() { return(Card1.IsValid() && Card2.IsValid()); }
private void DisplayCards() { Card1.DisplayCard(game.PlayerCards[0]); Card2.DisplayCard(game.PlayerCards[1]); Card3.DisplayCard(game.PlayerCards[2]); }