Ejemplo n.º 1
0
 public void ConstrutorAndProperties()
 {
     Player player = new Player("TestName");
     Assert.AreEqual("TestName", player.Name);
     Assert.AreSame(player.Army, player.Army);
 }
Ejemplo n.º 2
0
 public void Stop()
 {
     if(!started)
     {
         return;
     }
     Board.Instance.Stop();
     white.Stop();
     black.Stop();
     white = black = active = null;
     started = false;
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 // 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;
 }
Ejemplo n.º 5
0
 public Army(Player player)
 {
     this.player = player;
 }