Exemple #1
0
        public Map(bool[] newwallMap, int mapwidth, HashSet <Actor> newactors, Dictionary <Node, char> newboxes, GoalList newgoals, Dictionary <char, Color> colorDict)
        {
            id       = Map.nextId++;
            wallMap  = newwallMap;
            mapWidth = mapwidth;
            HashSet <Color> newactorcolors = new HashSet <Color>(); int i = 0;

            foreach (Actor a in newactors)
            {
                newactorcolors.Add(colorDict[i.ToString()[0]]);
                i++;
            }

            actors = new ActorList(newactors, newactorcolors);
            boxes  = new BoxList(newboxes, colorDict);
            goals  = newgoals;
            steps  = 0;

            /*
             * for (int j = 0; j<wallMap.Count(); j++)
             * {
             *  if (j%mapWidth == 0) { Console.Error.WriteLine(""); }
             *  if (isWall(j % mapWidth, j / mapwidth)) { Console.Error.Write("+"); }
             *  else { Console.Error.Write(" "); }
             * }*/
        }
Exemple #2
0
 public Map(Map oldmap)
 {
     id     = Map.nextId++;
     parent = oldmap;
     actors = new ActorList(oldmap.actors);
     boxes  = new BoxList(oldmap.boxes);
     steps  = oldmap.steps + 1;
 }
Exemple #3
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            ActorList al = (ActorList)obj;

            for (int i = 0; i < actors.Length; i++)
            {
                if (!this.actors[i].Equals(al.actors[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #4
0
 public ActorList(ActorList oldlist)
 {
     actors = (Actor[])oldlist.actors.Clone();
 }