static void Main(string[] args) { string Link = "TreeMap.txt"; SkiSlope Zelda = new SkiSlope(Link); SkiTrip Ganon = Zelda.Ski(2, 2); Console.WriteLine(Ganon.report()); }
public SkiTrip Ski(int x, int y) { SkiTrip Trip = new SkiTrip(ValidFile); if (ValidFile) { x = Math.Abs(x); y = Math.Abs(y); Trip.SlopeX = x; Trip.SlopeY = y; System.IO.StreamReader temp = new System.IO.StreamReader(SlopeFile); string line = temp.ReadLine(); Trip.LinesSkied++; while (line != null) { if (line[this.SkierLocationX - 1] == '#') { Trip.Collisions++; int[] Coordinates = new int[] { this.SkierLocationX, this.SkierLocationY }; Trip.CollisionLocations.Add(Coordinates); } for (int i = 0; i < y; i++) { if (this.SkierLocationY == this.NumberOfLines) { line = null; } else { this.SkierLocationY++; Trip.LinesSkied++; line = temp.ReadLine(); } } for (int i = 0; i < x; i++) { if (this.SkierLocationX == this.WidthOfLines) { this.SkierLocationX = 1; } else { this.SkierLocationX++; } } } return(Trip); } else { return(Trip); } }