Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1.         private (Vector2, float)[] getMeasurements(Map m, Robot r)
  2.         {
  3.             List<Vector2> rays = new List<Vector2>
  4.             {
  5.                 Vector2.Normalize(new Vector2(1, 0)),
  6.                 Vector2.Normalize(new Vector2(0, 1)),
  7.                 Vector2.Normalize(new Vector2(-1, 0)),
  8.                 Vector2.Normalize(new Vector2(0, -1))
  9.             };
  10.  
  11.             (Vector2, float)[] tuple = new(Vector2, float)[rayCount];
  12.  
  13.            
  14.  
  15.             for (int i = 0; i < rayCount; i++)
  16.             {
  17.                 int random = (int)RNG.nextFloatPositive(rays.Count + 1);
  18.                 tuple[i] = (rays[random], r.getMeasurement(rays[random], m));
  19.             }
  20.  
  21.             return tuple;
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement