Ejemplo n.º 1
0
 public void Init()
 {
     board = new OthelloBoard();
     player1 = new Player("Emily", "black");
     player2 = new Player("Berry", "white");
     game = new Game(board, player1, player2);
 }
Ejemplo n.º 2
0
        public void APieceCanOnlyBePlacedNextToAPieceOfTheOppositeColour(string gridRef, bool result)
        {
            var board = new OthelloBoard();

            var counter = new Counter {Colour = "black"};
            board.AcceptPlay(gridRef, counter);
            Assert.That(board.ViewBoardSquare(gridRef) == counter, Is.EqualTo(result));
        }
Ejemplo n.º 3
0
        public ActionResult StartGame(string playerOneName, string playerTwoName)
        {
            var gameBoard = new OthelloBoard();
            var playerOne = new Player(playerOneName, "black");
            var playerTwo = new Player(playerTwoName, "white");
            var newGame = new Game(gameBoard, playerOne, playerTwo);

            var gameModel = new GameModel
            {
                Board = gameBoard,
                Player1 = playerOne,
                Player2 = playerTwo,
                Game = newGame
            };
            Session["currentGame"] = gameModel;
            return View(gameModel);
        }
Ejemplo n.º 4
0
 public void APieceCanOnlyBePlacedIfALineEndsInAPieceOfTheSameColour()
 {
     var board = new OthelloBoard();
     var counter1 = new Counter {Colour = "black"};
     var counter2 = new Counter {Colour = "white"};
     var counter3 = new Counter {Colour = "black"};
     var counter4 = new Counter {Colour = "white"};
     board.AcceptPlay("E3", counter1);
     Assert.That(board.ViewBoardSquare("E3"), Is.Not.EqualTo(counter1));
     board.AcceptPlay("D3", counter1);
     Assert.That(board.ViewBoardSquare("D3"), Is.EqualTo(counter1));
     board.AcceptPlay("D2", counter2);
     Assert.That(board.ViewBoardSquare("D2"), Is.Not.EqualTo(counter2));
     board.AcceptPlay("C3", counter2);
     Assert.That(board.ViewBoardSquare("C3"), Is.EqualTo(counter2));
     board.AcceptPlay("C4", counter3);
     Assert.That(board.ViewBoardSquare("C4"), Is.EqualTo(counter3));
     board.AcceptPlay("E3", counter4);
     Assert.That(board.ViewBoardSquare("E3"), Is.EqualTo(counter4));
 }
Ejemplo n.º 5
0
 public OthelloRuleBook(OthelloBoard board)
 {
     _board         = board;
     _gridRefFinder = new GridRefFinder();
 }
Ejemplo n.º 6
0
 public OthelloRuleBook(OthelloBoard board)
 {
     _board = board;
     _gridRefFinder = new GridRefFinder();
 }