Skip to content

Instantly share code, notes, and snippets.

View MartinZikmund's full-sized avatar
⌨️
Coding

Martin Zikmund MartinZikmund

⌨️
Coding
View GitHub Profile
private GameTheme _currentTheme = GameTheme.Classic;
public GameTheme[] Themes { get; } = new GameTheme[]
{
GameTheme.Classic,
GameTheme.Bacteria,
GameTheme.CatMouse,
GameTheme.FireWater
};
public enum GameTheme
{
Classic,
CatMouse,
Bacteria,
FireWater
}
var swap = Cells;
Cells = _nextGeneration;
_nextGeneration = swap;
private CellState[,] _nextGeneration = null;
public void Tick()
{
_nextGeneration = _nextGeneration ?? new CellState[Size, Size];
for (int row = 0; row < Size; row++)
{
for (int column = 0; column < Size; column++)
{
private readonly Random _random = new Random();
public void Randomize()
{
for (int row = 0; row < Size; row++)
{
for (int column = 0; column < Size; column++)
{
Cells[row, column] = (CellState)_random.Next(0, 2);
}
public class GameState
{
public GameState(int size)
{
Cells = new CellState[size, size];
Size = size;
}
public int Size { get; }
public enum CellState
{
Dead,
Alive
}
<Grid>
<TextBlock Text="This is a title" Panel.ZIndex="10" />
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" />
</Grid>
<Grid>
<TextBlock Text="This is a title" Style="{ThemeResource TitleTextBlockStyle}" Canvas.ZIndex="10" />
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" />
</Grid>
<Grid>
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" />
<TextBlock Text="This is a title" Style="{ThemeResource TitleTextBlockStyle}" />
</Grid>