private static void GetToYAxis(StreamMessage streamMessage, ClientRobot robot) { if (robot.Position.X == 0) { return; } while (robot.Position.X != 0) { var oldPosition = robot.Position; Move(streamMessage, robot); if (robot.IsCloserToYAxis(oldPosition)) { continue; } if (robot.HasntMoved(oldPosition)) { continue; } if (robot.Position.Y != oldPosition.Y) { PositionYChanged(streamMessage, robot); continue; } TurnAbout(streamMessage, robot); } Console.WriteLine(robot.Position); }
private static void Move(StreamMessage streamMessage, ClientRobot robot) { MessageService.SendMoveChallenge(streamMessage); GetConfirm(streamMessage, robot); var oldPosition = robot.Position; GetPositionSetToRobot(streamMessage, robot); if (robot.HasntMoved(oldPosition)) { Move(streamMessage, robot); } }