Exemple #1
0
 private void DestinationSelectButton2Click(object sender, EventArgs e)
 {
     SelectedCard      = _destination2;
     SelectedCardIndex = 1;
     DialogResult      = DialogResult.OK;
     Close();
 }
Exemple #2
0
 private void DestinationSelectButton3Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(DestinationTextBox3.Text))
     {
         DestinationTextBox3.Text      = _destination3.ToString();
         DestinationSelectButton3.Text = "Go!";
         ThirdCardDrawn = true;
         return;
     }
     SelectedCard      = _destination3;
     SelectedCardIndex = 2;
     DialogResult      = DialogResult.OK;
     Close();
 }
Exemple #3
0
        public static List <DestinationCard> Shuffle(this List <DestinationCard> cards)
        {
            Random r = new Random();

            //Step 1: For each unshuffled item in the collection
            for (int n = cards.Count - 1; n > 0; --n)
            {
                //Step 2: Randomly pick an item which has not been shuffled
                int k = r.Next(n + 1);

                //Step 3: Swap the selected item with the last "unstruck" letter in the collection
                DestinationCard temp = cards[n];
                cards[n] = cards[k];
                cards[k] = temp;
            }

            return(cards);
        }
Exemple #4
0
        public JumpForm(IEnumerable <DestinationCard> destinationCards)
        {
            var destinationList = destinationCards.ToList();

            if (destinationList.Count() != 3)
            {
                DialogResult = DialogResult.Abort;
                Close();
            }
            _destination1 = destinationList[0];
            _destination2 = destinationList[1];
            _destination3 = destinationList[2];

            InitializeComponent();

            DestinationTextBox1.Text = _destination1.ToString();
            DestinationTextBox2.Text = _destination2.ToString();
        }
Exemple #5
0
 protected void Render(DestinationCard subject)
 {
     Console.WriteLine($"{subject.Start} to {subject.End} worth {subject.Points}");
 }