예제 #1
0
 public static List<Tile> GenerateShuffledTilesSample()
 {
     var tiles = Stock.GetInitialSetOfTiles();
     tiles[0] = new Tile() {Head = 0, Tail = 3};
     tiles[3] = new Tile() {Head = 0, Tail = 0};
     tiles[4] = new Tile() {Head = 1, Tail = 1};
     tiles[7] = new Tile() {Head = 0, Tail = 4};
     tiles[10] = new Tile() {Head = 3, Tail = 5};
     tiles[20] = new Tile() {Head = 1, Tail = 4};
     return tiles;
 }
예제 #2
0
        public Tile GetMostValuableSumTileInHand()
        {
            var tempSumTile = new Tile {Head = -1,Tail = -1};

            foreach (var tile in Hand)
            {
                var newSum = tile.Head + tile.Tail;
                var originalSum = tempSumTile.Head + tempSumTile.Tail;

                if (newSum > originalSum)
                    tempSumTile = tile;
            }
            return tempSumTile;
        }
예제 #3
0
 public static Tile GetMaxDoublePiecePlayer(List<Tile> playerHand)
 {
     var currentMaxDoubleTile = new Tile();
     foreach (var t in playerHand)
     {
         if (t.Head == t.Tail)
         {
             if (currentMaxDoubleTile.Head<t.Head && currentMaxDoubleTile.Tail<t.Tail)
             {
                 currentMaxDoubleTile = t;
             }
         }
     }
     return currentMaxDoubleTile;
 }
예제 #4
0
        public List<Tile> GetInitialSetOfTiles()
        {
            var initialTiles = new List<Tile>();

            const int maxValue = 6;
            for (var headValue = 0; headValue <= maxValue; headValue++)
            {
                for (var tailValue = headValue; tailValue <= maxValue; tailValue++)
                {
                    var currentTile = new Tile {Head = headValue, Tail = tailValue};
                    initialTiles.Add(currentTile);
                }
            }

            return initialTiles;
        }
예제 #5
0
 public void AddTileToPlayerHand(Tile newTile)
 {
     Hand.Add(newTile);
 }
예제 #6
0
 public int GetMaxDoublePiecePlayer()
 {
     var playerWithMaxDoublePiecePlayer = -1;
     var currentMaxDoubleTile = new Tile();
     foreach (var player in Players)
     {
         foreach (var tile in player.Hand)
         {
             if (tile.Head != tile.Tail) continue;
             if (currentMaxDoubleTile.Head < tile.Head && currentMaxDoubleTile.Tail < tile.Tail)
             {
                 currentMaxDoubleTile = tile;
                 playerWithMaxDoublePiecePlayer = player.PlayerNumber;
             }
         }
     }
     return playerWithMaxDoublePiecePlayer;
 }
예제 #7
0
 public void AddTileToBoard(Tile tile)
 {
     BoardTiles.Add(tile);
 }