Example #1
0
 public LayoutInstance(LayoutDescription desc, Point loc)
 {
     Layout = desc;
     Location = loc;
 }
Example #2
0
 public void AddLayout(LayoutDescription desc)
 {
     layouts.Add(desc);
 }
Example #3
0
        protected bool MatchLayout(PuzzleBoard board, LayoutDescription desc, int startX, int startY)
        {
            int layoutWidth = desc.Bottom.Length;
            int layoutHeight = (string.IsNullOrEmpty(desc.Top) ? 1 : 2);
            string pattern = desc.Top + desc.Bottom;

            int i = 0;
            for (int y = startY; y < startY + layoutHeight; y++)
                for (int x = startX; x < startX + layoutWidth; x++)
                {
                    if (board.Blocks[x, y] != CharToBlock(pattern[i++]))
                        return false;
                }
            return true;
        }
Example #4
0
        private void ClearLayout(PuzzleBoard board, LayoutDescription desc, int startX, int startY)
        {
            int layoutWidth = desc.Bottom.Length;
            int layoutHeight = (string.IsNullOrEmpty(desc.Top) ? 1 : 2);

            for (int y = startY; y < startY + layoutHeight; y++)
                for (int x = startX; x < startX + layoutWidth; x++)
                {
                    board.Blocks[x, y] = BlockType.Empty;
                }
        }