static void TracePath(List <Vector2> path, Roomba roomba, Square[,] squares) { for (int i = 0; i < path.Count; i++) { roomba.SetNewLocation(path[i].x, path[i].y, squares[path[i].x, path[i].y].IsDirty); } }
static void Main(string[] args) { Roomba roomba = new Roomba(7, 0);//set bottom left Square[,] squares = Generate(); Display(squares); //int x = roomba.GetLocation().x, y = roomba.GetLocation().y; var path = CalcPath(squares); Console.WriteLine("Roomba path:"); TracePath(path, roomba, squares); CreateImg(path); //while(x >= 0) //{ // //Console.WriteLine("x:"+x+" y:"+y); // roomba.SetNewLocation(x, y, squares[x--, y].IsDirty); //} //for (int i = 0; i <= 7; i++) //{ // if (i % 2 == 0) // { // for (int j = 1; j <= 7; j++) // roomba.SetNewLocation(i, j, squares[i, j].IsDirty); // } // else // { // for (int j = 7; j > 0; j--) // roomba.SetNewLocation(i, j, squares[i, j].IsDirty); // } //} //roomba.SetNewLocation(7, 0, false);//set to start //Console.WriteLine("x:"+roomba.GetLocation().x+" y:"+roomba.GetLocation().y); Console.WriteLine("Battery:" + roomba.Battery()); Console.WriteLine("Points:" + roomba.GetPoints()); Console.WriteLine("done"); Console.ReadKey(); }