public void ConstrutorAndProperties() { Player player = new Player("TestName"); Assert.AreEqual("TestName", player.Name); Assert.AreSame(player.Army, player.Army); }
public void Stop() { if(!started) { return; } Board.Instance.Stop(); white.Stop(); black.Stop(); white = black = active = null; started = false; }
public void PutPiece(PiecePosition position, String playerName, GoInterface.PieceRepresentation pieceRepresentation) { if(!started) { throw new GameException("Game is not started. Please start game before playing."); } if(!active.Name.Equals(playerName)) { throw new GameException("You are not the current player."); } try { new Piece(pieceRepresentation, active.Army, position); active = (active == white? black: white); } catch(PieceException exception) { throw new GameException(exception.Message, exception); } }
// Methods public void Start(String whiteName, String blackName, Board.BoardSize boardSize) { if(started) { Stop(); } white = new Player(whiteName); black = new Player(blackName); active = black; Board.Instance.Start(boardSize); started = true; }
public Army(Player player) { this.player = player; }