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 GameTheme _currentTheme = GameTheme.Classic; | |
public GameTheme[] Themes { get; } = new GameTheme[] | |
{ | |
GameTheme.Classic, | |
GameTheme.Bacteria, | |
GameTheme.CatMouse, | |
GameTheme.FireWater | |
}; |
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
public enum GameTheme | |
{ | |
Classic, | |
CatMouse, | |
Bacteria, | |
FireWater | |
} |
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
var swap = Cells; | |
Cells = _nextGeneration; | |
_nextGeneration = swap; |
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 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++) | |
{ |
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 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); | |
} |
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
public class GameState | |
{ | |
public GameState(int size) | |
{ | |
Cells = new CellState[size, size]; | |
Size = size; | |
} | |
public int Size { get; } |
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
public enum CellState | |
{ | |
Dead, | |
Alive | |
} |
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
<Grid> | |
<TextBlock Text="This is a title" Panel.ZIndex="10" /> | |
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" /> | |
</Grid> |
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
<Grid> | |
<TextBlock Text="This is a title" Style="{ThemeResource TitleTextBlockStyle}" Canvas.ZIndex="10" /> | |
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" /> | |
</Grid> |
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
<Grid> | |
<Image Source="/Assets/Background.jpg" Stretch="UniformToFill" /> | |
<TextBlock Text="This is a title" Style="{ThemeResource TitleTextBlockStyle}" /> | |
</Grid> |