コード例 #1
0
ファイル: DnaCleaner.cs プロジェクト: darraghjones/robbie
        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
ファイル: RandomCleaner.cs プロジェクト: darraghjones/robbie
 public Move Move(Neighbourhood neighbourhood)
 {
     return(MoveHelpers.GetRandomMove());
 }