Пример #1
0
        public Move Move(Neighbourhood neighbourhood)
        {
            var index = (int)neighbourhood.North * 81 + //(int)Math.Pow(3, 4) +
                        (int)neighbourhood.South * 27 + //(int)Math.Pow(3, 3) +
                        (int)neighbourhood.East * 9 +   //(int)Math.Pow(3, 2) +
                        (int)neighbourhood.West * 3 +   //(int)Math.Pow(3, 1) +
                        (int)neighbourhood.Current;

            return(Dna[index]);
        }
Пример #2
0
        public Move Move(Neighbourhood neighbourhood)
        {
            if (neighbourhood.Current == Cell.Can)
            {
                return(Domain.Move.Pickup);
            }
            if (neighbourhood.North == Cell.Can)
            {
                return(Domain.Move.North);
            }
            if (neighbourhood.South == Cell.Can)
            {
                return(Domain.Move.South);
            }
            if (neighbourhood.East == Cell.Can)
            {
                return(Domain.Move.East);
            }
            if (neighbourhood.West == Cell.Can)
            {
                return(Domain.Move.West);
            }

            if (neighbourhood.North == Cell.Wall)
            {
                return(Domain.Move.South);
            }
            if (neighbourhood.South == Cell.Wall)
            {
                return(Domain.Move.North);
            }
            if (neighbourhood.East == Cell.Wall)
            {
                return(Domain.Move.West);
            }
            if (neighbourhood.West == Cell.Wall)
            {
                return(Domain.Move.East);
            }

            return(Domain.Move.Random);
        }
Пример #3
0
 public Move Move(Neighbourhood neighbourhood)
 {
     return(MoveHelpers.GetRandomMove());
 }