Example #1
0
 public void CannotOverwritePieceInSlot()
 {
     var board = new Board(3, 3);
     var slot = board.SlotAt(0, 0);
     slot.Piece = new Piece();
     slot.Piece = new Piece();
 }
Example #2
0
        public void FullBoardReturnsNullForRandomEmptySlot()
        {
            var board = new Board(3, 3);
            foreach (var slot in board.Slots)
                slot.Piece = new Piece();

            Assert.IsNull(board.GetRandomEmptySlot());
        }
Example #3
0
 public void ThirtySlotsForFiveBySixBoard()
 {
     var board = new Board(5, 6);
     Assert.AreEqual(30, board.Slots.Count());
 }
Example #4
0
 public void OneSlotForOneByOneBoard()
 {
     var board = new Board(1, 1);
     Assert.AreEqual(1, board.Slots.Count());
 }
Example #5
0
 public Game(int x, int y)
 {
     Players = new List<Player>();
     Board = new Board(x, y);
     sweep = new Sweep(Board, new PiecesInARowClearingRule(this, 4));
 }
Example #6
0
        public Sweep(Board board, IClearingRule clearingRule)
        {
            this.board = board;
            this.counter = 0;
            this.clearingRule = clearingRule;

            // Scale the update interval based on the size of the board
            updateInterval = Math.Max(1, (int)(10 / Math.Round(((decimal)(board.Width + board.Height)) / 10m)));
        }