There is a square field of n × n cells. In the center of this field there is a square mountain of m × m cells, and in the lower left corner there is a square tractor of k × k cells, which can move along the field.
- Sizes: fields — n, mountains — m and tractor — k, are entered from the keyboard;
- The tractor moves an arbitrary number of cells up, down, left or right; If it is not possible to move the tractor (for example, if the path abuts against a hill), then leave the tractor in place. The field is considered to be closed in a ring, that is, when the tractor leaves the left border of the field, it appears on the right, and so on;
- Display the current coordinates of the lower left corner of the tractor.
- JDK: 18 and higher;
All commands are executed in the console.
- Create a folder:
mkdir GitProjects
; - Go to the folder:
cd GitProjects
; - Cloning a repository:
git clone https://github.com/HogwartsSchoolOfMagic/TractorMoving.git
; - Go to the folder:
cd TractorMoving
; - Build project:
mvn clean install
; - After completing 5 points — a folder with the name “target” will be created. We go into it:
go target
; - Inside there will be a JAR file named “tractor-1.0.0.jar”.
We execute the command:
java -jar tractor-1.0.0.jar
; - Console application will start (see: Application interface).
public class TractorApplication {
public static void main(String[] args) { // Used to launch the application.
run();
}
// ... other methods
}
Copyright ©2022, Vladislav [SmithyVL] Kuznetsov