Exemplo n.º 1
0
 private static void ShowDeadlock(Level level, Deadlock deadlock)
 {
     ShowDeadlock(Log.LogOut, level, deadlock);
 }
Exemplo n.º 2
0
 private static Level GetDeadlockAsLevel(Level level, Deadlock deadlock)
 {
     Array2D<Cell> newData = new Array2D<Cell>(level.Data);
     foreach (Coordinate2D coord in level.InsideCoordinates)
     {
         newData[coord] &= ~(Cell.Sokoban | Cell.Box | Cell.Target);
     }
     foreach (Coordinate2D coord in deadlock.Coordinates)
     {
         newData[coord] |= Cell.Box;
     }
     if (deadlock.SokobanMap != null)
     {
         foreach (Coordinate2D coord in level.InsideCoordinates)
         {
             if (deadlock.SokobanMap[coord])
             {
                 newData[coord] |= Cell.Target;
             }
         }
     }
     return new Level(newData);
 }
Exemplo n.º 3
0
        private static void ShowDeadlock(TextWriter writer, Level level, Deadlock deadlock)
        {
            string text = String.Format("length {0}:", deadlock.Coordinates.Length);
            foreach (Coordinate2D coord in deadlock.Coordinates)
            {
                text += String.Format(" ({0}, {1})", coord.Row, coord.Column);
            }
            if (deadlock.SokobanMap != null)
            {
                text += String.Format(" {0}", "conditional");
            }
            writer.WriteLine(text);

            Log.DebugPrint(GetDeadlockAsLevel(level, deadlock).AsText);
        }
 protected void AddDeadlock(Deadlock deadlock)
 {
     AddDeadlock(deadlock.SokobanMap, deadlock.Coordinates);
 }