Drawing a logo in Logo

Last modified date

Comments: 0

I intend to make a video on this, but I’ve not played with screen recording, things to learn. But I will need some kind of chronology so a rough write-up before I forget.

Code is over here. If you can do me a better version – any language – I will be made happy.

I watch so many YouTube videos these days, can’t help wanting to have a go myself. I’m not exactly new to video, have been playing with it since way back when, but really good tech is within easy reach, and online video being a thing, would be remiss of me not to have a proper go.

In a vaguely Marshall McLuhan kind of way, the form of a channel is a major part of it’s content. Identity/branding is a subtle but significant factor in the enjoyment of media. Long story short, I want to do the whole fancy intro thing.

While pondering this I remembered years back, when every band had a logo (think Crass, Motorhead…), I designed one for myself. Nigel tells me I used it for Fear of Thought. Is more or less a geometric-ish line drawing. I had a go at recreating it in LibreOffice Draw not long ago, but have since changed computers a bit, when I came to look for it again, no idea where to look. Then I remembered the Logo language…

Logo the Language

Regrettably it’s been pretty much been forgotten. Wikipedia has some history. In short, originating in 1967, it’s kind-of a bastard lovechild of Lisp and BASIC. While it is very capable, a lot of the emphasis was on it being a language to learn languages. A key part being turtle graphics, where you tell a pointer how to move around on screen, leaving a trail (should’ve been called Slug).

There’s a lovely idea mentioned on Wikipedia:

[[…”body-syntonic reasoning”, where students could understand, predict, and reason about the turtle’s motion by imagining what they would do if they were the turtle…]]

So if you do:

PENDOWN
FORWARD 10
RIGHT 90
FORWARD 10
RIGHT 90
FORWARD 10
RIGHT 90
FORWARD 10
PENUP

You get a square.

There are lots of different versions of Logo, the de facto standard being Berkeley (UCB) Logo. Source is on GitHub. There are builds for Linux, Mac OS & MS Windows. Conveniently for me, it only took a :

sudo apt install ucblogo

Although it feels very dated, it works fine for me.

There is a CLI but I would up just using a text editor, reloading every revision.

So, my logo, first pass :

cs
pu
lt 90
fd 25
pd
fd 75
rt 90
fd 100
lt 90
fd 100
rt 135
fd 150
repeat 135 [
rt 1
fd 1
]
fd 125
pu
fd 30
pd
fd 10
ht

Hmm…

Something wrong with the shape, but obvious problem if I want to use this anywhere, need a thicker line.

I’d read that Logo was sort-of functional, very good for drawing fractals. So I thought a recursive version had to be tried.

This is when the time started getting eaten.

Functions in Logo look like this:

to logo :line1 :line2 :line3 :line4 :line5 :curveStep :line6 :line7 :line8
pu
lt 90
fd :line1
pd
fd :line2
rt 90
fd :line3
lt 90
fd :line4
rt 135
fd :line5
repeat 135 [
rt 1
fd :curveStep
]
fd line6
pu
fd line7
pd
fd line8
end

Syntax for variables looks horrid to modern eyes:

make "x :x+ 1

is x++

Some of the documentation is very dated, hardly readable in style.

But with trial and error, I could be wrong, it seems you can’t pass functions to functions.

So I swapped out the fd lines, swapped in a a call to function squares :

to square
fd 3
rt 90
fd 3
rt 90
fd 3
rt 90
fd 3
rt 90
end

to squares :nsquares
repeat :nsquares [
fd 1
square
]
end

I also separated the bits of code above that defined the shape into one function, another function to scale the lengths of line segments.

By now I was tiring of it, gave up on recursion. But still wanted to draw the logo.

The squares thing produced ugly corners. So I reworked it to draw circles instead.

There followed a long period of trying to get the logo how I remembered/wanted it.

I only had a very brief period when the interpreter misbehaved. As a test I whacked one of the variables in circles way beyond sense. Got a lovely pattern:

A ridiculous number of iterations later, I got something near enough –

Source. It draws really slowly, quite charming.

admin

Leave a Reply

Your email address will not be published.

Post comment