public bool compensateMotion() { // 맵에게 알리는 코드 if (MapManager.CreatePath() == 0) { return(true); } else { return(false); } }
public bool keyPointSearch(StartForm startForm) { while (true) { Thread.Sleep(sleepTime); // 경로 == List<Tile> 형식 --> path[i].X : 행 , path[i].Y : 열 <-- 이렇게 접근 가능 rotation(startForm); if (!avoidingHazard(startForm)) // 위험지역 나오면 다시 로테이션부터 시작 { if (MapManager.CreatePath() == 1) { return(false); } continue; } detectingColorBlob(); // 오작동 했다면 bool moveCorrect = simInterface.moveForward(); set_cur(); startForm.display(); MapManager.getPath().RemoveAt(0); // 제대로 움직였으니 첫번째 패스 삭제 if (!moveCorrect) { if (!compensateMotion()) // 경로 재설정 { return(false); } } // 스팟에 도착했는지 검사 if (MapManager.getCurrent().First == MapManager.getSpot()[0].First && MapManager.getCurrent().Second == MapManager.getSpot()[0].Second) { // 스팟 지나가면 깃발 바꾸기 MapManager.getMap()[MapManager.getSpot()[0].First, MapManager.getSpot()[0].Second] = 5; MapManager.getSpot().RemoveAt(0); // 끝났으면 if (VerifyEnd()) { Console.WriteLine("Successed!!!"); break; } else { MapManager.CreatePath(); } } } return(true); }