Believe it or not my grandma got me into computer programming when I was about six years old when she bought me two issues of the magazine Input. I fondly remember (I’m kind of a nerd) the tutorials and programming listings in ZX spectrum magazines such as Your Sinclair. It’s no wonder that people have difficulty in getting into programming. Most machines from PC World nowadays don’t come with easily accessible beginners programming tools. Back when I was at school everyone could type:
10 PRINT "Hello world" 20 GOTO 10.
Now to even do that in a language like C requires a bit more effort.
I’ve benefited a lot over the past 25 odd years from people writing tutorials and given that this is the year that everyone is supposed to learn to code (even the mayor of New York is learning to code) I thought I might try to write a computer programming tutorial.
So what will I aim to do with this. So my thought was to write a mini planetarium program that you can use to find out what is in the sky on a given day/time from a particular place on Earth. Not only is this fairly useful but also its something that needs a bit of thought and can be extended to suit to abilities of anyone following this tutorial. Although of course it wouldn’t replace something like Stellarium! A screenshot from Stellarium is shown below and so this should give you an idea for what I’m aiming for – except perhaps more basic imagery… I’ll be doing this tutorial in the programming language BASIC, which stands for Beginners All-purpose Symbolic Instruction Code. It’s designed for people to pick up easily and for doing a wide variety of things. It’s fallen out of fashion of late but I think it’s a nice little language. This also has the advantage that you don’t need to install any software because I found a BASIC interpreter online that you can use in your web browser called Ready BASIC. It’s perhaps a little rough around the edges but it works well.
I have a slightly ulterior motive for doing this. Whenever I give talks and want to point out where to find Jupiter or Saturn in the sky that night I usually have to resort to a screen capture from Stellarium. But on projectors these captures often look washed out. So for a while I’ve wanted my own program to draw nice high quality drawings of parts of the night sky. So this serves two purposes at once. So in due course I’ll also post some code written in a language other than BASIC.
I don’t just want to teach programming but also program design. So this program should be able to show the position of the stars, Moon, planets, and various deep sky objects in the sky at a given date/time/location. So we want to be able to specify the time, the date, the location (as a latitude and longitude) and then get a map on the screen of the sky showing the Moon, planets, stars and deep sky objects. We want to be able to zoom in on a particular part of the sky so we’ll need to specify the ranges in azimuth and altitude on the screen. This all tells us what we want the program to do – not how to do it.
In the next blog post on this I’ll talk a bit more about how to do things, break down the job into manageable chunks, and show how to do the first thing: make a star chart from a freely available star catalogue.