Example #1
0
        public void ProcessAllRules_DefaultRules_ShouldBeValid()
        {
            var processRules = ProcessRules.DefaultRules();
            var gameMatrix   = new GameMatrix(6, 6).Activate(new[] { new Point(2, 3) });

            Assert.That(gameMatrix[2, 3].IsOn, "Initialized Correctly");
            processRules.ProcessAllRules(gameMatrix);
            Assert.That(gameMatrix[2, 3].IsOn, Is.False, "It dies was removed");
        }
        public MainWindow()
        {
            InitializeComponent();
            _gameMatrix = new GameMatrix(40, 40);
            _rules      = ProcessRules.DefaultRules();
            _timer      = new Timer
            {
                Interval = TimeSpan.FromSeconds(.5).TotalMilliseconds,
            };
            _timer.Elapsed += UpdateBoard;
            _gameMatrix.Activate(_gameMatrix.RandomPoints().Take((_gameMatrix.Height * _gameMatrix.Width) / 2).ToArray());

            Loaded += OnLoaded;

            const byte i = 241;

            _colorOff = new SolidColorBrush(new Color {
                A = 255, R = i, B = i, G = i
            });
            _colorOn = new SolidColorBrush(Colors.Gray);
        }