public void Init() { board = new OthelloBoard(); player1 = new Player("Emily", "black"); player2 = new Player("Berry", "white"); game = new Game(board, player1, player2); }
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)); }
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); }
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)); }
public OthelloRuleBook(OthelloBoard board) { _board = board; _gridRefFinder = new GridRefFinder(); }