create account

Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect! by justyy

View this thread on: hive.blogpeakd.comecency.com
· @justyy · (edited)
$56.65
Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!
## Introduction to Logo Turtle
[LogoTurtle](https://helloacm.com/turtle-programming-v0-0-9-add-setx-sety-square-and-rect/) 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.8: [Turtle Programming v0.0.8: /* */ comments, dotxy, and javascript!](https://helloacm.com/turtle-programming-v0-0-8-comments-dotxy-and-javascript/)
- v0.0.7: [Turtle Programming v0.0.7:  Functions with Parameters + Recursion!](https://helloacm.com/turtle-programming-v0-0-7-functions-with-parameters-recursion/)
- v0.0.6: [Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!](https://helloacm.com/turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen/)
- 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.9 New Features
Along with bug fixes and code tweaks, [**This Commit**](https://github.com/DoctorLai/LogoTurtle/commit/5e0d186b293b0d9f265f5434b257d9944442e953) has added the support of the following features/functions:

1. Add `SetX`, `SetY` that allows turtle to move in only 1 directions. (one parameter)
2. Set `Square` to draw a filled square. (one parameter)
3. Add `Rect` to draw a filled rectangle. (two parameters)

## Screenshots
![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1520305382/acdffeyl9uuwsmgwmoco.png)

Drawing a curve
```
ht cs make "x 1 make "y 1
repeat 100 [
  setx :x
  sety :y
  make "x :x+1 make "y :y*1.05
]
```
![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1520305534/skqs71zwbicesuvwgsx7.png)

## SetX and SetY in Javascript
```

case "setx":
	word_next = this.evalVars(word_next);
	if ((word_next == '') || (!isNumeric(word_next))) {
		this.pushErr(word, LOGO_ERR_MISSING_NUMBERS, word_next);
		return false;
	}
	this.logo.moveToX(parseFloat(word_next));
	i = y.next;
	break;		
case "sety":
	word_next = this.evalVars(word_next);
	if ((word_next == '') || (!isNumeric(word_next))) {
		this.pushErr(word, LOGO_ERR_MISSING_NUMBERS, word_next);
		return false;
	}
	this.logo.moveToY(-parseFloat(word_next));
	i = y.next;
	break;	
```

The Y coordinate mapping to canvas need to be inverted as the positive Y in Logo Coordinate system have a smaller Y value in Canvas.

## 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. Sleep
17. 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-9-add-setx-sety-square-and-rect">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 111 others
properties (23)
authorjustyy
permlinkturtle-programming-v0-0-9-add-setx-sety-square-and-rect
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","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","cn-programming","drawing"],"links":["https://helloacm.com/turtle-programming-v0-0-9-add-setx-sety-square-and-rect/","https://steakovercooked.com/Software.Logo","https://helloacm.com/turtle-programming-v0-0-8-comments-dotxy-and-javascript/","https://helloacm.com/turtle-programming-v0-0-7-functions-with-parameters-recursion/","https://helloacm.com/turtle-programming-v0-0-6-adding-circle-moveto-turn-and-screen/","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/5e0d186b293b0d9f265f5434b257d9944442e953","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-9-add-setx-sety-square-and-rect"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1520305382/acdffeyl9uuwsmgwmoco.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1520305534/skqs71zwbicesuvwgsx7.png"],"moderator":{"account":"ms10398","time":"2018-03-06T13:20:43.367Z","reviewed":true,"pending":false,"flagged":false},"questions":[{"question":"Is the project description formal?","answers":[{"value":"Yes it’s straight to the point","selected":true,"score":10},{"value":"Need more description ","selected":false,"score":5},{"value":"Not too descriptive","selected":false,"score":0}],"selected":0},{"question":"Is the language / grammar correct?","answers":[{"value":"Yes","selected":true,"score":20},{"value":"A few mistakes","selected":false,"score":10},{"value":"It's pretty bad","selected":false,"score":0}],"selected":0},{"question":"Was the template followed?","answers":[{"value":"Yes","selected":true,"score":10},{"value":"Partially","selected":false,"score":5},{"value":"No","selected":false,"score":0}],"selected":0},{"question":"How do you rate the amount of work?","answers":[{"value":"Very High","selected":false,"score":20},{"value":"High","selected":false,"score":16},{"value":"Medium","selected":true,"score":12},{"value":"Low","selected":false,"score":7},{"value":"Very Low","selected":false,"score":3}],"selected":2},{"question":"How do you rate the impact on the Project?","answers":[{"value":"Very High","selected":false,"score":20},{"value":"High","selected":false,"score":16},{"value":"Medium","selected":true,"score":12},{"value":"Low","selected":false,"score":7},{"value":"Very Low","selected":false,"score":3}],"selected":2}],"score":100}"
created2018-03-06 03:08:21
last_update2018-03-06 13:20:45
depth0
children6
last_payout2018-03-13 03:08:21
cashout_time1969-12-31 23:59:59
total_payout_value39.794 HBD
curator_payout_value16.851 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,334
author_reputation280,616,224,641,976
root_title"Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,520,955
net_rshares17,321,568,551,148
author_curate_reward""
vote details (175)
@magicmonk ·
cool project
properties (22)
authormagicmonk
permlinkre-justyy-turtle-programming-v0-0-9-add-setx-sety-square-and-rect-20180307t115346854z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-03-07 11:53:48
last_update2018-03-07 11:53:48
depth1
children0
last_payout2018-03-14 11:53:48
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_reputation1,107,383,722,367,267
root_title"Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,854,136
net_rshares0
@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-9-add-setx-sety-square-and-rect-20180306t132053413z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-03-06 13:20:54
last_update2018-03-06 13:20:54
depth1
children0
last_payout2018-03-13 13:20:54
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.9: Add SetX, SetY, Square and Rect!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,625,348
net_rshares0
@steemitboard ·
@justyy, thank you for supporting @steemitboard as a witness.

[![](https://steemitimages.com/70x70/http://steemitboard.com/notifications/supportboard.png)](http://steemitboard.com/@justyy) Here is a small present to show our gratitude
You can click on your award to jump to your Board of Honor

Once again, thanks for your support!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-justyy-20180306t070338000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notifications.png"]}
created2018-03-06 07:03:36
last_update2018-03-06 07:03:36
depth1
children0
last_payout2018-03-13 07:03:36
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_length332
author_reputation38,975,615,169,260
root_title"Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,560,181
net_rshares0
@steemstem-bot ·
$0.57
<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-9-add-setx-sety-square-and-rect-20180306t190333
categoryutopian-io
json_metadata""
created2018-03-06 19:03:33
last_update2018-03-06 19:03:33
depth1
children0
last_payout2018-03-13 19:03:33
cashout_time1969-12-31 23:59:59
total_payout_value0.565 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.9: Add SetX, SetY, Square and Rect!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,689,449
net_rshares142,103,710,580
author_curate_reward""
vote details (1)
@tensor ·
I love playing with turtle, I  implemented my own in clojure awhile ago.    Its a really great way to exercise your programming skills. 

Great extension btw.
properties (22)
authortensor
permlinkre-justyy-turtle-programming-v0-0-9-add-setx-sety-square-and-rect-20180306t051744756z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-03-06 05:17:42
last_update2018-03-06 05:17:42
depth1
children0
last_payout2018-03-13 05:17: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_length158
author_reputation87,856,203,149,624
root_title"Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,542,181
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-9-add-setx-sety-square-and-rect-20180306t170751507z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-03-06 17:07:51
last_update2018-03-06 17:07:51
depth1
children0
last_payout2018-03-13 17:07:51
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.9: Add SetX, SetY, Square and Rect!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id42,669,307
net_rshares0