FillHandWithTiles

From TRCCompSci - AQA Computer Science
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.