Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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