Exemple #1
0
        public void neoAction(RichTextBox richText, Label lblRes)
        {
            Cell c   = whereIsNeo();
            Neo  neo = board[c.getX(), c.getY()] as Neo;

            neo.setBeliever();
            if (neo.isBeliever())
            {
                this.text += "Neo is believer \n";
                for (int i = -1; i <= 1; i++)
                {
                    for (int j = -1; j <= 1; j++)
                    {
                        Cell aux = new Cell(c.getX() + i, c.getY() + j);
                        if (isInside(aux))
                        {
                            if (board[aux.getX(), aux.getY()] == null)
                            {
                                if (queue.Count > 0)
                                {
                                    board[aux.getX(), aux.getY()] = queue.Dequeue();
                                    this.cola++;
                                    this.resurrections++;
                                }
                            }
                        }
                    }
                }
                lblRes.Text = this.resurrections + "";

                /*Console.WriteLine("Fin acción Neo");
                 * Console.WriteLine("===================================================================================");
                 * print();
                 * Console.WriteLine("===================================================================================");*/
            }
            else
            {
                this.text    += "Neo is not believer \n";
                richText.Text = text;
                //Console.WriteLine("Neo no es el elegido");
            }
        }
Exemple #2
0
        public void putNeoSmith()
        {
            Neo   neo   = new Neo();
            Smith smith = new Smith();
            int   row   = Useful.random_Number(0, n);
            int   col   = Useful.random_Number(0, n);

            if (board[row, col] == null)
            {
                board[row, col] = neo;
            }
            bool salir = false;

            do
            {
                row = Useful.random_Number(0, n);
                col = Useful.random_Number(0, n);
                if (board[row, col] == null)
                {
                    board[row, col] = smith;
                    salir           = true;
                }
            } while (!salir);
        }