private void EvaluateLine(string line) { FabricPlan fp = new FabricPlan(line); for (int i = fp.StartX; i < fp.StartX + fp.LengthX; i++) { for (int j = fp.StartY; j < fp.StartY + fp.LengthY; j++) { Box[i][j]++; } } }
public int GetValidClaim() { foreach (var line in Lines) { FabricPlan fp = new FabricPlan(line); if (IsClaimValid(fp)) { return(fp.Index); } } return(1); }
private bool IsClaimValid(FabricPlan fp) { for (int i = fp.StartX; i < fp.StartX + fp.LengthX; i++) { for (int j = fp.StartY; j < fp.StartY + fp.LengthY; j++) { if (Box[i][j] > 1) { return(false); } } } return(true); }