コード例 #1
0
 public void IsDeadCount7()
 {
     GameBoard board = new GameBoard(10);
     board.MakeCellAlive(5, 5);
     int actual = board.NeighborsAlive(4, 5)[1];
     Assert.AreEqual(7, actual);
 }
コード例 #2
0
 public void ChangeStatusAccordingToRules()
 {
     GameBoard board = new GameBoard(6);
     board.MakeCellAlive(5, 5);
     bool actual = board.ChangeStatus(5, 5, 0, 8);
     Assert.AreEqual(true, actual);
 }
コード例 #3
0
 public void IsAliveCount1()
 {
     GameBoard board = new GameBoard(10);
     board.MakeCellAlive(5, 5);
     int actual = board.NeighborsAlive(4,5)[0];
     Assert.AreEqual(1, actual);
 }
コード例 #4
0
 public void CanConvertNthCellToBool()
 {
     GameBoard board = new GameBoard(10);
     board.MakeCellAlive(5, 5);
     List<List<bool>> boolList = board.CellsToBoolsConverter();
     bool actual = boolList[5][5];
     Assert.AreEqual(true, actual);
 }
コード例 #5
0
        public MainWindow()
        {
            // currentBoard = new FauxGameOfLife();
            currentBoard = new GameBoard(10);
            currentBoard.MakeCellAlive(5, 5);
            currentBoard.MakeCellAlive(6, 5);
            currentBoard.MakeCellAlive(6, 6);
            currentBoard.MakeCellAlive(7, 6);
            currentBoard.MakeCellAlive(6, 7);
            currentBoard.MakeCellAlive(7, 7);
            dispatcherTimer = new DispatcherTimer();

            InitializeComponent();

            TheListView.ItemsSource = currentBoard.ToList();
            dispatcherTimer.Tick += dispatcherTimerClick;
            dispatcherTimer.Interval = TimeSpan.FromSeconds((double)RunSpeed.Value);
        }