示例#1
0
 public void ConstrutorAndProperties()
 {
     Player player = new Player("TestName");
     Assert.AreEqual("TestName", player.Name);
     Assert.AreSame(player.Army, player.Army);
 }
示例#2
0
文件: Game.cs 项目: davidajulio/hx
 public void Stop()
 {
     if(!started)
     {
         return;
     }
     Board.Instance.Stop();
     white.Stop();
     black.Stop();
     white = black = active = null;
     started = false;
 }
示例#3
0
文件: Game.cs 项目: davidajulio/hx
 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);
     }
 }
示例#4
0
文件: Game.cs 项目: davidajulio/hx
 // 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;
 }
示例#5
0
文件: Game.cs 项目: davidajulio/hx
 public Army(Player player)
 {
     this.player = player;
 }