Skip to content
/ JLogo Public

University project for Advanced Programming exam

License

Notifications You must be signed in to change notification settings

Fedcmm/JLogo

Repository files navigation

Java Logo language interpreter

This is a simple interpreter of the Logo programming language, developed for the Advanced Programming exam at UNICAM.

It is able to load a program from a file and can also save the generated drawing as text.

Building and running

To build the program, first open a terminal window in the app's main folder, then run the build command using the correct version of the Gradle wrapper based on your OS:

gradlew build       (on macOS/Linux)
gradlew.bat build   (on Windows)

After building, use the wrapper again to execute the run command that will start the program.

Using the program

The file with the instructions can be loaded with the "Load" button, it has to be a .txt file with one instruction per line.

The program has the option to execute the instructions one by one or automatically, in which case the speed of execution can be adjusted with the slider on the right.

Instructions

The program supports the following set of instructions:

  • FORWARD dist
  • BACKWARD dist
  • LEFT angle
  • RIGHT angle
  • CLEARSCREEN
  • HOME (moves the cursor to the center of the screen)
  • PENUP (stops drawing)
  • PENDOWN (starts drawing)
  • SETPENCOLOR r g b
  • SETFILLCOLOR r g b (changes the color of new drawn shapes)
  • SETSCREENCOLOR r g b (changes the background color)
  • SETPENSIZE size
  • REPEAT num [ cmds ] (repeats for num times the commands in the list, commands must be separated by semicolons)