Ejemplo n.º 1
0
        public ScorpionWhite scorpionMove(short[][][] maze, Human man)
        {//Horizontal then vertical
            // This method was written using a different logic than the current one
            ScorpionWhite tam = new ScorpionWhite(this.getX(), this.getY());

            if (tam.samePlace(man))
            {
                return(tam);
            }
            else
            {
                Mummy.setAttempt(0);
                Mummy.setCount(0);
                while ((Mummy.getAttempt() < 5) && (Mummy.getCount() < 1))
                {
                    while (this.getY() != man.getY())
                    {
                        tam = tam.mummyMoveHorizontal(maze, man);
                        if (!(Mummy.getCount() < 1))
                        {
                            return(tam);
                        }
                        if (Mummy.getAttempt() > 4)
                        {
                            break;
                        }
                    }
                    if (tam.samePlace(man))
                    {
                        return(tam);
                    }
                    tam = tam.mummyMoveVertical(maze, man);
                    if ((tam.samePlace(man)) || (!(Mummy.getCount() < 1)))
                    {
                        return(tam);
                    }
                }
                return(tam);
            }
        }