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))); } }
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))); } }