public void PopulateTestData(List <OneTestPrimerData> testDataList) { AllBoxList.ForEach(x => x.SetToDefault()); foreach (OneTestPrimerData oneTestPrimerData in testDataList) { OneGridPanel oneGridPanel = AllBoxList .Where(x => x.LocIdx.ColIdx == oneTestPrimerData.ColIdx) .FirstOrDefault(x => x.LocIdx.RowIdx == oneTestPrimerData.RowIdx); if (oneGridPanel != null) { if (oneTestPrimerData.Value != 0) { oneGridPanel.AllowedValues.Clear(); oneGridPanel.AllowedValues.Add(oneTestPrimerData.Value); oneGridPanel.ControlAssociatedTextBox.Text = oneTestPrimerData.Value.ToString(); } if (oneTestPrimerData.PrimeRelation == PrimeRelation.right) { oneGridPanel.RelationshipToRight.IsNeighbor = true; } if (oneTestPrimerData.PrimeRelation == PrimeRelation.bottom) { oneGridPanel.RelationshipToUnder.IsNeighbor = true; } } } InitGameBoard(); redrawAll(); }
private void buildAllBoxes() { MasterPanel = new Panel { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle // BackColor = Color.LightBlue }; for (int colIdx = 0; colIdx < MaxColAndRowIdx; colIdx++) { for (int rowIdx = 0; rowIdx < MaxColAndRowIdx; rowIdx++) { LocIdx locIdx = new LocIdx(colIdx, rowIdx); OneGridPanel oneGridPanel = new OneGridPanel(locIdx, this, MaxColAndRowIdx); AllBoxList.Add(oneGridPanel); int coordX = colIdx * Params.SpacingHorizontal; int coordY = rowIdx * Params.SpacingVertical; Point point = new Point(coordX, coordY); oneGridPanel.ControlAssociatedGridPanel.BringToFront(); oneGridPanel.ControlAssociatedGridPanel.Location = point; MasterPanel.Controls.Add(oneGridPanel.ControlAssociatedGridPanel); MasterPanel.Controls.Add(new Label() { Text = coordX + "," + coordY + "{" + MaxColAndRowIdx + "}", Location = point, Width = 20, Height = 20, // BackColor = Color.Pink }); } } }
public void AnalyzeHood() { //here we know we have a valid neighborhood of 3 or more //we need to flush out the illegal values that don't form a valid sequence List<ValidSequenceAscDesc> allValidSequences = BaseGridPanel.AllowedValues .Select(oneBaseVal => new ValidSequenceAscDesc(oneBaseVal, NeighborhoodCount)) .ToList(); List< List<int>> allowedValsThatMesh = new List<List<int>>(); //now we need to flush out any values that don't mesh for (int idx = IdxOfFirstNeighbor; idx <= IdxOfLastNeighbor; idx++) { OneGridPanel oneGridPanel = owningRun[idx]; List<int> valuesToRemove = new List<int>(); foreach (int allowedValue in oneGridPanel.AllowedValues) { if (! allValidSequences) } oneGridPanel.AllowedValues } }
public OneGridPanel GetBoxUnder(OneGridPanel oneGridPanel) { return(AllBoxList .Where(x => x.LocIdx.ColIdx == oneGridPanel.LocIdx.ColIdx) .FirstOrDefault(x => x.LocIdx.RowIdx == oneGridPanel.LocIdx.RowIdx + 1)); }