Beispiel #1
0
        public ChoosingCombinations(String name1, String name2, bool isComputer)
        {
            InitializeComponent();

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            temporaryPosition    = 0;
            indexses             = new Dictionary <string, PictureBox>();
            fruitPosition        = new Dictionary <String, PictureBox>();
            fruits           = new Dictionary <string, Fruit>();
            player1Comb      = new List <Fruit>();
            player2Comb      = new List <Fruit>();
            this.isComputer  = isComputer;
            player1Info.Text = player1Info.Text.Replace("Player1", name1);
            player2Info.Text = player2Info.Text.Replace("Player2", name2);
            groupBox1.Text   = name1 + " sets the combination for " + name2 + " to guess";
            groupBox3.Text   = name2 + " sets the combination for " + name1 + " to guess";
            if (isComputer)
            {
                player1Comb         = AutomaticGame.getFruitList(AutomaticGame.generateRandomCombination(true));
                player1Info.Visible = false;

                groupBox1.Text = name1 + " sets the combination for Computer to guess";
            }
            fruitPosition.Add("orange", orangeMenu);
            fruitPosition.Add("apple", appleMenu);
            fruitPosition.Add("watermelon", watermelonMenu);
            fruitPosition.Add("plum", plumMenu);
            fruitPosition.Add("peach", peachMenu);
            fruitPosition.Add("lemon", lemonMenu);

            fruits.Add("orange", new Orange(0, 0, 0, 0));
            fruits.Add("apple", new Apple(0, 0, 0, 0));
            fruits.Add("watermelon", new Watermelon(0, 0, 0, 0));
            fruits.Add("plum", new Plum(0, 0, 0, 0));
            fruits.Add("peach", new Peach(0, 0, 0, 0));
            fruits.Add("lemon", new Lemon(0, 0, 0, 0));

            indexses.Add("0", player1Box1);
            indexses.Add("1", player1Box2);
            indexses.Add("2", player1Box3);
            indexses.Add("3", player1Box4);
            indexses.Add("4", player2Box1);
            indexses.Add("5", player2Box2);
            indexses.Add("6", player2Box3);
            indexses.Add("7", player2Box4);

            firstChooses      = true;
            groupBox3.Visible = false;
            button1.Enabled   = false;
            button2.Enabled   = false;

            //  this.Width = this.BackgroundImage.Width;
            //   this.Height = this.BackgroundImage.Height;
            player2Info.Text = player2Info.Text.Replace("Player1", name1);
            player1Info.Text = player1Info.Text.Replace("Player2", name2);
        }
Beispiel #2
0
        public Player(bool turn, int playerID, List <Fruit> combination, String name)
        {
            this.combination = combination;
            this.turn        = turn;
            this.isComputer  = false;

            littlePlates = new LittlePlates(playerID);
            napkins      = new NapkinCollection(playerID);
            rand         = new Random();
            autoplay     = new AutomaticGame();
            autoplay.setCombination(combination);
            this.name = name;
        }