示例#1
0
        public void actionSmith(RichTextBox richText, Label lblMuertes)
        {
            List <Cell> pathOpt;
            List <Cell> path;

            bool[,] visited;
            pathOpt = new List <Cell>();
            path    = new List <Cell>();
            visited = new bool[n, n];
            Cell cs = whereIsSmith();
            Cell cn = whereIsNeo();

            smithAction(cs, cn, path, ref pathOpt, visited);
            //Console.WriteLine(pathOpt.Count);

            /*foreach(Cell c in pathOpt)
             * {
             *  Console.WriteLine(c.getX()+" "+c.getY());
             * }*/
            Cell  c2 = whereIsSmith();
            Smith s  = (Smith)board[c2.getX(), c2.getY()];

            s.setInfect(pathOpt.Count);
            smithKill(pathOpt, s.getInfect(), lblMuertes);
            this.text    += "Smith infect: " + s.getInfect() + "\n";
            richText.Text = text;

            /*Console.WriteLine("Infect: "+s.getInfect() +" - Fin acción Smith");
             * Console.WriteLine("===================================================================================");
             * print();
             * Console.WriteLine("===================================================================================");*/
        }
示例#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);
        }