Exemplo n.º 1
0
        public Cell(Board b)
        {
            this.board = b;

            this.State = false;
            Adjascent = new List<Cell>();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            mt = new MersenneTwister();
            board = new Board(size);
            click = new ClickWatcher(onClick);

            panels = new List<Panel>();
            InitializePanels();

            this.IsMouseVisible = true;
            base.Initialize();
        }
Exemplo n.º 3
0
        public void Edges()
        {
            int size = 3;
            Board board = new Board(size);
            board.Click(0, 1);
            Assert.AreEqual(board.GetCellAt(0, 0).State, true);
            Assert.AreEqual(board.GetCellAt(0, 1).State, true);
            Assert.AreEqual(board.GetCellAt(0, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(1, 0).State, false);
            Assert.AreEqual(board.GetCellAt(1, 2).State, false);
            Assert.AreEqual(board.GetCellAt(2, 1).State, false);

            board = new Board(size);
            board.Click(1, 0);
            Assert.AreEqual(board.GetCellAt(0, 0).State, true);
            Assert.AreEqual(board.GetCellAt(2, 0).State, true);
            Assert.AreEqual(board.GetCellAt(1, 0).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(0, 1).State, false);
            Assert.AreEqual(board.GetCellAt(2, 1).State, false);
            Assert.AreEqual(board.GetCellAt(1, 2).State, false);

            board = new Board(size);
            board.Click(1, 2);
            Assert.AreEqual(board.GetCellAt(0, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 2).State, true);
            Assert.AreEqual(board.GetCellAt(2, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(0, 1).State, false);
            Assert.AreEqual(board.GetCellAt(1, 0).State, false);
            Assert.AreEqual(board.GetCellAt(2, 1).State, false);

            board = new Board(size);
            board.Click(2, 1);
            Assert.AreEqual(board.GetCellAt(2, 0).State, true);
            Assert.AreEqual(board.GetCellAt(2, 1).State, true);
            Assert.AreEqual(board.GetCellAt(2, 2).State, true);
            Assert.AreEqual(board.GetCellAt(1, 1).State, true);

            Assert.AreEqual(board.GetCellAt(1, 0).State, false);
            Assert.AreEqual(board.GetCellAt(0, 1).State, false);
            Assert.AreEqual(board.GetCellAt(1, 2).State, false);
        }
Exemplo n.º 4
0
 public Panel(Board board)
 {
     this.board = board;
 }
Exemplo n.º 5
0
 public void SetupBoard()
 {
     for (int i = 1; i < 10; i++)
     {
         var board = new Board(i*5);
     }
 }
Exemplo n.º 6
0
 public void Middle()
 {
     int size = 3;
     var board = new Board(size);
     board.Click(1, 1);
     Assert.AreEqual(board.GetCellAt(1, 1).State, true);
     Assert.AreEqual(board.GetCellAt(0, 1).State, true);
     Assert.AreEqual(board.GetCellAt(1, 0).State, true);
     Assert.AreEqual(board.GetCellAt(2, 1).State, true);
     Assert.AreEqual(board.GetCellAt(1, 2).State, true);
     Assert.AreEqual(board.GetCellAt(2, 0).State, false);
     Assert.AreEqual(board.GetCellAt(0, 2).State, false);
     Assert.AreEqual(board.GetCellAt(0, 0).State, false);
     Assert.AreEqual(board.GetCellAt(2, 2).State, false);
 }
Exemplo n.º 7
0
 public void GetCellAtException()
 {
     var board = new Board(3);
     board.Click(3, 3);
 }