Coder Social home page Coder Social logo

rurtle's Introduction

Rurtle

Screenshot

Rurtle is an implementation of the turtle graphics done in Rust. Rurtle has its own little language, inspired by Berkeley Logo and Win Logo

Requirements

Rust nightly (Rurtle uses unstable features).

The Rurtle shaders require GLSL version 120 and thus at least OpenGL 2.

Running

Use cargo run -- [file1 file2 ...] to run Rurtle. Each file specified (if any) will be read and interpreted. After reading and executing all files, Rurtle will enter the REPL. You can enter any command there and play interactively with Rurtle.

Syntax

  • Comments: print 1 ; comment starts here
  • String literals: "Hello World"
  • Number literals: 13, 3.1415, -42
  • Lists: [3 4 5 6]
  • Variables: make "i" 0, print :i
  • Function calls: print 1 + 3, color 0.2 0.4 0.6
  • Function definitions: learn add :a :b do return :a + :b end
  • Conditionals: if :i = 2 do print "Two" else print "Not two" end
  • repeat-loop: repeat 4 do forward 100 right 90 end
  • while-loop: while :i <> 0 do make "i" :i - 1 end
  • Error handling: try tonumber "foo" else print "not a number" end

Loops can be nested and may have arbirary many statements in their bodies:

repeat 4 do
    repeat 4 do
        forward 100
        right 90
    end
    right 90
end

Functions:

forward <i>, backward <i>, right <i>, left <i>, color <r> <g> <b>, print <e>
penup, pendown, home, clear, realign <a>

For a complete list, see src/environ/functions/mod.rs.

Documentation/Language reference

For documentation of the modules, see here.

For an overview of the language and the available functions, look in quickstart/. The quickstart guide is written in Markdown and can be viewed on GitHub or locally converted to HTML by running make in the quickstart directory.

License

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Disclaimer: This program may eat your hamster, watch out.

rurtle's People

Contributors

kingdread avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.