コード例 #1
0
        public bool Validate(PicrossLine line)
        {
            var lineBlocks = line.ComputeBlocks();

            if (BlockCount <= lineBlocks.Count())
            {
                return(false);
            }
            else
            {
                return(Enumerable.Range(0, lineBlocks.Count() - 1).All(blockIndex =>
                                                                       lineBlocks.ElementAt(blockIndex) <= BlocksRule.ElementAt(blockIndex)));
            }
        }
コード例 #2
0
        public bool CheckSolution(PicrossLine line)
        {
            if (IsEmpty)
            {
                return(line.Cells.All(cell => cell.State == PicrossCellState.Void));
            }

            var lineBlocks = line.ComputeBlocks();

            if (BlockCount != lineBlocks.Count())
            {
                return(false);
            }
            else
            {
                return(Enumerable.Range(0, lineBlocks.Count() - 1).All(blockIndex =>
                                                                       lineBlocks.ElementAt(blockIndex) == BlocksRule.ElementAt(blockIndex)));
            }
        }