In the last episode, we implemented the core of a Logo interpreter. Today we'll add on a renderer, because without a renderer it's basically a few unit tests that pass which isn't that impressive to show off. Let's get started.

I've tagged the code before this episode as before_episode_167 if you want to follow along.

git checkout before_episode_167

So before we started the last episode I added a Logo.Renderer that just drew a box, to make sure we'd have an easy way to start drawing when the time came. We can see it in iex:

iex -S mix
Logo.Window.start([])

I also wrote up an example script that we haven't explored yet. Let's look at it and tweak it a bit to pass our turtle instance into the window we render:

# We'll import Logo.Instance so we don't have to write that bit all the time import Logo.Instance # We're starting an instance here {:ok, logo} = Logo.Instance.start logo |> color({255, 0, 0}) |> pen_down |> forward(400)...