예제 #1
0
        //let's play a game why not
        private void button1_Click(object sender, EventArgs e)
        {
            string p1name = player1name.Text;
            string p2name = player2name.Text;
            string p3name = player3name.Text;
            player[] players;

            if (p1name.Trim() == "")
            {
                p1name = "player 1";
            }
            if (p2name.Trim() == "")
            {
                p2name = "player 2";
            }
            if (p3name.Trim() == "")
            {
                p3name = "player 3";
            }
            player player1 = new player(p1name, 1);
            player player2 = new player(p2name, 2);
            if (checkBox1.Checked)
            {
                player player3 = new player(p3name, 3);
                players = new player[] { player1, player2, player3 };
            }
            else
            {
                players = new player[] { player1, player2 };
            }
            game LeJeuDe99 = new game(players);
            this.Hide();
        }
예제 #2
0
        //ctor - happens right when you instantiate the class - this stuff should be in every new game, but only once per game or something
        public playarea(game gameInProgress)
        {
            currentGame = gameInProgress;
            InitializeComponent();
            //board layout arrays
            int[] row1 = new int[10]  { 73, 72, 71, 70, 69, 68, 67, 66, 65, 100};
            int[] row2 = new int[10]  { 74, 57, 58, 59, 60, 61, 62, 63, 64, 99 };
            int[] row3 = new int[10]  { 75, 56, 21, 20, 19, 18, 17, 36, 37, 98 };
            int[] row4 = new int[10]  { 76, 55, 22, 13, 14, 15, 16, 35, 38, 97 };
            int[] row5 = new int[10]  { 77, 54, 23, 12,  1,  4,  5, 34, 39, 96 };
            int[] row6 = new int[10]  { 78, 53, 24, 11,  2,  3,  6, 33, 40, 95 };
            int[] row7 = new int[10]  { 79, 52, 25, 10,  9,  8,  7, 32, 41, 94 };
            int[] row8 = new int[10]  { 80, 51, 26, 27, 28, 29, 30, 31, 42, 93 };
            int[] row9 = new int[10]  { 81, 50, 49, 48, 47, 46, 45, 44, 43, 92 };
            int[] row10 = new int[10] { 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 };

            rows = new int[][] { row1, row2, row3, row4, row5, row6, row7, row8, row9, row10 };

            for (int i = 0; i < rows.Length; i++) //row
            {
                int[] row = rows[i];

                for (int j = 0; j < row.Length; j++) //column
                {
                    //lets make a play area howabout, 10x10 and arranged in that bizarre matrix above
                    int s = 35; //arbitrary woo
                    boardsquare square = new boardsquare(); //boardsquare object inherits button - see boardsquare.cs
                    square.Name = "bsq" + row[j];
                    square.Text = row[j].ToString();
                    square.squareID = row[j];
                    square.row = i;
                    square.column = j;
                    square.Size = new System.Drawing.Size(s, s);
                    square.Location = new Point(j * s, i * s);
                    square.Click += new EventHandler(square_Click);
                    square.Enabled = false;
                    this.Controls.Add(square);
                }
            }
            //oops, this is the game of 99, not 100
            this.Controls.RemoveByKey("bsq100");
        }
예제 #3
0
        private void button1_Click(object sender, EventArgs e) //let's play a game why not
        {
            string p1name = player1name.Text;
            string p2name = player2name.Text;
            string p3name = player3name.Text;

            player[] players;

            if (p1name.Trim() == "")
            {
                p1name = "player 1";
            }
            if (p2name.Trim() == "")
            {
                p2name = "player 2";
            }
            if (p3name.Trim() == "")
            {
                p3name = "player 3";
            }
            player player1 = new player(p1name, 1);
            player player2 = new player(p2name, 2);

            if (checkBox1.Checked)
            {
                player player3 = new player(p3name, 3);
                players = new player[] { player1, player2, player3 };
            }
            else
            {
                players = new player[] { player1, player2 };
            }
            game LeJeuDe99 = new game(players);

            this.Hide();
        }
예제 #4
0
        public playarea(game gameInProgress) //ctor - happens right when you instantiate the class - this stuff should be in every new game, but only once per game or something
        {
            currentGame = gameInProgress;
            InitializeComponent();
            //board layout arrays
            int[] row1 = new int[10]  {
                73, 72, 71, 70, 69, 68, 67, 66, 65, 100
            };
            int[] row2 = new int[10]  {
                74, 57, 58, 59, 60, 61, 62, 63, 64, 99
            };
            int[] row3 = new int[10]  {
                75, 56, 21, 20, 19, 18, 17, 36, 37, 98
            };
            int[] row4 = new int[10]  {
                76, 55, 22, 13, 14, 15, 16, 35, 38, 97
            };
            int[] row5 = new int[10]  {
                77, 54, 23, 12, 1, 4, 5, 34, 39, 96
            };
            int[] row6 = new int[10]  {
                78, 53, 24, 11, 2, 3, 6, 33, 40, 95
            };
            int[] row7 = new int[10]  {
                79, 52, 25, 10, 9, 8, 7, 32, 41, 94
            };
            int[] row8 = new int[10]  {
                80, 51, 26, 27, 28, 29, 30, 31, 42, 93
            };
            int[] row9 = new int[10]  {
                81, 50, 49, 48, 47, 46, 45, 44, 43, 92
            };
            int[] row10 = new int[10] {
                82, 83, 84, 85, 86, 87, 88, 89, 90, 91
            };

            rows = new int[][] { row1, row2, row3, row4, row5, row6, row7, row8, row9, row10 };

            for (int i = 0; i < rows.Length; i++) //row
            {
                int[] row = rows[i];

                for (int j = 0; j < row.Length; j++) //column
                {
                    //lets make a play area howabout, 10x10 and arranged in that bizarre matrix above
                    int         s      = 35;                //arbitrary woo
                    boardsquare square = new boardsquare(); //boardsquare object inherits button - see boardsquare.cs
                    square.Name     = "bsq" + row[j];
                    square.Text     = row[j].ToString();
                    square.squareID = row[j];
                    square.row      = i;
                    square.column   = j;
                    square.Size     = new System.Drawing.Size(s, s);
                    square.Location = new Point(j * s, i * s);
                    square.Click   += new EventHandler(square_Click);
                    square.Enabled  = false;
                    this.Controls.Add(square);
                }
            }
            //oops, this is the game of 99, not 100
            this.Controls.RemoveByKey("bsq100");
        }