Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. private IEnumerable<(int XPosition, int YPosition)> GetFreeLocations()
  2. {
  3. for (var index = 0; index < ClaimedCellsBitmap.Length; index++)
  4. if (!ClaimedCellsBitmap[index])
  5. yield return GetLocationFromIndex(index);
  6. }
  7.  
  8. public (int XPosition, int YPosition) GetRandomFreeLocation()
  9. {
  10. return GetFreeLocations().ElementAt(Random.Instance.Next(GetFreeLocations().Count()));
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement