I'm going to be involved with a sort of 'open day' at my university in a few weeks. As part of this time, I (along with a coworker) am being given a whole bunch of high-school level students for two hours, as well as a computer lab big enough to contain them all, and I have to do some kind of activity or set of activities with them to encourage them to do computer science (at my university, ideally, but in general also). I am at an absolute loss as to what to do here, and welcome any and all suggestions.

  • $\begingroup$ I'm not a teacher nor an expert, however I suggest you to teach them how to program a small puzzle-game (pick one whose generalization is NP-complete) covering aspects like: level generation, solution checking, automatic solution finding :-) $\endgroup$
    – Vor
    Commented Jun 24, 2013 at 9:03
  • 1
    $\begingroup$ I liked the 2008 Royal Institution Christmas Lectures. You might want to try similar activities/demos. $\endgroup$ Commented Jun 25, 2013 at 19:01

13 Answers 13

  • You can have them draw pictures using context-free grammar. context free art This also works for people who never programmed before and scales to experienced programmers. The basic language is easy enough to explain in maybe half an hour.
  • Learning something about geometry using Turtle graphics should be nice too. Logo was designed for children, so highschool students should have no problem. There are nice videos about children using Logo on youtube
  • If you can get your hands on some MindStorms robots, programming them is lots of fun.
  • There are a variety of programming games in which you program robots to fight each other, or assembly programs that try to overwrite each other in a virtual machine. Wikipedia on the topic, related stackoverflow question
  • You can also think about some kind of hardware project. Making a microcontroller blink a LED depending on the number of unread e-mails in your inbox for example.
  • Have them implement different maze generation algorithms, try to come up with criteria that make mazes "difficult for humans". If time permits extend the algorithms to include not only corridors but also rooms.
  • Buy a couple of Arduinos and LEDs. Let them program the blinkenlights.
  • 1
    $\begingroup$ You may want to add the links to Khan Academy's computer programming tutorials to the list: It's a really cool/interactive addition to above. For example: khanacademy.org/cs/intro-to-animation/830742281 $\endgroup$
    – PhD
    Commented Jun 26, 2013 at 5:05
  • $\begingroup$ +1 for the CFGs too - another version of the same notion that would be a good one to try and apply would be to try and do bush-drawing with an Iterated Function System; have them start with a rectangle, set up several more rectangles, and then repeat the 'contents' of the first rectangle (including all the subrectangles) into each of the subrectangles. You could have a digital version set up for comparison purposes. $\endgroup$ Commented Sep 5, 2013 at 21:25

Check out Computer Science Unplugged. From their site:

CS Unplugged is a collection of free learning activities that teach Computer Science through engaging games and puzzles that use cards, string, crayons and lots of running around.

The activities introduce students to underlying concepts such as binary numbers, algorithms and data compression, separated from the distractions and technical details we usually see with computers.

CS Unplugged is suitable for people of all ages, from elementary school to seniors, and from many countries and backgrounds. Unplugged has been used around the world for over fifteen years, in classrooms, science centers, homes, and even for holiday events in a park!

  • 1
    $\begingroup$ This is a nice suggestion, but I suspect the OP wants something that actually uses the computer lab that has been set aside. $\endgroup$ Commented Jun 24, 2013 at 9:06
  • $\begingroup$ Valid point. There should be a robocode project for people who don't know programming. $\endgroup$
    – Pål GD
    Commented Jun 24, 2013 at 11:15

Most Computer Science undergraduates that I know consider learning to program to be the most painful and demoralizing part of their education. I would therefore stay away from anything that has to do with programming itself. As scphantm pointed out already, you probably also won't have time for this.

What your looking for is a two-hour exercise that satisfies two goals:

  • It's exciting enough to keep high-school graduates interested enough for two hours,
  • It will give them a glimpse of what Computer Science is, and hopefully get them interested in it.

The first goal is fairly independent of what you're actually going to show and has a lot more to do with being a good teacher/presenter. Good didactic practice, i.e. keeping your audience on their toes, letting them try small things in groups, giving them a breather every 15 minutes, and so on.

