Update() public method

public Update ( ) : void
return void
コード例 #1
0
 public void OneCellShouldDisappearAfterOneIteration()
 {
     game       = new GameOfLife(3, 3);
     game[1, 1] = true;
     game.Update();
     Assert.IsFalse(game[1, 1]);
 }
コード例 #2
0
		public void OneCellShouldDisappearAfterOneIteration()
		{
			game = new GameOfLife(3, 3);
			game[1, 1] = true;
			game.Update();
			Assert.IsFalse(game[1, 1]);
		}
コード例 #3
0
 public void CreateSimplestGameOfLifeEverWith1X1()
 {
     game = new GameOfLife(1, 1);
     Assert.AreEqual(0, game.GenerationCount);
     game.Update();
     Assert.AreEqual(1, game.GenerationCount);
 }
コード例 #4
0
		public void CreateSimplestGameOfLifeEverWith1X1()
		{
			game = new GameOfLife(1, 1);
			Assert.AreEqual(0, game.GenerationCount);
			game.Update();
			Assert.AreEqual(1, game.GenerationCount);
		}
コード例 #5
0
 public void BlockShouldStayAlive()
 {
     game = new GameOfLife(4, 4);
     CreateBlock(1, 1);
     game.Update();
     Assert.IsTrue(game[1, 1]);
     Assert.IsTrue(game[2, 2]);
 }
コード例 #6
0
 public void LineShouldAlternate()
 {
     game = new GameOfLife(3, 3);
     CreateVerticalLine(1, 0);
     Assert.IsTrue(game[1, 0]);
     Assert.IsFalse(game[0, 1]);
     game.Update();
     Assert.IsFalse(game[1, 0]);
     Assert.IsTrue(game[0, 1]);
     Assert.IsTrue(game[1, 1]);
     Assert.IsTrue(game[2, 1]);
 }
コード例 #7
0
        public void ShowGameOfLife()
        {
            game = new GameOfLife(24, 24);
            game.Randomize();

            if (Time.CheckEvery(0.1f))
            {
                game.Update();
            }

            for (int x = 0; x < game.width; x++)
            {
                for (int y = 0; y < game.height; y++)
                {
                    float posX  = 0.1f + 0.8f * x / game.width;
                    float posY  = 0.1f + 0.8f * y / game.height;
                    Color color = game[x, y] ? Color.White : Color.DarkGray;
                    new Ellipse(Rectangle.FromCenter(posX, posY, 0.025f, 0.025f), color);
                }
            }
        }
コード例 #8
0
		public void ShowGameOfLife()
		{
			game = new GameOfLife(24, 24);
			game.Randomize();

			if (Time.CheckEvery(0.1f))
				game.Update();

			for (int x = 0; x < game.width; x++)
				for (int y = 0; y < game.height; y++)
				{
					float posX = 0.1f + 0.8f * x / game.width;
					float posY = 0.1f + 0.8f * y / game.height;
					Color color = game[x, y] ? Color.White : Color.DarkGray;
					new Ellipse(Rectangle.FromCenter(posX, posY, 0.025f, 0.025f), color);
				}
		}
コード例 #9
0
		public void LineShouldAlternate()
		{
			game = new GameOfLife(3, 3);
			CreateVerticalLine(1, 0);
			Assert.IsTrue(game[1, 0]);
			Assert.IsFalse(game[0, 1]);
			game.Update();
			Assert.IsFalse(game[1, 0]);
			Assert.IsTrue(game[0, 1]);
			Assert.IsTrue(game[1, 1]);
			Assert.IsTrue(game[2, 1]);
		}
コード例 #10
0
		public void BlockShouldStayAlive()
		{
			game = new GameOfLife(4, 4);
			CreateBlock(1, 1);
			game.Update();
			Assert.IsTrue(game[1, 1]);
			Assert.IsTrue(game[2, 2]);
		}