FillHandWithTiles

From TRCCompSci - AQA Computer Science
Revision as of 13:00, 14 November 2017 by RareMeme1337 (talk | contribs) (Created page with " == Creating FillHandWithTiles == private static void FillHandWithTiles(ref QueueOfTiles TileQueue, ref string PlayerTiles, int MaxHandSize) { while (PlayerTiles.Length <...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Creating FillHandWithTiles

private static void FillHandWithTiles(ref QueueOfTiles TileQueue, ref string PlayerTiles, int MaxHandSize)
{
 while (PlayerTiles.Length <= MaxHandSize)
 {
  PlayerTiles = PlayerTiles + TileQueue.Remove();
  TileQueue.Add();
 }
}

To break down the code, firstly a method is written called FillHandWithTiles, then it asks for conditions, PlayerTitles length is equal or less than the maximum hand size, if so, the remove a tile from the queue then add on that the player's hand tile that they removed from the queue.