The second goal is a bit of a tricky bit, and what I think works best here is to take a problem which can be explained with their current knowledge, show how you can describe the solution algorithmically, and then show how that solution can be analysed and improved.

A good example is the shortest path problem in graphs, otherwise known as a GPS navigation system. No explanation needed. You can give them a small map with edge weights/length drawn in and a bunch of crayons to actually execute the algorithm as you describe it.

You can then start a discussion on how you would find a shortest path, and so on, let them try to formulate it as an algorithm, etc... Then you describe Dijkstra's algorithm, letting them colour the nodes as visited, tentative , and unvisited sets. Bam. You've got an algorithm!

If you still have time, you can go on to explain some details, i.e. stuff that we take for granted like finding the minimum in the set of tentative nodes. If you get this far, you can show the difference between linear search and a heap, and as a bonus you get to introduce $\mathcal O$-notation.

Having said all that, this is about as far as I would go. Stay away from the whole $P$ vs. $NP$ discussion with a ten foot pole. Although most Computer Scientists find this fascinating, most high-school students won't. I know this from experience. The key, in my opinion, is to start with a problem that they can understand, or relate to, and take it from there without the need for much introduction.


If you only have 2 hours, you aren't going to get much coding done. Just learning syntax will be hard in that time, but there are plenty of things that can be done instead.

As a suggestion, try teaching them control flow and the importance of being specific:

  1. Divide the class into 2, "robots" and the others "programmers".
  2. Come up with a suitable challenge that requires some simple logic, looping etc. - there is an example below.
  3. Have the "programmers" write out a list instructions that are given to the "robots"
  4. Have the "robots" perform the instructions, but let the "robots" know that if the instructions are confusing they are allowed to stop, error or otherwise act up until the "programmer" stops and debugs them. Guaranteed, if given a chance to play up, a high schooler will.

As an example task, set up some tubs of different coloured balls, with corresponding coloured strips of paper elsewhere and enough small buckets for each robot/programmer pair. The task is to make the robot fill the bucket with balls, however to do so they can only take balls that match a specific strip of paper. If there are no more balls of that colour in a tub, then the robot must return their strip of paper and collect a new one.

This task requires conditional branching, looping, error handling, and thinking proceedurally. All things that a programmer needs to be good at, regardless of the language or activity.

Run something like this twice so the "robots" and "programmers" can swap. In between, give a small lesson on the above patterns of thinking, and they will perform much better in the second, close out with a small talk on the big events in programming - defeating the Nazis, going to the moon, the internet, and you'll have a room of potential and engaged programmers!

  • 1
    $\begingroup$ Why can't I give this a +10? This is a great idea. $\endgroup$
    – Xynariz
    Commented Sep 5, 2013 at 23:05
  • $\begingroup$ @Xynariz thanks! I've done it a few times with really small groups, and it generally ends up being equal parts fun and frustrating - however the frustration is at the misbehaving "robots" and not computers the kids don't yet understand. $\endgroup$
    – user8632
    Commented Sep 5, 2013 at 23:11
  • $\begingroup$ Sometimes people don't seem to understand that computers are very, very good at doing exactly what you tell them.. nothing more, nothing less. There's even a CyberChase episode about this ... (hides) $\endgroup$
    – Xynariz
    Commented Sep 5, 2013 at 23:15

I've trained many programmers. If all you have is 2 hours, don't bother with teaching them how to code. Computer lab is unnecessary too. To go from zero to hello world, you will loose half the class and spend and hour 45 of your 2 hours dealing with glitches and get nothing done.

You may have more luck showing them what its like to think like a programmer. Give each of them a pad of paper and a pen and tell them to write a program in their own language on how to pick up their cell phone off the desk and make a phone call. Walk thru their answers. If your a code jocky of any salt you can step thru their programs and tell them how to make them better and how to accomidate the detail you need to have. Then ask them to write a program in their own words to do something else mundane. put your pants on, brush your teeth, open a door, whatever. Do the same with that program.

Give them a taste of what its like to THINK like a programmer. They will certainly get more out of that than you trying to teach them Python in 2 hours.


