https://github.com/bhabishworgrg/turtle-graphics
a paint tool to control and draw with a turtle using commands
https://github.com/bhabishworgrg/turtle-graphics
java java-swing
Last synced: about 2 months ago
JSON representation
a paint tool to control and draw with a turtle using commands
- Host: GitHub
- URL: https://github.com/bhabishworgrg/turtle-graphics
- Owner: Bhabishworgrg
- License: mit
- Created: 2024-07-03T17:27:26.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-07T19:53:34.000Z (over 1 year ago)
- Last Synced: 2025-05-08T02:49:30.459Z (about 1 year ago)
- Topics: java, java-swing
- Language: Java
- Homepage:
- Size: 49.8 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Turtle Graphics Program
This project is a simple graphics tool implemented in Java using the Swing classes. It allows users to type in simple commands to move a turtle around the screen, drawing lines as it moves. This project was developed as part of an academic coursework.
## Table of Contents
- [Prerequisites](#prerequisites)
- [Build](#build)
- [Running](#running-the-projects)
- [Usage](#features)
- [License](#license)
- [Acknowledgements](#acknowledgements)
- [Get in Touch](#get-in-touch)
## Prerequisites
To run the application, you need to have the following installed:
- [JDK](https://www.oracle.com/in/java/technologies/downloads/)
- [Maven](https://maven.apache.org/download.cgi)
- [LBUGraphics.jar v4.5](https://github.com/LBU-OOP/OOPturtleGraphicsLibrary/blob/db72a5f59815045516ea444bd8680b1b4cc26e33/LBUGraphics.jar)
## Build
- Clone the repository:
```bash
git clone https://github.com/Bhabishworgrg/turtle-graphics.git
```
- Add LBUGraphics:
```bash
cd turtle-graphics
mkdir lib
mv path/to/LBUGraphics.jar lib/
```
- Install it locally:
```bash
mvn install:install-file \
-Dfile=lib/LBUGraphics.jar \
-DgroupId=uk.ac.leedsbeckett.oop \
-DartifactId=LBUGraphics \
-Dversion=4.5 \
-Dpackaging=jar
```
- Compile the code:
```bash
mvn package
```
## Running
To run the application, execute the command:
```bash
java -jar target/turtle-graphics-1.0.1.jar
```
## Usage
The following commands are available to manipulate the turtle:
- **Pen Commands**:
- `penup`: Lifts the pen from the canvas, so that movement does not get shown.
- `pendown`: Places the pen down on the canvas so movement gets shown as a drawn line.
- `pencolour ,,`: Makes the RGB colour from \,\ and \ parameters and sets the pencolour to the made colour.
- `penwidth `: Sets the pen’s width to specified width.
- **Movement Commands**:
- `turnleft `: Turn \ to the left.
- `turnright `: Turn \ to the right.
- `forward `: Move forward the specified distance.
- `backward `: Move backwards the specified distance.
- `position ,`: Places the turtle in the specified coordinates.
- **Color Commands**:
- `black`: Sets the pen color to black.
- `green`: Sets the pen color to green.
- `red`: Sets the pen color to red.
- `white`: Sets the pen color to white.
- **Reset and Clear**:
- `reset`: Resets the canvas and the pen to the initial state.
- `clear`: Clears the display.
- **Saving and Loading**:
- `Save`: Allows the user to save the image and the set of commands that the user has typed in.
- `Load`: Allows the user load the saved image and/or commands.
- **Drawing Commands**:
- `about`: Draws a simple graphic on the canvas and reports the version number of the class along with my name.
- `square `: Draws a square of specified length. The turtle, however, remains in the original position.
- `triangle `: Draws equilateral triangles of specified side.
- `triangle ,,`: Draws a triangle of specified sides.
- `circle `: Draws a circle of specified radius.
- `rectangle ,`: Draws a rectangle of specified length and width.
Check `Help` menu (Only works for Windows as of now) for more detailed information.
## License
This repository is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
## Acknowledgements
Professor Duncan Mullier: Module Leader for the Object-Oriented Programming course.
LBUGraphics: Provided JAR file for graphics functionalities.
## Get in Touch
Feel free to reach out if you want to collaborate on a project, have a question, or just want to connect!
- LinkedIn: [in/bhabishwor-gurung](https://www.linkedin.com/in/bhabishwor-gurung/)
- Email: [bhabishworgrg@gmail.com](mailto:bhabishworgrg@gmail.com)