Coder Social home page Coder Social logo

amrdeveloper / turtle Goto Github PK

View Code? Open in Web Editor NEW
28.0 4.0 2.0 4.62 MB

Turtle Graphics ๐Ÿข implementation for Android Platform with Code Editor, Preview Screen and packages

Home Page: https://play.google.com/store/apps/details?id=com.amrdeveloper.turtle

License: MIT License

Kotlin 100.00%
drawing-app lilo logo programming-language turtle-graphics

turtle's Introduction

Turtle Graphics


Turtle is an Android Application inspired from the original Turtle Graphics and Logo, Logo is an educational programming language designed in 1967 by Computer scientists Wally Feurzeig, Seymour Papert, and Cynthia Solomon and it known for its use of turtle graphics, this project has a simple tree walking interpreted language called Lilo (Inspired from Logo too :D), with declarations statements, control flow, collections, and instructions for control the turtle in 2D Space which is our case a custom Android Canvas View and also control colors

Download

Get it on Google Play Amazon App Store Samsung Galaxy Store Huawei AppGallery

Screenshots

Features

  • Free And open source with no ads.
  • Full Text Editor that support auto complete, snippets, highlighter for Lilo.
  • Clear diagnostics messages with line number and column position.
  • Supports Lexer, Parser errors and Runtime exceptions
  • Preview custom view with turtle that show the current direction.
  • Full documentation view that teach you how to write your script.
  • Save and Update your current script into packages with name.

Declarations

  • Let Declaration to declare variables
let c = BLACK
  • Function Declaration to declare function with 0 or more parameters
fun f1 (n) {
   return n * 2
}

fun f2 {}

fun f3 (n) = n * 2

fun f4 = 1000

Control flow

  • If statement to execute block if the condition is true
if condition {}
elif condition2 {}
elif condition3 {}
else {}
  • Repeat statement to execute block n times
repeat n {

}
  • While statement to execute block while the condition is true
while condition {

}
  • Speed statement, take time in ms to wait before each next instruction
speed 100
  • Sleep statement, take time in ms to wait before the next instruction
sleep 100
  • Show statement, to show turtle pointer
show
  • Hide statement, to hide turtle pointer
hide
  • Stop statement, to stop the current execution
stop

Collections

  • List to collect values
let colors = [RED, BLUE, WHITE]
  • Access list element by index
color colors[0]
  • Update list element
colors[0] = YELLOW

Movement instructions

  • Rotate used to add value to the current turtle pointer degree
rotate 90
  • Forward used to move forward n space
forward 90
  • Backward used to rotate and move backward n space
backward 90
  • Right used to rotate and move right n space
right 90
  • Left used to rotate and move Left n space
left 90

Drawing Instructions

  • Circle used to draw circle around the current position with radius r
circle 50
  • Cube used to draw Cube around the current position with value v
cube 50

Coloring instructions

  • Color Instruction to change the current color
color BLUE

License

MIT License

Copyright (c) 2022 Amr Hesham

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

turtle's People

Contributors

amrdeveloper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

turtle's Issues

Using PenDown() and PenUp() ...

Hi Amr, I have a further issue. I think in your turtle-app it is not possible to use the methods PenDown() and PenUp() for the turtle. Is that right? I only noticed the methods Hide() and Show(), but I would like to see the movement of the turtle, if I change the position. Could you, please, implement these two methods for the turtle. It would be nice. Regards ... Gregor

Function return

Describe the bug
Functions don't properly resume from where called. Causes issues with recursive functions, like fractal trees

To Reproduce
Simple fractal tree:
move 375, 500
let colors =[RED, BLUE, GREEN, YELLOW]
let angle =30
rotate 90
fun y(level){
if(level >0){
color colors[level %4]
forward level10
rotate 360-angle
y(level-1)
rotate 2
angle
y(level - 1)
rotate 360-angle
backward level *10
}
}
y(10)

Expected behavior
Should make a fractal tree, not a simple spiral.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: moto pure
  • OS: Android 10
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Using Comments ...

Hi, I would like to use comments in my turtle's source code. Is this possible? Regards ... Gregor

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.