Home About Prepare Take Part Information Challenge Site Contact

How to prepare

The early questions will require you to be familiar with Blockly. A tutorial system that also includes some engaging challenges can be found here: blockly-games.appspot.com. Focus especially on the Maze, Turtle and Movie sections.

Unless you are in the Junior age category, you will be required to be familiar with a modern programming language for solving Section 3 problems. Suitable tutorials can be found here: Programming

You will also need to be familiar with the sections required for your age group in the Syllabus

Special tutorials that address this Challenge specifically can be found below

A carefully structured Python tutorial aimed at able beginner programmers can be found here: computer science circles. It is possible for you, and any other students from your school to register on this site and then assign your teacher (or even a student) as your mentor. This person will recieve any requests for help you might make.


Example tasks

Example 1: Logo Maker:

A new country has been founded from five small, friendly countries. A program is required that can be used to create its new logo. Using only the blocks supplied, write a program that draws the shape shown.

Example Task

Example 2: Entwined Sequences:

Examine the series of numbers shown below:
        2 1 4 3 8 5 16 7 32 9 64 ...

2 is the 1st number in the series, 1 is the 2nd number in the series, etc.

Using any programming language, create a program that finds the sum of the first 10,000 numbers.
Submit the first 10 digits of the sum as your answer.

(Answer: 2824934064)


Past challenges

Archived auto-marking Challenges are available to everyone, throughout the year without the need to login. Please visit here to have a go: Challenge Archive



Below are answer booklets for recent TCS Oxford Computing Challenges. These include answers (in Python and Blockly), explanations and information explaining how the tasks are related to Computer Science.

pdf icontcsocc-2017-answers.pdf
Download File


This section provides some tutorials that are specific to solving the tasks found in the TCS Oxford Computing Challenges.


Quick tips

Widening the Blockly workspace
The space for your blocks can be increased by collapsing the question menu:
hide menu button

Disabling blocks in Blockly
By right-clicking on a block you can disable it:
hide menu button

This is the equivalent of commenting out code in other programming languages

It can be useful when trying to find out which part of your code is doing something unexpected.

In Picture module questions, if the picture you have made is getting in the way of the shadow image you are wanting to see. Disabling the blocks that produce your image is one way of keeping your code and seeing below.

Keyboard shortcuts
Clicking on a block selects it and any blocks it contains. It is now possible to copy, paste and delete with the keyboard in the same way you normally complete these operations on your computer.
e.g. Paste: ctrl-V (or cmd-V on a Mac)



1. Blockly Coding Tasks

This type of task is very flexible: Task authors can set problems where a variety of solutions can be given credit for producing the correct answer. These tasks use Function blocks and take this form:

Function Example

How to answer Blockly Coding tasks in the TCS OCC Challenges:
Write all of your code in the function. There is no need to write any code outside of the function. The task author will have provided the necessary parameters and some suitable test data to pass to the function. The Execute block passes these values to the function block as it calls it. (It is OK to change these values to provide yourself with new tests.)

Recommended Practice:
It is not necessary to understand how to create functions to answer these tasks. Your code needs to form a mini-program inside the function block provided. However, there are a few things that you do need to know:

Function Example

more detailed information ...



2. Blockly Turtle Tasks

The turtle tasks provide a set of tools that allow the programmer to create drawings and animations by thinking of themselves as a robot and writing controls that turn right or left, go forward or backward, etc. as if riding along.



3. Blockly Maze Tasks

The Blockly maze tasks are simply about guiding a robot from its starting position to the target square in any way that works. Some mazes are simple, some more complex. Sometimes there are constraints that you need to overcome such as the number of blocks allowed or the types of blocks available.



4. Blockly Picture Tasks

The Blockly picture tasks provide an alternative way of programming images to the turtle tasks. In this module images are created by placing shapes and lines on the canvas using x,y coordinates that start from (0,0) in the top left hand corner of the canvas. This module requires you to think about precedence and also naming of objects. Shapes at the top of your block stack are implemented first. Those afterwards are placed on top. If you simply duplicate a block and do not change its name then the shape gets evaluated once and then re-evaluated a second time removing the first instance. Don't forget to name your shapes individually! This does however give you the opportunity to use code that then refers to individual shapes by name.



5. Blockly Movie Tasks

The key to understanding these tasks is to realise that the code you write is executed 101 times in a movie time loop to create an animation. This means that in some instances your code might not complete in each frame!

The process of drawing each movie frame is like this:
1. Remove old objects (shapes and lines).
2. Execute the code blocks in the workspace
3. Draw the objects onto the canvas.

The main blocks:
time block returns the frame integer from 0 to 101.

shape block creates a shape with the parameters shown.

Add shape: name me needs to be unique for each shape object added or weird things will happen!

number of sides: 3=triangle, 4=square ... 9=nonagon, all other integers create a circle

colour: sets the colour to that shown in the colour picker

radius: sets the radius of the containing circle in the same units as the scale on the canvas

position X: sets the x coordinate of the centre of the containing circle in the same units as the scale on the canvas. Note that the top left corner of the canvas is (0,0)

position Y: sets the y coordinate of the centre of the containing circle in the same units as the scale on the canvas.

Example 1:
red square movie
This will produce a movie of a square moving from left to right across the canvas

more detailed information ...



6. Blockly Image Tasks

In the Blockly image tasks you are provided with an image and asked to manipulate its data to alter it.

To do this you can reference individual pixels by their x,y coordinates. (Remember that the coordinates are from (0,0) in the top left corner.) It is usually easier though to loop through all pixels with the for P in pixels block:
pixel loop block

Inside the loop, you can then add blocks that alter each value of P in the image. Try this simple program that sets the R value of every pixel to 255:
small program

There are getter and setter blocks provided for a variety of pixel and image properties so try them and out and see if you can produce some of the filters provided in applications such as Photoshop.

more detailed information ...