public Day10PointOfLight(string s) { //position=< 21188, 31669> velocity=<-2, -3> s = s.Remove(0, 10); s = s.Remove(s.IndexOf('v'), 10); s = s.Replace(">", ""); s = s.Replace(",", ""); s = s.Replace(" ", " "); while (s[0] == ' ') { s = s.Remove(0, 1); } string[] val = s.Split(' '); Day10Coord _origin = new Day10Coord(Convert.ToInt32(val[0]), Convert.ToInt32(val[1])); Day10Coord _velocity = new Day10Coord(Convert.ToInt32(val[2]), Convert.ToInt32(val[3])); originalPos = _origin; currPos = _origin; velocity = _velocity; }
public void Update(int iterations = 1) { if (iterations > 0) { //for (int i = 0; i < iterations; i++) //{ currPos += (velocity * iterations); //} } else if (iterations < 0) { //for (int i = 0; i > iterations; i--) //{ currPos -= (velocity * iterations); //} } else { throw new ArgumentException("Update cannot be 0."); } }
public Day10PointOfLight(Day10Coord o, Day10Coord v) { originalPos = o; currPos = o; velocity = v; }