コード例 #1
0
ファイル: LogicEngine.cs プロジェクト: Vakz/TDDD49
 public bool escapingThiefPred(ThiefPlayer tp)
 {
     BlockType escapeType = board[tp.Piece.Position].Type;
     if (escapeType == BlockType.EscapeAirport && tp.Money < 3000) return false;
     if (escapeType == BlockType.EscapeCheap && tp.Money < 1000) return false;
     return tp.Piece.Type == PieceType.Thief && tp.Piece.Alive && tp.Piece.Arrestable
                     && new[] { BlockType.EscapeAirport, BlockType.EscapeCheap }.Any(b => board[tp.Piece.Position].Type == b);
 }
コード例 #2
0
ファイル: BoardController.cs プロジェクト: Vakz/TDDD49
 /// <summary>
 /// Adds new thief players to the game, at the first available hideout
 /// </summary>
 /// <param name="nrOfPlayers">The number of thief players to add</param>
 private void addThiefPlayers(int nrOfPlayers)
 {
     try
     {
         for (int i = 0; i < nrOfPlayers; ++i)
         {
             ThiefPlayer tp = new ThiefPlayer(i, State.Board.getUnoccupiedByBlockType(BlockType.Hideout));
             State.ThiefPlayers.Add(tp);
             State.Board.addPiece(tp.Piece);
         }
         // One more police pieces than thieves
     }
     catch (Exception)
     {
         throw new ArgumentException("Attempted to add more thieves than there are hideouts");
     }
 }