public void UncoverCell(MineCell cell) { if (cell.HasFlag || cell.IsUncovered) { return; } cell.IsUncovered = true; if (cell.HasMine) { GameState = GameState.Defeat; _chrono.Stop(); } else { if (cell.NeighbourhoodMineCount == 0) { UncoverNeighbours(cell); } if (Cells.All(c => c.HasMine ^ c.IsUncovered)) { GameState = GameState.Victory; _chrono.Stop(); } } }
private void UpdateAllHeaders() { _messagetype = Cells.All(a => a.Alarm || !a.IsEnabled || !a.IsVisible) ? BroadCastMessage.Alarm1 : Cells.All(a => a.Alert || !a.IsEnabled || !a.IsVisible) ? BroadCastMessage.Alarm2 : BroadCastMessage.None; RaisePropertyChanged(() => AllAlarm1); RaisePropertyChanged(() => AllAlarm2); }
private SolutionState(IReadOnlyDictionary <CellConnections, CellState> cellStateLookup) { this.cellStateLookup = cellStateLookup; foreach (CellState item in Cells) { item.SetStatus(this); } IsEverythingSolved = Cells.All(item => item.Status != CellStatus.InvalidAndCanDrop); }
private SolutionState(IReadOnlyDictionary <VoxelVisualComponent, CellState> cellStateLookup, OptionsByDesignation optionsSource) { this.cellStateLookup = cellStateLookup; this.optionsSource = optionsSource; foreach (CellState item in Cells) { item.SetStatus(this); } IsEverythingSolved = Cells.All(item => item.Status != CellStatus.InvalidAndCanDrop); }
public void Set(int x, int y, CellState cellState) { if (grid[y, x] != CellState.Empty) { throw new Exception("Cell is already ocupied."); } grid[y, x] = cellState; IsFull = Cells.All(z => z != CellState.Empty); }
private void CheckResult() { var isWin = Cells.All(cell => cell.Row == Cells.IndexOf(cell) / LengthRowColumn && cell.Column == Cells.IndexOf(cell) % LengthRowColumn && Cells.IndexOf(cell) + 1 == Convert.ToByte(cell.Text)); if (isWin) { MessageBox.Show("Вы победитель! Поздравления!", "Информация", MessageBoxButton.OK, MessageBoxImage.Question); } }
public bool Destroyed() { return(Cells.All(cell => !cell.Alive)); }
public bool IsFull() => Cells.All(row => row.All(x => x != CellStatus.Empty));
private bool IsConsecutiveForTemp() { int maxGroup = 0; int currentGroup = 0; bool prevGroupIsForce = false; bool currentGroupIsForce = false; // [NULL] is an possible [TRUE] bool recognizeNull = Cells.Count(p => p.IsTempActive() == true) < Number; // Every Cell Is possible [TRUE] bool totalFilled = recognizeNull ? Cells.All(p => p.IsTempActive() != false) : Cells.All(p => p.IsTempActive() == true); // Every Cell Is [TRUE] And we have enough cells to complete the Number if (recognizeNull && totalFilled && Cells.Count >= Number) { return(true); } int offset = 0; if (recognizeNull) { for (; !totalFilled && Cells[offset].IsTempActive() != false; offset++) { } } else { for (; !totalFilled && Cells[offset].IsTempActive() == true; offset++) { } } for (int i = 0; i < Cells.Count; i++) { HexagonCell cell = Cells[(i + offset) % Cells.Count]; bool?active = cell.IsTempActive(); if (active == true) { if (!prevGroupIsForce) { currentGroup++; maxGroup = Math.Max(currentGroup, maxGroup); } if (prevGroupIsForce) { return(false); } currentGroupIsForce = true; } else if (active == null && recognizeNull) { if (!prevGroupIsForce) { currentGroup++; maxGroup = Math.Max(currentGroup, maxGroup); } } else { if (currentGroupIsForce) { prevGroupIsForce = true; currentGroupIsForce = false; maxGroup = currentGroup; } currentGroup = 0; } } return(maxGroup >= Number); }
public bool IsBlank() { return(Cells.All(c => string.IsNullOrEmpty(c.Value))); }
public bool IsEmpty() { return(Cells.All(cell => cell.Text.IsNullOrWhiteSpace())); }
public bool IsSolved() { return(Cells.All(c => c.Value != 0)); }
public bool IsDungeon() { return(Cells.Length != 0 && Cells.All(envCell => envCell.Position.Origin.X % 10 == 0)); }
public bool IsComplete() { return(Cells.All((cell) => cell.Value > 0)); }