コード例 #1
0
ファイル: Cell.cs プロジェクト: vkinoshita/Homogenize
        public Cell(Board b)
        {
            this.board = b;

            this.State = false;
            Adjascent = new List<Cell>();
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: vkinoshita/Homogenize
        /// <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();
        }
コード例 #3
0
ファイル: BoardTest.cs プロジェクト: vkinoshita/Homogenize
        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);
        }
コード例 #4
0
ファイル: Panel.cs プロジェクト: vkinoshita/Homogenize
 public Panel(Board board)
 {
     this.board = board;
 }
コード例 #5
0
ファイル: BoardTest.cs プロジェクト: vkinoshita/Homogenize
 public void SetupBoard()
 {
     for (int i = 1; i < 10; i++)
     {
         var board = new Board(i*5);
     }
 }
コード例 #6
0
ファイル: BoardTest.cs プロジェクト: vkinoshita/Homogenize
 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);
 }
コード例 #7
0
ファイル: BoardTest.cs プロジェクト: vkinoshita/Homogenize
 public void GetCellAtException()
 {
     var board = new Board(3);
     board.Click(3, 3);
 }