Ejemplo n.º 1
0
        public void NewKingdomCards(string gameOptions)
        {
            DLLInterface.ProcessCommand("newKingdomCards@" + gameOptions);
            InitializeSupply();
            UpdateAllState();

            if (configWindow != null)
            {
                configWindow.UpdateBuildLists();
            }
        }
Ejemplo n.º 2
0
 public void NewGame(string parameters)
 {
     if (parameters.Length == 0)
     {
         DLLInterface.ProcessCommand("newGame");
     }
     else
     {
         DLLInterface.ProcessCommand("newGame@" + parameters);
     }
     InitializeSupply();
     UpdateAllState();
 }
Ejemplo n.º 3
0
        private void buttonCompareAIs_Click(object sender, EventArgs e)
        {
            String parameters = AIString();

            if (parameters.Contains("Human"))
            {
                MessageBox.Show("Humans are not valid test subjects.", "Error");
                return;
            }

            DLLInterface.ProcessCommand("testAIs@" + parameters);
            parentWindow.InitializeSupply();
            parentWindow.UpdateAllState();

            labelSampleGameInfo.Visible = true;
            labelSampleGameInfo.Text    = "The main window contains a sample game between the two AIs.";

            double result = DLLInterface.GetDouble("AITestResult");

            labelResult.Text = "Player 1 wins " + result.ToString("P").Replace(" %", "%") + " of games for a spread of " + DominionVisualization.FormatPercentage((result * 100.0 - 50.0) * 2.0) + ".";
        }
Ejemplo n.º 4
0
        private void ProcessDecision()
        {
            List <Card> result = new List <Card>();
            int         choice = -1;

            foreach (ButtonBase b in panelDecision.Controls)
            {
                if (b is CardCheckBox && (b as CardCheckBox).Checked)
                {
                    result.Add((b as CardCheckBox).c);
                }
                if (b is CardRadioButton && (b as CardRadioButton).Checked)
                {
                    result.Add((b as CardRadioButton).c);
                }
                if (b is ChoiceRadioButton && (b as ChoiceRadioButton).Checked)
                {
                    choice = (b as ChoiceRadioButton).choice;
                }
            }
            if (decision.type == "choice")
            {
                //
                // discrete choice decision
                //
                if (choice >= 0)
                {
                    String response = "response@" + choice.ToString();
                    DLLInterface.ProcessCommand(response);
                    UpdateAllState();
                }
                else
                {
                    labelError.Text = "You must choose an option.";
                }
            }
            else if (decision.type == "selectCard")
            {
                //
                // card select decision
                //
                if (result.Count >= decision.minimumCount && result.Count <= decision.maximumCount)
                {
                    String response = "response@";
                    foreach (Card c in result)
                    {
                        response += c.name + "|";
                    }
                    DLLInterface.ProcessCommand(response);
                    UpdateAllState();
                }
                else
                {
                    if (decision.minimumCount == 1 && decision.minimumCount == 1)
                    {
                        labelError.Text = "You must choose a card.";
                    }
                    else if (decision.minimumCount == decision.maximumCount)
                    {
                        labelError.Text = "You must select exactly " + decision.minimumCount + " cards.";
                    }
                    else
                    {
                        labelError.Text = "You must select between " + decision.minimumCount + " and " + decision.maximumCount + " cards.";
                    }
                }
            }
        }
Ejemplo n.º 5
0
 private void buttonAddCard_Click(object sender, EventArgs e)
 {
     DLLInterface.ProcessCommand("debugAddCard@" + textBoxAddCard.Text.ToLower());
     UpdateState(false);
 }