create account

Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen! by justyy

View this thread on: hive.blogpeakd.comecency.com
· @justyy · (edited)
$77.36
Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!
## Introduction to Logo Turtle
[LogoTurtle](https://helloacm.com/turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen/) is currently the FIRST and only one Chrome Extension for Turtle Graphics. I have also written [a PHP version of Logo Interpreter](https://steakovercooked.com/Software.Logo) in 2006 but that runs only on the server.

## Previous Contributions
- v0.0.5: [Turtle Programming v0.0.5: Adding IF/ELSE and STOP!](https://helloacm.com/turtle-programming-v0-0-5-adding-if-else-and-stop/)
- v0.0.4: [LogoTurtle: Make Variables and Comments](https://helloacm.com/logoturtle-make-variables-and-comments/)
- v0.0.3: [Turtle Graphics Programming Update: Adding text, jump, dot, fontsize, download as png](https://helloacm.com/turtle-graphics-programming-update-adding-text-jump-dot-fontsize-download-as-png/)
- v0.0.2: [LogoTurtle v0.0.2: ShowTurtle, HideTurtle, Color, Width and Help](https://helloacm.com/logoturtle-v0-0-2-showturtle-hideturtle-color-width-and-help/).
- Teach Your Kids Programming - The First Logo Interpreter (Turtle Graphics) in Chrome Extension!
 [v0.0.1](https://helloacm.com/teach-your-kids-programming-the-first-logo-interpreter-turtle-graphics-in-chrome-extension/)

## v0.0.6 New Features
[**This Commit**](https://github.com/DoctorLai/LogoTurtle/commit/671cd38250ead4d4505e7d31f8bfc6d057685112#diff-f522b2d4d6d98e52b7c846f7dcf397d7) has the following changes:

1. Add MoveTo function
2. Add Circle function
3. Add Turning (absolute degree)
4. Set Screen Color
5. Enhanced Error/Warning handling

## Screenshots
Let's put all the above in one LOGO source code to demonstrate:

```
ht cs screen green color yellow ; test comment
pu moveto -200 20 pd turn 270
repeat 8 [circle 50 fd 10 rt 45]
```

![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519980224/pcyrarrooe7rmtchgc5h.png)

# Parse Source Code with 2 Parameters
The `MoveTo` takes two parameters that moves the turtle to a given coordinate, which is handled by the following javascript.

```
case "moveto":
	expr = this.evalVars(word_next);
	try {
		word_next = eval(expr);
	} catch (e) {
		this.pushErr(word, LOGO_ERR_EVAL, expr);
		return false;
	}				
	if ((word_next == '') || (!isNumeric(word_next))) {
		this.pushErr(word, LOGO_ERR_MISSING_NUMBERS, word_next);
		return false;
	}
	second_word = getNextWord(s, y.next, U);
	second_word_word = second_word.word;
	expr = this.evalVars(second_word_word);
	try {
		second_word_word = eval(expr);
	} catch (e) {
		this.pushErr(word, LOGO_ERR_EVAL, expr);
		return false;
	}						
	if ((second_word_word == '') || (!isNumeric(second_word_word))) {
		this.pushErr(word, LOGO_ERR_MISSING_NUMBERS, second_word_word);
		return false;
	}					
	this.logo.moveTo(word_next, second_word_word);
	i = second_word.next;
	break;	
```

## Roadmap of Chrome Extension: Logo Turtle
1. Add Functions
2. Add IF/THEN/ELSE
3. Add Variables
4. Add Colors
5. Add MoveTo
6. Add PrintText
7. Add Circle
8. Add Arc
9. Add Eraser
10. Add Fill
11. Save As Picture
12. Save As Program
13. Comments
14. Add Recursion Support
15. Add Global/Local Scopes
16. etc. etc.

## Technology Stack
If an App can be written in [Javascript](https://helloacm.com/steemit-javascript-function-to-get-original-post-from-comments-permlink/), eventually it will be written in Javascript.

# Chrome Webstore
Install the [Turtle Programming for Kids](https://chrome.google.com/webstore/detail/logo-turtle/dcoeaobaokbccdcnadncifmconllpihp) Now!

# Contribution Welcome
Github: https://github.com/DoctorLai/LogoTurtle
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request.

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@justyy/turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 81 others
properties (23)
authorjustyy
permlinkturtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen
categoryutopian-io
json_metadata{"community":"utopian","app":"steemit/0.1","format":"markdown","repository":{"id":121791502,"name":"LogoTurtle","full_name":"DoctorLai/LogoTurtle","html_url":"https://github.com/DoctorLai/LogoTurtle","fork":false,"owner":{"login":"DoctorLai"}},"pullRequests":[],"platform":"github","type":"development","tags":["utopian-io","steemstem","programming","steemdev","cn-programming"],"links":["https://helloacm.com/turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen/","https://steakovercooked.com/Software.Logo","https://helloacm.com/turtle-programming-v0-0-5-adding-if-else-and-stop/","https://helloacm.com/logoturtle-make-variables-and-comments/","https://helloacm.com/turtle-graphics-programming-update-adding-text-jump-dot-fontsize-download-as-png/","https://helloacm.com/logoturtle-v0-0-2-showturtle-hideturtle-color-width-and-help/","https://helloacm.com/teach-your-kids-programming-the-first-logo-interpreter-turtle-graphics-in-chrome-extension/","https://github.com/DoctorLai/LogoTurtle/commit/671cd38250ead4d4505e7d31f8bfc6d057685112#diff-f522b2d4d6d98e52b7c846f7dcf397d7","https://helloacm.com/steemit-javascript-function-to-get-original-post-from-comments-permlink/","https://chrome.google.com/webstore/detail/logo-turtle/dcoeaobaokbccdcnadncifmconllpihp","https://github.com/DoctorLai/LogoTurtle","https://utopian.io/utopian-io/@justyy/turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1519980224/pcyrarrooe7rmtchgc5h.png"],"moderator":{"account":"ms10398","time":"2018-03-02T12:27:59.388Z","reviewed":true,"pending":false,"flagged":false},"questions":[],"score":0}
created2018-03-02 08:46:54
last_update2018-03-02 16:46:33
depth0
children5
last_payout2018-03-09 08:46:54
cashout_time1969-12-31 23:59:59
total_payout_value55.370 HBD
curator_payout_value21.994 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,952
author_reputation280,616,224,641,976
root_title"Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,586,965
net_rshares19,489,649,023,922
author_curate_reward""
vote details (145)
@ms10398 ·
Thank you for the contribution. It has been approved.

You can contact us on [Discord](https://discord.gg/uTyJkNm).

**[[utopian-moderator]](https://utopian.io/moderators)**
properties (22)
authorms10398
permlinkre-justyy-turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen-20180302t122809484z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-03-02 12:28:09
last_update2018-03-02 12:28:09
depth1
children0
last_payout2018-03-09 12:28:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length173
author_reputation27,572,487,973,390
root_title"Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,625,065
net_rshares0
@steemstem-bot ·
$0.64
<center><a href="www.steemit.com/@steemstem"><img src="https://media.discordapp.net/attachments/384404201544876032/405507994583957505/steemSTEM.png"></a><br><table><tr><th> </th><th> </th><th><a href="https://steemit.com/steemstem/@steemstem/helpful-guidelines-for-crafting-steemstem-content">Guidelines</a></th><th><a href="https://steemit.com/steemstem/@steemstem/steemstem-winter-2017-2018-project-update">Project Update</a></th><th> </th><th> </th></tr></table><br><a href="https://steemit.com/steemstem/@steemstem/being-a-member-of-the-steemstem-community"><b>Being A SteemStem Member</b></a></center>
👍  
properties (23)
authorsteemstem-bot
permlinkre-turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen-20180302t194325
categoryutopian-io
json_metadata""
created2018-03-02 19:43:27
last_update2018-03-02 19:43:27
depth1
children0
last_payout2018-03-09 19:43:27
cashout_time1969-12-31 23:59:59
total_payout_value0.642 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length606
author_reputation3,811,533,615,496
root_title"Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,707,496
net_rshares141,898,671,643
author_curate_reward""
vote details (1)
@superoo7 · (edited)
@justyy 想问一下,什么情况可以用#cn-programming ?
properties (22)
authorsuperoo7
permlinkre-justyy-turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen-20180302t222541428z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["justyy"],"app":"steemit/0.1"}
created2018-03-02 22:25:42
last_update2018-03-02 22:25:54
depth1
children1
last_payout2018-03-09 22:25:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length37
author_reputation27,763,618,634,121
root_title"Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,735,218
net_rshares0
@justyy ·
想让中国人看的编程文章?
properties (22)
authorjustyy
permlinkre-superoo7-re-justyy-turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen-20180303t014055959z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-03-03 01:40:57
last_update2018-03-03 01:40:57
depth2
children0
last_payout2018-03-10 01:40:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12
author_reputation280,616,224,641,976
root_title"Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,765,606
net_rshares0
@utopian-io ·
### Hey @justyy I am @utopian-io. I have just upvoted you!
#### Achievements
- WOW WOW WOW People loved what you did here. GREAT JOB!
- Seems like you contribute quite often. AMAZING!
#### Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a>
- Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)

**Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
properties (22)
authorutopian-io
permlinkre-justyy-turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen-20180303t072624353z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-03-03 07:26:24
last_update2018-03-03 07:26:24
depth1
children0
last_payout2018-03-10 07:26:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,061
author_reputation152,955,367,999,756
root_title"Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,821,313
net_rshares0