You might try Alice. It's an IDE and API for 3D animation. It has all sorts of built in objects (rabbits, aliens, trees, buildings, ...) that you can place in an initial scene, with very high-level methods: like walk(north) (which animates the arms and legs while the character moves) and say("my name is Winky") which might cause a cartoon bubble to come out of the characters mouth.

It allows you to hook keyboard and mouse events so you can do things that are interactive.

The underlying programming language is Java, but the IDE gives you a graphical variant where you drag and drop parts of expressions into an editor window. (It won't let you create a syntax error.)

I think you could get it all preset up with a scene so that someone with no programming experience could do something interesting in just a couple of hours.

  • 1
    $\begingroup$ I'd be hesitant to use this approach; it might work for younger students, but highschool students are more likely to see it as childish. That said, this is a fast way to complete something in the time limit of 2 hours... $\endgroup$
    – Izkata
    Commented Jun 24, 2013 at 18:06

Coding, even in a toy or graphical language, seems far-fetched in the course of an hour. Hell, I'm not sure I could pick up Alice again and do anything worthwhile in 2 hours. Maybe a weekend, but not 2 hours.

I'd suggest boiling CS down to the bare essentials: problem solving and analysis. Break the group into teams. Take 10 minutes to describe a few high-level computational problems. These should be easy problems that can be easily explained to people with little mathematical or CS background. Examples include:

  1. Sorting lists
  2. Finding minimal spanning trees
  3. Computing (approximate) roots of integers
  4. etc.

Take another 10 minutes for further discussion, and to explain the task. Each group is assigned one problem, for which they are to brainstorm solutions. The team will have a half hour to collaboratively figure out a solution or solution(s) to their assigned problem. Then, take an hour to go over the solutions in the entire group, and let the kids figure out whether they work or not, whether there's a faster/better way to solve the problem, etc.

If the kids don't land on a correct/optimal solution, that's OK. Don't just give the answers away, though - this is absolutely critical. The reason why kids don't do STEM anymore is because educators give kids the impression that everything's already figured out. It will take very mature counselors to allow the kids to try to solve these problems, and to succeed or fail, on their own. Getting the right answer's not the point. The point is giving the kids interesting problems and showing the kids what computer science is about: solving problems, and evaluating solutions for correctness and efficiency. Letting the kids come up with their own answers will give them a sense of ownership and help them feel engaged.

Of course, if the kids ask whether they got a correct/good/the best known answer, tell them the truth. But don't just give away the answers, unless they come up organically as a result of discussing the students' solutions. To summarize:

  1. Give kids easy to understand but rich problems to explore.
  2. Let the kids come up with their own solutions, providing only enough help to make sure the kids understand the problem at hand.
  3. Discuss correctness/efficiency in a group setting, giving the groups a chance to explain their solutions. As counselors, you're free to take the discussion of correctness/efficiency as far as you think it can profitably go.
  4. Under no circumstances should you present your own, or any well-known, solutions to the problem, unless they are basically identical to those provided by students. Do not make it seem like CS is a field where people have already figured out all the answers.
  5. If possible, leave the kids feeling like they've learned something, but so that they still have questions: did they find the best answers? Are their other questions they can solve in a similar way? You might even provide them some undecidable problem in an easy-to-digest format to give them something to work on afterwards.
  • $\begingroup$ You might even consider pitting teams against each other in a friendly competition. Give pairs of teams the same problem and see who comes up with the better solution. $\endgroup$
    – Patrick87
    Commented Jun 24, 2013 at 22:48
  • 1
    $\begingroup$ Competitions of that sort strongly discourage shy people and only bolster the egos of those who already know the stuff. This only strengthens the image of CS as being "only for the nerds". $\endgroup$
    – adrianN
    Commented Jun 25, 2013 at 8:35

Im 17 now and I started programming around the time I turned 16. Im going to tell my story and than make some suggestions: My interest in programming started when I was watching a computer tech guy I called mess around with my registries and command prompt(even though he wanted 500$ to fix my BSODs and I didn't pay, I fixed them on my own) So I googled "command prompt language" and found out that there was something called "source code" and it allowed you to program. At the time I had no idea what c++ was, I don't even think I'd ever heard of it. So I went on cpp.com(very bad tutorials, you will learn bad and outdated practices) and started learning the basics. My mind went crazy and I actually learned that the virus I was infected with causing my problems was written in c++, which further interested me. I later started reading, learning assembly and other high level languages. I started first wanting to learn about malware and Graphics programming and I did.

  1. This may sound bad but a lot of people my age are actually interested in the destructive side of programming. The first question I get from my friends when I tell them im pretty good with c++ is "Can you make viruses, change grades or hack games" Im not quite at that level...ive been studying dll injection recently though, so im getting there. Perhaps you could come up with something along the lines of malware that isn't dangerous or illegal but still interesting. (Maybe get the login information of a student from the school server) You could talk to them about how viruses and malicious software work too.
  2. Develop a small game along the lines of pokemon and describe to them how games and game engines work. A lot of people would probably be surprised to know that in a lot of 2d games like this the character is not actually moving, the background is and the character is just using an animation, talk about random numbers ect. Come up with some 3D demonstrations too.
  3. Try to stay away from explaining what the code does, try to tell them what the program itself does without talking about the code too much. In my experience that's an easy way to lose peoples attention especially if they don't understand the basics of the language. In fact, I would try not to really put the source code all out there because it could be fairly discouraging for someone to look at 500 lines of code and not understand any of it. Also if you have someone that youre demonstrating to that is like me they'll probably ask a chain of questions because they have a curious mind. i.e: Youre talking about random numbers, they ask what random numbers are for and where they come from...than you have to explain to them about electronic noise and how its random and everything, than youll probably find yourself in a situation where youre just like "I don't know". Questioning from teenagers can be pretty recursive...
  4. Lego Mindstorms is a great Idea. If you don't wanna take the long route and use a major language it comes with a block style programming language that you can use. I figured out the language in about 30-40 minutes, everything lines up when you think about it

  5. You could quickly develop an app and show it off, talk to them about the $$ that can come from app developing.


some of my favorites

  • generating fractals. they have a strong link to deep mathematics and computer graphics, and also they're naturally suited for parallelism. it illustrates complexity and emergent behavior, esp when you zoom to arbitrary scales, and has strong tieins to science and natural phenomena. it is not hard to write some parallel fractal code that runs on multiple machines. one experiment is to have each machine display the random lines that it processed (eg "slave" machines that process lines from a queue) and then a central machine display the combined results.

  • lego robotics (or other robotics kits eg stamp). mindstorms is a toy, but it can be a very advanced one serving as a tangible demonstration of abstract concepts. the software that can be run on them can be very complex, and they can have complicated sense-think-act loops/algorithms. there are many good books of constructions. also impressive are the Rubiks cube solvers, recently breaking the world record.

  • raspberry pi is a new inexpensive platform that is seeing a lot of interest and use. it can be used to demonstrate linux programming, robotics etc, and has HD output, etc. see eg Southhampton raspberry pi supercomputer with a Lego rack.

  • Logo as mentioned in the other answer is an old classic. another newer angle is game programming eg with a new emerging popular language called Scratch (invented at MIT). it can teach many natural/advanced CS topics.


heres another angle. there are so many interesting open problems or emerging technologies in computer science at the frontiers of scientific understanding that can spark curiosity/wonder, ie exploration of nearby terra incognita. if you raise the problems and then have the class participate in a discussion about the ramifications of solutions, that can spark significant interest/inspiration. [since you mention the availability of the computer lab, it would also be possible to creatively come up with some hands-on computer exercises related to these areas.]

this can take on a sci-fi feeling but in CS like no other field, it turns what was once scifi into reality in a short amount of time. they also can be controversial and timely, connecting with today's headlines, and students can begin to grasp how ubiquitous CS is in our world/society, and how significant it is, when broadly interpreted. here are a few big ones:

  • DNA to protein folding problem. is there an algorithm to calculate it accurately?

  • artificial intelligence in general. is it possible? are there ethics involved?

  • robotics has various key emerging areas. eg autonomous autos/driving. its on the nearterm horizon. how will this affect society? the video of the DARPA contest from not too long ago is impressive. Kurzweil's writing has a lot of stuff to get into. drones are a complicated topic rarely openly discussed and will be increasingly used domestically. the mars rovers are extraordinary technology and there are amazing stories behind it, such as how the systems had to be debugged remotely—interplanetarily when they failed.

  • IT-based surveillance systems to detect crime/terrorism are heavily in the news lately.

  • P vs NP problem. it sounds abstract but it can be presented in a very tangible way such as talking about how video games are NP complete, and the problem can be visualized as the size of circuits required to solve NP complete problems, and the wild implications of P=NP, and how cryptography & secure transactions depend on the P$\neq$NP assumption. oh yeah and dont forget to mention the hanging $1M prize as close to what is called in [theory] teaching, "motivation"!

  • the Higgs boson could not have been discovered and the supercollider cannot function at all without large CS-based systems for analyzing the "big data".

  • Moore's law. how far will it continue? how much has it already affected society/humanity?

  • Quantum computers. are they possible? will they be faster? will they be lowcost or always unweildy? Dwave is a colorful case study, there is a great SciAm article by Aaronson, etc

  • Google pagerank algorithm is one of the multibilliondollar wonders of modern computer science. will it be extended? how does spam filtering work? the company seems to be moving toward analyzing images, etc.

  • algorithmic/high frequency trading now moves massive amounts of trading volume/value. is it good/bad? is it increasing/decreasing? will it be regulated in the future? what kind of computational arms race is involved?

  • supercomputers are massive, solving amazing problems, and getting bigger. are there limits? what do they compute and what will they compute in the future? somewhat related, Big Data and datamining.

  • social networking sites have had huge implications in less than a decade of growth. they are involved in fueling popular uprisings eg Arab spring and Occupy wall st. what is their future?


I have a proposition that

  • focuses on computer science (not programming or auxiliary),
  • starts with a premise most kids know and
  • has actually been tried and works.

We have been holding small workshops with high school students about Minesweeper. The workshop would roughly go like this:

  1. Let's play the game a bit (most know it).

  2. What have we just done? What is the problem we try to solve? Can we formulate general rules?

    This will usually take a while. Kids are not used to formulate problems in terms of input and output lest general rules for solving them. Those who have programed before will appreciate the effort; referencing "spaghetti code" can help. Nevertheless, the rules will be simple most of the time, considering only one cell at a time.

  3. Exhibit problems with the rules.

    At this point, you want to introduce a Minesweeper simulator. The one by Bayer, Snyder and Chouiery is not perfect but allows you to exhibit carefully designed scenarios.

  4. Improve the ruleset to cover more scenarios.

    This will typically lead the students to investigate more and more cells together. You can also nudge them towards "solve all" approaches like expressing the information at hand as a linear equation system -- this comes up if you try to express the available information in mathematical terms. Students already know how to solve such systems!

  5. Note limitations.

    First, there are scenarios that have no (deterministic) solution. Furthermore, we can contrast brute-force with our developed strategies. Can we trade-off speed versus power? If the equation-system approach turns up, note that we can only solve this efficiently over the reals, but we need binary answers. It's not too hard to build scenarios which lead to huge runtimes (we used computer algebra to illustrate).

Depending on the group, this approach allows to cover multiple principles of computer science in a natural way: defining problems, describing general algorithms, iterative problem-solving as well as issues of computability and complexity can all be touched upon.

Feedback by students has been overall positive; they feel engaged and express interest in the concepts. It is important let them do most of the work, only carefully nudging them in the desired direction by asking pointed questions.


you have a lot of things to do ... but one thing that would seem so exiting "money" , so present the "P≠NP" question and the seven millennium prize , when I was in middle school I read about it although I didn't knew the notations the only thing that I understand : there is big prize and question ! other things would be presenting the connection of mathematics and computer science like : solving equations , checking solutions using computers .

other things I would suggest is presenting Alan turing "the father of computer science" and tell his story. the last thing that I suggest is zero knowledge proofs and the game "where is waldo?" and playing without cheating and cryptography and cyber attacks .


Do anything with facebook, they love it. Maybe this is to difficult for beginners, but u clould let them draw connextions graphs, that show how their profiles are connected to each other. I would recommend Javascript as programming language.


Not the answer you're looking for? Browse other questions tagged or ask your own question.