News for hackers. Stuff that matters.
Re:Logo 15-word challenge (1997) by hackyhacky on Monday October 28, 2019 @01:18PM (#21379105)
These programs rely on Logo's turtle interface, which is a convenient and intuitive way to describe graphics imperatively. It's great for kids. These days, Python also has a turtle library (edit: built-in! part of the standard library, for some reason), heavily inspired by Logo, which means that the code on this page can be easily translated into Python. Here are some example that you can run at home (since I assume more people have access to Python these days than likely have a Logo interpreter installed). Edit: these are Python translations (by me) of the top three entries on the linked page.

    import turtle
    import math
    turtle.tracer(0,0) # remove this line to watch the drawing

    def spirals():
        # repeat 1800 [fd 10 rt repcount + .1]
        for repcount in range(1800):
             turtle.fd(10)
             turtle.rt(repcount+.1)
        turtle.update()

    def snowflakes(variant=6):
        # repeat 8 [rt 45 repeat 6 [repeat 90 [fd 2 rt 2] rt 90]]
        for _ in range(8):
            turtle.right(45)
            for _ in range(variant):
                for _ in range(90):
                    turtle.forward(2)
                    turtle.right(2)
                turtle.right(90)
        turtle.update()

    def orb():
        # for [i 0 420] [seth :i repeat :i [fd 2 rt 1] pu home pd]
        for i in range(0,420):
            turtle.seth(i)
            for _ in range(i):
                turtle.forward(2)
                turtle.right(1)
            turtle.penup()
            turtle.home()
            turtle.pendown()
        turtle.update()
Re:Logo 15-word challenge (1997) by misterdoubt on Monday October 28, 2019 @01:39PM (#21379387)
> built-in! part of the standard library, for some reason

Well, as far as I can tell, the reason is that

> Logo's turtle interface [...] is a convenient and intuitive way to describe graphics imperatively. It's great for kids.

:)

Re:Logo 15-word challenge (1997) by SamBam on Monday October 28, 2019 @02:49PM (#21380199)
I'm a Python newbie, running on macOS 10.13 with Python 2.7.10. When I save the above as turtle.py, and run with `python turtle.py` in the Terminal, I see an almost instantaneous flash of a tiny window, which then disappears.

When I remove the tracer line to "watch the drawing," I don't even get that. The Terminal just returns instantly.

Looking at tracer documentation, it's supposed to be `(which-frames-to-render, delay)`. If I set it to `turtle.tracer(1, 10000)` I get exactly the same flashing window as (0,0).

How can I see the result?

Re:Logo 15-word challenge (1997) by hackyhacky on Monday October 28, 2019 @02:58PM (#21380288)
Don't save the file to turtle.py, because then the "import turtle" line might try to import itself. Call it turtlestuff.py. Then do this in terminal:

  python -i turtlestuff.py
Then you'll get an interactive Python prompt and you can call the functions directoy, e.g.

  spirals()
Hope this helps you!
Re:Logo 15-word challenge (1997) by DonHopkins on Monday October 28, 2019 @09:35PM (#21383562)
>because then the "import turtle" line might try to import itself

Then you get turtles all the way down!

Re:Logo 15-word challenge (1997) by SamBam on Monday October 28, 2019 @03:40PM (#21380743)
Ah, thank you.
Re:Logo 15-word challenge (1997) by hackyhacky on Monday October 28, 2019 @03:02PM (#21380324)
Alternatively, if you save the file as turtlestuff.py, you can run this:

  python -c 'from turtlestuff import *; snowflakes(); turtle.mainloop()'
or

  python -c 'from turtlestuff import *; snowflakes(3); turtle.mainloop()'
or

  python -c 'from turtlestuff import *; orb(); turtle.mainloop()'
Re:Logo 15-word challenge (1997) by vkaku on Monday October 28, 2019 @02:41PM (#21380130)
Who'd have thought this was a built in.
Re:Logo 15-word challenge (1997) by Tade0 on Monday October 28, 2019 @01:37PM (#21379362)
Logo was my first programming experience - my older sister(who had Logo in school) introduced me to a few basic commands.

These quickly turned out to be insufficient, so I reverse-engineered the examples shipped with the platform. We didn't have internet access, so that was the only viable option.

When that turned out to be insufficient I noticed that many Logo commands were three characters long and highlighted, so I generated all the three-character combinations and checked them out one by one.

Turns out you can make games in Logo, but sounds and keyboard interactions introduce pauses in the main loop.

Eventually this new browser named Internet Explorer 6, which shipped with a language called JScript, proved to be more interesting, even though I didn't understand what a "<div>" was and how to write a for loop properly.

Re:Logo 15-word challenge (1997) by vkaku on Monday October 28, 2019 @02:42PM (#21380136)
Mine too.
Re:Logo 15-word challenge (1997) by cr0sh on Monday October 28, 2019 @04:42PM (#21381418)
While this challenge does show off the complexity and beauty of Logo's "turtle graphics", it has often struck me as a tragedy of the language that, for most people who have encountered Logo, they are led to believe that graphics is all it can do (or its only purpose).
Re:Logo 15-word challenge (1997) by jhbadger on Monday October 28, 2019 @05:13PM (#21381743)
Indeed. I've recently discovered NetLogo, which is a variant designed for making simulations, and it is amazing how you can get a sophisticated simulation in about a page of code.

https://ccl.northwestern.edu/netlogo/index.shtml

Re:Logo 15-word challenge (1997) by DonHopkins on Monday October 28, 2019 @09:38PM (#21383571)
That's actually why Terrapin published my "Logo Adventure" on the C64 utilities disk as a non-graphical example of list processing with Logo.

https://medium.com/@donhopkins/logo-adventure-for-c64-terrap...

>Logo Adventure for C64 Terrapin Logo

>When I was 17, Terrapin published my first commercial code on their C64 Logo utilities disk: a Logo Adventure program, a simple non-graphical game that showed off Logo’s list processing and functional programming capabilities.

Re:Logo 15-word challenge (1997) by susam on Monday October 28, 2019 @03:06PM (#21380379)
As a result of a recent thread[1] on HN regarding Logo, we now have a Slack workspace[2] and Freenode IRC channel[3] for Logo fans. Please do join them even if you don't remember Logo anymore. The intention here is not to discuss Logo but to share the joy of computing that we discovered through Logo and has remained in our lives.

[1]: https://news.ycombinator.com/item?id=21374341

[2]: https://bit.ly/fd100slackinvite

[3]: #fd100 at chat.freenode.net

Re:Logo 15-word challenge (1997) by carapace on Monday October 28, 2019 @04:33PM (#21381347)
Reminds me of Algorithmic Information Theory:

> Algorithmic information theory principally studies measures of irreducible information content of strings (or other data structures). Because most mathematical objects can be described in terms of strings, or as the limit of a sequence of strings, it can be used to study a wide variety of mathematical objects, including integers.

https://en.wikipedia.org/wiki/Algorithmic_information_theory

Cf. Chaitan, Kolmogorov, and Solomonoff.

Or Schmidhuber's "THEORY OF BEAUTY & LOW-COMPLEXITY ART" http://people.idsia.ch/~juergen/beauty.html

Re:Logo 15-word challenge (1997) by pgtan on Monday October 28, 2019 @04:29PM (#21381297)
Even simple thing like drawing the Euler spiral has much more effect, if you visualize the turtle motion, so you can see how the motion turns at some point and the turtle starts going back on the same way down.

cs repeat 360 [fd 10 lt product 2 repcount wait 5]

or a variant of David Eisenstat's code:

cs pu setpos [-100 -100] pd repeat 8 [rt 45 repeat 4 [repeat 45 [fd 5 rt 2 wait 1] rt 135]]

of course Logo is LISP, so you can do stuff like

? show map [[x] se sum # x ?REST] [1 2 3]

[[2 2 3] [4 3] [6]]

Re:Logo 15-word challenge (1997) by 9214 on Monday October 28, 2019 @03:19PM (#21380502)
Re:Logo 15-word challenge (1997) by wintorez on Monday October 28, 2019 @12:40PM (#21378565)
Yehuda Katz's name is in there somewhere.
Re:Logo 15-word challenge (1997) by code_duck on Monday October 28, 2019 @01:48PM (#21379519)
I like how it links to his Geocities page.
Re:Logo 15-word challenge (1997) by brownbat on Monday October 28, 2019 @08:12PM (#21383131)
From one entry:

> The really interesting part is that the effect is entirely destroyed if you replace "fd 40 fd 40" by "fd 80".

Fascinating...

Re:Logo 15-word challenge (1997) by Paperweight on Monday October 28, 2019 @01:50PM (#21379535)
I wonder what would happen if you combined this with a Game of Life type algorithm?
Re:Logo 15-word challenge (1997) by icedata on Monday October 28, 2019 @02:29PM (#21380013)
My boss at Logo Computer Systems, Brian Silverman, produced a custom version of Logo with Life Game instructions included (implemented in 6502 asm for //e). This was never marketed.
Re:Logo 15-word challenge (1997) by Paperweight on Tuesday October 29, 2019 @04:28PM (#21391613)
What was it like? I see on his Wikipedia page that he's made a lot of discrete cellular automata over the years, but Logo seems more...analog and continuous?
Re:Logo 15-word challenge (1997) by icedata on Thursday November 07, 2019 @02:53PM (#21476695)
It was basically a specialised version of Apple Logo // (which we produced) adding primitives for constructing cellular automata. You would basically define rules, which would be executed and displayed. It was very fast as the execution engine was written in 6502 asm.
Re:Logo 15-word challenge (1997) by maxhallinan on Monday October 28, 2019 @08:15PM (#21383147)
You might be interested in StarLogo. [1] It's a Logo dialect designed for simulating decentralized systems and emergent behavior.

1. https://en.wikipedia.org/wiki/StarLogo

Re:Logo 15-word challenge (1997) by kleer001 on Monday October 28, 2019 @03:43PM (#21380790)
Likely a funny looking mess.
Re:Logo 15-word challenge (1997) by quickthrower2 on Monday October 28, 2019 @02:17PM (#21379864)
How cute, each name links to their email address. Very 1997!