Beispiel #1
0
        public void swapNeo(RichTextBox richText)
        {
            int  row, col;
            Cell c = whereIsNeo();

            row = Useful.random_Number(0, n);
            col = Useful.random_Number(0, n);
            Personage p = board[row, col];

            board[row, col]           = board[c.getX(), c.getY()];
            board[c.getX(), c.getY()] = p;
            this.text    += "Neo's position has changed \n";
            richText.Text = text;
            //Console.WriteLine("Neo cambia de posición");
        }
Beispiel #2
0
        public void putPersonages()
        {
            int row, col;

            for (int i = 0; i < n * n; i++)
            {
                row = i / n;
                col = i % n;
                if (board[row, col] == null)
                {
                    Personage p = queue.Dequeue();
                    this.cola++;
                    board[row, col] = p;
                }
            }
        }
Beispiel #3
0
        public Matrix(int n)
        {
            this.n     = n;
            this.board = new Personage[n, n];
            this.queue = new Queue <Personage>();

            for (int i = 0; i < 200; i++)
            {
                Personage p = new Personage();
                queue.Enqueue(p);
            }
            this.kills         = 0;
            this.resurrections = 0;
            this.cola          = 0;
            putNeoSmith();
            putPersonages();
        }
Beispiel #4
0
        public int update(DataGridView dgv)
        {
            Cell cN = whereIsNeo();
            Cell cS = whereIsSmith();

            // dgv.Rows[cN.getX()].Cells[cN.getY()].Style.BackColor = System.Drawing.Color.BlueViolet;
            dgv.Rows[cN.getX()].Cells[cN.getY()].Value = Image.FromFile("..\\..\\neo2.png");

            dgv.Rows[cS.getX()].Cells[cS.getY()].Style.BackColor = System.Drawing.Color.LightSkyBlue;
            dgv.Rows[cS.getX()].Cells[cS.getY()].Value           = Image.FromFile("..\\..\\smith.png");
            int row, col;

            for (int i = 0; i < this.n * this.n; i++)
            {
                row = i / this.n;
                col = i % this.n;

                if (!(board[row, col] is Neo) && !(board[row, col] is Smith) && board[row, col] != null)
                {
                    Personage p      = board[row, col];
                    String    nombre = p.getName();
                    switch (nombre)
                    {
                    case "Michelle":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\merkel.png");
                        break;

                    case "Caroline":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\aguirre.png");
                        break;

                    case "Claire":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\reina.png");
                        break;

                    case "Jessica":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\esteban.png");
                        break;

                    case "Alexander":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\bin.png");
                        break;

                    case "James":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\putin.png");
                        break;

                    case "Erik":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\trump3.png");
                        break;

                    case "Mike":
                        dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\kim.png");
                        break;
                    }
                }
                if (board[row, col] == null)
                {
                    dgv.Rows[row].Cells[col].Value = Image.FromFile("..\\..\\muerte.png");
                }
            }
            return(cola);
        }