Difference between revisions of "FillHandWithTiles"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with " == Creating FillHandWithTiles == private static void FillHandWithTiles(ref QueueOfTiles TileQueue, ref string PlayerTiles, int MaxHandSize) { while (PlayerTiles.Length <...")
(No difference)

Revision as of 12:00, 14 November 2017

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.