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; }
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; }
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; }
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; }
public void AddTileToPlayerHand(Tile newTile) { Hand.Add(newTile); }
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; }
public void AddTileToBoard(Tile tile) { BoardTiles.Add(tile); }