• Stars
    star
    560
  • Rank 79,541 (Top 2 %)
  • Language
    Rust
  • License
    Mozilla Public Li...
  • Created about 7 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Create Animated Drawings in Rust

turtle

Crates.io Docs.rs Crates.io Crates.io Build Status Codecov Zulip Tokei Line Count

Tweet your drawings to us on Twitter at @RustTurtle and follow us to see what is being created!

Create animated drawings with the Rust programming language. This crate is a tool for teaching programming by drawing pictures. Learning this way is fun and interesting for people of all ages!

The idea: You control a turtle with a pen tied to its tail. As it moves across the screen, it draws the path that it follows. You can use this to draw any picture you want just by moving the turtle across the screen.

turtle moving forward

Documentation

Example

As a simple example, you can draw a circle with only the following code:

use turtle::Turtle;

fn main() {
    let mut turtle = Turtle::new();

    for _ in 0..360 {
        // Move forward three steps
        turtle.forward(3.0);
        // Rotate to the right (clockwise) by 1 degree
        turtle.right(1.0);
    }
}

This will produce the following:

turtle drawing a circle

See the examples/ directory for more examples of how to use this crate.

Need help?

The following are some resources you can use to find help when you run into a problem. The links are listed in the order you should try each one, but feel free to come to the Turtle Zulip anytime if you are lost.

Contributing

See CONTRIBUTING.md for information about contributing to this project including how to build and test the project, submit new examples, report bugs, and more.

Inspiration & Goals

This crate is inspired by the Logo educational programming language. Many languages contain implementations of Logo's "turtle graphics". For example, the Python programming language comes with a built-in turtle module. This crate is largely inspired by the Python implementation, but uses Rust conventions and best practices to provide the best possible platform for learning Rust.

The goal of this crate is to be as easy to approach as possible and also provide the opportunity to explore Rust's most advanced features. We welcome contributions from anyone and everyone, including those that are new to the Rust programming language.

More Repositories

1

rust-simple-game-dev-tutorial

Rust game development tutorial with specs ECS and SDL2
Rust
193
star
2

brain

A high level programming language that compiles into the brainfuck esoteric programming language
Rust
167
star
3

brainfuck

Brainfuck interpreter companion to the brain programming language
Rust
41
star
4

tic-tac-toe

A fully commented Tic-Tac-Toe example written in Rust
Rust
39
star
5

caves

2D Cave Exploration Game with Procedurally Generated Levels
Rust
35
star
6

portrayer

A hierarchical, recursive ray tracer written in Rust
Rust
20
star
7

rust-game-dev-workshop

