Author Topic: [lua] Logo interpreter  (Read 20269 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
[lua] Logo interpreter
« on: November 02, 2011, 10:36:59 am »
I've been a bit busy making a logo 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):


Code: [Select]
to square
  repeat 4 [left 90 forward 80]
end

repeat 36 [left 10 square]


Code: [Select]
make "x 1
repeat 150 [forward :x left 89 make "x :x + 1]

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [lua] Logo interpreter
« Reply #1 on: November 02, 2011, 10:38:31 am »
This is awesomeeeeeeee

Congratulations !

For the Lua contest, right ? :D
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [lua] Logo interpreter
« Reply #2 on: November 02, 2011, 10:39:20 am »
Thanks =)
Yes, its for the contest :)

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: [lua] Logo interpreter
« Reply #3 on: November 02, 2011, 02:15:28 pm »
Good luck with all the rest.
I'm not so advanced in languages as you are but.. Good job, I guess. :D


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [lua] Logo interpreter
« Reply #4 on: November 02, 2011, 02:31:28 pm »
Wow. Good luck, it is awesome.
Not really useful, but I'd love to play with that.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [lua] Logo interpreter
« Reply #5 on: November 02, 2011, 02:33:01 pm »
Thanks =)

Quote
Not really useful
You can visualize lot of mathematical stuff with it ;)

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: [lua] Logo interpreter
« Reply #6 on: November 02, 2011, 03:16:44 pm »
How about the mode I suggested where you can see the turtle move and draw the pattern instead of the pattern just appearing?

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [lua] Logo interpreter
« Reply #7 on: November 02, 2011, 04:01:07 pm »
I'm not yet done, just finished the main core.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [lua] Logo interpreter
« Reply #8 on: November 08, 2011, 11:33:22 am »
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:


Note that the colors (grey's) look a bit better on a real calculator :D

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [lua] Logo interpreter
« Reply #9 on: November 08, 2011, 11:42:41 am »
ooh, yum, that looks nice O.O

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [lua] Logo interpreter
« Reply #10 on: November 08, 2011, 12:49:58 pm »
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 !

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [lua] Logo interpreter
« Reply #11 on: November 08, 2011, 01:02:35 pm »
I'm going to put it on TIPlanet.org today :)
« Last Edit: November 08, 2011, 01:02:41 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [lua] Logo interpreter
« Reply #12 on: November 08, 2011, 01:53:29 pm »
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
Code: [Select]
"thiscode
with
Code: [Select]
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/
« Last Edit: November 08, 2011, 03:17:20 pm by jimbauwens »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [lua] Logo interpreter
« Reply #13 on: November 09, 2011, 10:44:04 am »
While there is already a sierpinski curve included, here is sierpinski's triangle (not included):
Code: [Select]
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:
« Last Edit: November 09, 2011, 11:54:15 am by jimbauwens »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [lua] Logo interpreter
« Reply #14 on: November 09, 2011, 11:36:38 am »
looks awesome for such a small code...

can you comment line by line the code tho ? :o
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation