Skip to content

Gyorgy0/RuggedTurtle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RuggedTurtle

This is my first interpreter written in Rust. The program lets you control a turtle with specific commands. The program is primarily for teaching programming, by visualizing instruction graphically.

WebAssembly version

https://gyorgy0.github.io/RuggedTurtle-release/

Programming documentation

The program supports multiple commands for controlling the turtle's movement. Valid commands are some hungarian and english keywords.

Variable declaration

You can declare numbers as a variable or you can refer to a previously declared variable in a variable declaration.

  • <variable_name> = variable value

Arithmetic operations

  • + - addition (it adds two numbers or variables together)

  • - - subtraction (it subtracts a number from another number or variable)

  • * - multiplication (it multiplies a number with another number or variable)

  • / - full division (it divides a number with another number or variable, it doesn't neccesarily produce an integer)

  • : - integer division (it divides a number with another number or variable, it produces an integer)

  • % - remainder division (it divides a number with another number or variable, it gives back the remainder)

Commands

  • forward(number of pixels that needs to be travelled by the turtle)
    Aliases: e(), elore(), f(), forward()

  • right(angle in degrees, it specifies how much it needs to rotate to the character's right side 0-360)
    Aliases: j(), jobb(), jobbra(), r(), right()

  • left(angle in degrees, it specifies how much it needs to rotate to the character's left side 0-360)
    Aliases: b(), bal(), balra(), l(), left()

  • pencolor(red channel 0-255, green channel 0-255, blue channel 0-255, alpha channel 0-255) - specifies the color of the line e.g. (0,0,0,255) - black, (255,255,255,255) - white. (255,255,255,255) - transparent
    Aliases: tsz(), tollszin(), szin(), pc(), pencolor(), color()

  • penwidth(width of the pen in pixels, greater the value the thicker the line left behind)
    Aliases: tv(), tollvastagsag(), vastagsag(), pw(), penwidth(), width()

  • penup - the turtle lifts up it's pen from the canvas so it doesn't paints it's path on the canvas
    Aliases: tf, tollfel, pu, penup

  • pendown - the turtle puts down it's pen so it leaves it's path behind
    Aliases: tl, tollle, pd, pendown

  • evaluate(<variable>) - simplifies and prints out the value of the specified variable
    Aliases: kier(), kiertekeles(), kiszamolas(), eval(), calc(), calculate(), evaluate()

  • print(<variable>) - prints out the specified variable
    Aliases: ki(), kiir(), kiiratas(), print()

  • clear - clears the terminal history
    Aliases: trl, torol, clr, clear

  • reset - resets the application
    Aliases: alaphelyzet, reset, default

  • help - prints out the commands and their usage
    Aliases: ?, segitseg, help

Execution controls:

  • repeat(variable, from, to (exclusive boundary - it goes until it hits the NUMBER BEFORE THE SPECIFIED number )) {commands}
    Aliases: i() {}, ism() {}, ismetles() {}, r() {}, rep() {}, repeat() {}, for() {}

Usage

rugged-turtle-usage.mp4

Graphics

Here are some commands and their effect on the turtle's movement.

for(i, 0, 200) {pencolor(55+i, 0, 55+i, 255); forward(30+i); right(59)}

for(i, 0, 200) {pencolor(55+i, 0, 55+i, 255); forward(30+i); right(59)} command output

for(i, 0, 200) {forward(100); right(59+i); forward(100)}

for(i, 0, 200) {forward(100); right(59+i); forward(100)} command output

Arithmetics

Arithmetics output

About

Program that teaches programming by visualizing instructions, written in Rust using eframe.

Topics

Resources

Stars

Watchers

Forks

Contributors