A very minimal game with a player, enemies, and a goal (that's it!)
Rust
20
star
8

component_group

A Rust crate for working with a group of Components (in the Specs ECS)
Rust
20
star
9

bst

A map and set type based on a binary search tree (BST)
Rust
13
star
10

sudoku

Fast sudoku solver
C
11
star
11

vecbit

A crate for managing memory bit by bit
Rust
9
star
12

gh-pages-es6-starter

Making publishing to GitHub pages with transpiled ES6 code a breeze
JavaScript
9
star
13

lion

A programming language and interactive REPL for performing calculations involving units
Rust
8
star
14

dino

Compiler / PL Experimentation
Rust
8
star
15

chess-old

Rust implementation of the game of chess (work in progress, just for fun)
Rust
7
star
16

wolf-asm

(Work in progress) The Wolf Assembly Language - assembler and interpreter/VM
Rust
6
star
17

tile-universe

Tile Universe Creator
JavaScript
6
star
18

text-to-color

Changes arbitrary text to a CSS color
HTML
5
star
19

robo-quest

Robot game for the GameShell
Rust
5
star
20

reversi

Reversi implemented in Haskell as a terminal game
Haskell
4
star
21

tea

An implementation of the Pie dependent type system from The Little Typer (work-in-progress)
Rust
4
star
22

ci

Continuous integration utilities for Rust
Rust
4
star
23

pea

PL / Compilers / Interpreters Experimentation
Rust
3
star
24

crategrep

Search all the source code on crates.io with ripgrep
Shell
3
star
25

logoc

A compiler for the LOGO programming language
Rust
3
star
26

lox

WIP
Rust
3
star
27

connect4

Terminal implementation of the game Connect 4
Rust
2
star
28

sunjay.github.io

My personal website
HTML
2
star
29

chess

Chess implementation in Rust (just for fun, experimenting with bitboards)
2
star
30

sregex

A simple regex engine made just for fun (work in progress)
Rust
2
star
31

kale

(Work in progress) A 2D graphics library aiming to support the needs of the turtle crate
Rust
2
star
32

advent-of-code-2019

My solutions for Advent of Code 2019
2
star
33

regex-vm

A regex engine that compiles the regex into instructions for a stack-based virtual machine. (work in progress)
Rust
2
star
34

react-redux-gh-pages-starter

(in progress) React Redux GitHub Pages Starter Project
JavaScript
2
star
35

genius-haskell

A Genius Tic-Tac-Toe implementation in Haskell (just for fun, to learn Haskell)
Haskell
2
star
36

board-games

(Work in progress) Implementations of various board games, playable in your terminal
Rust
2
star
37

brain-debug

The brain language debugger and visualizer
JavaScript
2
star
38

htmlgen

Simple HTML templating library (WIP, proof of concept)
Rust
2
star
39

autogamer

(Work in progress) An opinionated, convention over configuration game creation framework designed for use with the Tiled editor and the Python programming language
Rust
2
star
40

peg-solitaire

Peg Solitaire is a fun puzzle game created after I wrote an exam that had a question based on this.
JavaScript
2
star
41

pathgenerator

Proof-of-Concept for an algorithm I designed for my tile-universe project
JavaScript
2
star
42

mgc

The manual garbage collector for when you have complete control
Rust
2
star
43

drawc

(Work in progress) Teaching the basics of compilers by generating programs that draw pictures
Rust
2
star
44

universe-creator

A text adventure creator you can live preview in your browser!
JavaScript
2
star
45

checkers

Implementation of the game checkers with mandatory jumps (work in progress)
Rust
2
star
46

maze-generator

Maze Generation Visualizer
JavaScript
2
star
47

rhino

Rhino Editor - Image Editor for Linux (work in progress)
JavaScript
2
star
48

beaverdb

DB implementation experimentation
Rust
1
star
49

landscapes

2D Landscape Generator
JavaScript
1
star
50

rcov

Rust Code Coverage (initial phase of development)
Rust
1
star
51

elevator

Elevator Controller (in early development)
Rust
1
star
52

plzdoc

Please just generate documentation from JSDoc strings (without all the boilerplate/issues)
1
star
53

advent-of-code-2020

https://adventofcode.com/2020/
Rust
1
star
54

dsarray

A dynamically-sized array in C (work in progress)
C
1
star
55

world-creator

Procedurally generates terrain from a function
JavaScript
1
star
56

voxel-editor

A Voxel Model Editor (still in initial stages of development)
Rust
1
star
57

rust-rfc-data

Downloading and processing data about Rust RFC PRs using the GitHub API
JavaScript
1
star
58

sunjay

1
star
59

snake

Snake Game AI
JavaScript
1
star
60

coherence-in-chalk

Paper about Coherence in Chalk
TeX
1
star
61

spaceship-ai

Models fighting spaceships in a field of obstacles.
Python
1
star
62

poker

Poker hands calculator (in early development)
JavaScript
1
star
63

pixelated

Implementation of the game pixelated
Rust
1
star
64

brightness-toggle

Toggle the screen brightness on/off
JavaScript
1
star
65

balls-game

Rust
1
star
66

sealdb

Database Implementation Experimentation (work in progress)
Rust
1
star
67

brain-turtle

Library for generating turtle graphics commands with brain
1
star
68

dotfiles

My dotfiles and installation script
Shell
1
star
69

rethinkdb-demo

My demo of RethinkDB for my RethinkDB Power Hour Talk (April 28, 2016)
JavaScript
1
star
70

metal-warrior-x

(in progress) Game about the metal warrior who saves us from a post-apocalyptic world dominated by robots
Rust
1
star
71

ray-tracer

My implementation of the book Ray Tracing in a Weekend
C++
1
star
72

upp-7.0.0-travis

A version of the u++-7.0.0 installation compiled on a Travis CI machine.
C++
1
star