Created
December 13, 2020 13:54
-
-
Save MartinZikmund/2ca626c45c1c4e7fe45c84cbc0883de4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Image CreateCell() | |
{ | |
var cell = new Image(); | |
cell.Tapped += OnCellTapped; | |
return cell; | |
} | |
private void OnCellTapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) | |
{ | |
var index = _cells.IndexOf((Image)sender); | |
int row = index / _gameState.Size; | |
int column = index % _gameState.Size; | |
_gameState.Cells[row, column] = _gameState.Cells[row, column] == CellState.Alive ? | |
CellState.Dead : CellState.Alive; | |
RedrawBoard(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment