Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Jim Bauwens on November 02, 2011, 10:36:59 am
-
I've been a bit busy making a logo (http://en.wikipedia.org/wiki/Logo_%28programming_language%29) interpreter in Lua.
I'm going to participate with it in the Ti-Planet / Inspired-Lua contest (math section).
While I still need to make an on calc ui and editor, here are some screenshots that show some turtle graphics (together with the code):
(http://bwns.be/jim/logo.png)
to square
repeat 4 [left 90 forward 80]
end
repeat 36 [left 10 square]
(http://bwns.be/jim/logo2.png)
make "x 1
repeat 150 [forward :x left 89 make "x :x + 1]
-
This is awesomeeeeeeee
Congratulations !
For the Lua contest, right ? :D
-
Thanks =)
Yes, its for the contest :)
-
Good luck with all the rest.
I'm not so advanced in languages as you are but.. Good job, I guess. :D
-
Wow. Good luck, it is awesome.
Not really useful, but I'd love to play with that.
-
Thanks =)
Not really useful
You can visualize lot of mathematical stuff with it ;)
-
How about the mode I suggested where you can see the turtle move and draw the pattern instead of the pattern just appearing?
-
I'm not yet done, just finished the main core.
-
I submitted my first version for the TI-Planet contest.
While its not yet done, most you need is there.
Here is a little animated screenshot:
(http://bwns.be/jim/logo.gif)
Note that the colors (grey's) look a bit better on a real calculator :D
-
ooh, yum, that looks nice O.O
-
Congrats !
Could you post a link to download ?
TI-Planet staff haven't done it yet, and I really want to play with this awesome program !
-
I'm going to put it on TIPlanet.org today :)
-
Thanks guys :D
I'll upload the package after the contest has ended, as there are some bugs that I need to fix.
I just discovered a bug that the calculator reboots sometimes if you have a " in the code.
This is not my fault, but TI's. (Probably will get fixed if I report it)
The problem here is that " is a special token in Logo, and used allot.
One way to be sure it doesn't crash is to replace
"thiscode
with
first [thiscode]
It has the same effect in Logo.
Edit: as you can see in the screenshot, the bug is fixed in 3.10 (the emu runs 3.10), while I still had 3.02 on my calculator.
So, I'm happy again \o/
-
While there is already a sierpinski curve included, here is sierpinski's triangle (not included):
to sierp :n :l
if :n=0 [stop]
repeat 3 [sierp :n-1 :l/2 fd :l rt 120]
end
pu bk 100 lt 90 bk 100 pd
sierp 5 200
This is the result:
(http://bwns.be/jim/sierp.png)
-
looks awesome for such a small code...
can you comment line by line the code tho ? :o
-
Sure, first i'll expand it (short function names to long function names):
;define subroutine sierp
to sierp :n :l
;if the level is zero, stop
if :n=0 [stop]
;Draw 3 lines for the triangle, while calling itself recursively (to draw the triangles on the sides)
repeat 3 [
sierp :n-1 :l/2
forward :l
right 120
]
end
;put the turtle on the right spot
penup
back 100
left 90
back 100
pendown
;Draw a sierpinski triangle, 5 levels deep (200 is the size)
sierp 5 200
That should be clear enough :)