Hour of Code: Programming in Pencil Code

Scenes from coding events with Pencil Code
Welcome to our astronomical Hour of Code event! Here are the materials you will need to host a successful hour using Pencil Code.

Before you start, make sure you can set up an account and save work under an account. Make sure your school firewall does not block *.pencilcode.net. For kids to save their work, they will need to have access to their own domain under pencilcode.net.

Color, Images, and Astronomy

Click here to begin the video activity.

Computing does not end with computers! So this year we have an activity that shows how astronomers use computers to create images and understand their data. This activity is appropriate for 4th through 12th grade students, with no prior coding experience necessary.

Skip to specific projects here:

Tell us what you think! Submit a survey response.

This activity was created by volunteers August Muench, astronomer for the American Astronomical Society, Kim Arcand, visualization lead for NASA's Chandra X-ray Observatory, and Sydney Pickens and Matthew Dawson, both computer science educators with Google CS First. Thank you all!

Creative Coding

Learn how to make your own program to draw line art, and save it on your own website. Good for all ages.


The language used in Pencil Code is CoffeeScript. Background on the CoffeeScript language can be found in several good books online (for example here or also here).

Geometry and Coding: Angles and Arcs

Use Pencil Code to explore math facts about angles, arcs, and polygons. Good for middle school and high school math students.


Computational Thinking: Hangman

A one-to-two hour lesson introducing the basics of programming with Pencil Code by building one detailed project from end-to-end. Good for high school students and advanced middle school students who are motivated to take on a coding challenge.

Topics covered:


Other Resources

There are other ways to use Pencil Code at coding events.

Thank you for your participation!