Chapter 10

Early days in school programming competitions

Derham McAven

The way computers are used in schools has come a long way in the last 30 years. During the 1970s and ’80s, computer use was primitive, yet pioneering. Few schools actually owned a supply of computers. There was little training in computing for school teachers or funding for exploratory work. The occasional individual teacher made an effort to buy a machine, but there was a lack of organised effort to guide decision-making. Obviously, this situation has since changed over the years, partly thanks to awareness-raising campaigns about the increasing necessity of computers in education.

Raising awareness through competitions

A popular way of increasing interest in the attractions of a career in computing was by setting up competitions for school children, such as the annual Canterbury Computer Programming Competition and, at the international level, the South-East Asia Regional Computer Confederation (SEARCC). Participation in these competitions over the years has increased awareness of the importance of teaching computer programming to students, and given bright young programmers a chance to prove themselves and challenge their abilities.

Both software and hardware were still in a primitive phase in the 1980s. There were several ‘toy’ machines, including the TRS80, the BBC Acorn, the Sinclair ZX80, the Commodore 64 and the Apple IIe. The Acorn had some software, which was used in British schools, and Apple also produced software aimed at schools, some of it of dubious value. Each brand had its own enthusiasts and there was little real consensus as to which was truly superior.

In the early 1980s a New Zealand-made machine called Poly 1 (later Poly 2) was designed for educational use. The software was written with government sponsorship, and the machines began to be manufactured. There was considerable interest in the Poly venture, including some from China. However, a change of government destroyed the funding and forced an end to the project (see chapter 6 on Progeni by Perce Harpham for the full story). Later, as Microsoft and Apple began to monopolise the market, the so-called ‘lesser’ brands of computer began to die away. Nowadays, these brands are only of interest to collectors who see them as curios.

Today’s competitors are able to use personal computers and sophisticated computer languages such as Visual BASIC, C, C++ and Java. However, in the digital age, some of the former ‘pioneering’ spirit has been lost, though on the plus side computers are now widely available.

Raising awareness — Canterbury Computing in Schools Society

In 1979, there was a real need to campaign to raise awareness of the benefits computers could bring schools. The Canterbury Computing in Schools Society was therefore established, with the encouragement of the New Zealand Computer Society and most notably Ian Mitchell. The aim of this society was to provide incentives for schools to recognise the potential benefits of computing. As a former Primary and Secondary School teacher, and as an NZCS committee member, I was involved in the Canterbury Computing in Schools Society (CCSS). Most of the other committee members were school teachers struggling for resources and ideas to advance computing in their respective schools.

After the founding of CCSS, I started the annual Computer Programming Competition, which ran for 10 years. This competition rapidly became a popular event, and on the first day 50 machines of all types were lugged to the venue and battle began. The competition included both a senior and a junior programming section. There was a category for design and in later years graphics were also judged.

Originally, the Senior Programming Competition was judged in BASIC; though there were many variations of BASIC, this was the only common factor across the large range of machines and operating systems. NZCS committee members formed the main judging panel, and some of the members found their knowledge of computing stretched by the innovative younger members. The senior competition set a different problem from year to year. One very successful year the problem involved creating a four-by-four simulation using two-dimensional arrays of the calculation modes of a spreadsheet. Another year’s problem was finding palindromes, such as ‘MADAM’, in a dataset.

Some of the junior entrants competed in LOGO, but there was little teacher support available. Many of the entrants were self-taught, and some needed private coaching. Some students even began their careers in professional computing in the context of this competition. NZCS recruited volunteers to help children who were not receiving sufficient encouragement at school to increase their knowledge and skills. Skills taught included programming language and simple repetition loops. Playful exercises, such as loops and creating a ‘square’ of asterisks, encouraged the concept of a programmer controlling the machine.

The classes run by volunteers usually began with single repetition loops. One of the favourites was:

FOR J = 1 to 10

PRINT("This is a dumb computer!")

NEXT J

This exercise introduced repetition (and with slight modification endless loops), counting variables and some appreciation of programmer controlling the machine.

The next exercise involved nesting FORNEXT loops, for example:

L = 10

FOR J = 1 TO L

FOR K = 1 TO L

PRINT "*";

NEXT K

PRINT

NEXT J

This program produces a ‘square’ of asterisks. Changing the third line to:

FOR K = 1 TO J

produces a triangle. Those with an aptitude for programming soon cottoned on to the possibilities of creating the triangle inverted or with other variations.

Our first attempts at structured programming included the following:

DECLARE SUB Setup ()

CLS

CALL Setup

CALL Main

CALL Windup

SUB setup

PRINT ("Done Setup!")

END SUB

SUB Main

PRINT ("Done Main!")

END SUB

SUB Windup

PRINT ("Done Windup!")

END SUB

This program actually did nothing but print the messages showing that sub­routines had been executed in order, but it did offer a skeleton for most tasks. This encouraged good programming habits, which was part of our objective even though competition programming had little room for such refinements.

Programming goes international

In the early 1990s, NZCS wanted a New Zealand team to compete in the South-East Asia Regional Computer Confederation (SEARCC) Conference, of which it was a member. The SEARCC Conference includes a programming competition for school children and a MicroMouse-Maze Competition. SEARCC was seen as an amazing opportunity for New Zealand computer programming students and preparations were made to find a suitable team.

*

***

*****

*******

*********

***********

*************

***************

*****************

*******************

***

***

***

*********

*******

*****

***

The local Computer Programming Com­pe­tition was now extended to a national event, with teams taking part across regions. Canterbury had something of an advantage, as the competition had already existed for years locally. Selection trials were open to everyone, and there was an enormous effort put into training. Each squad would practice for hours a week over the course of months in preparation for the nationals. This level of practice showed an increase in professionalism. Early problems included using algorithms to create simple patterns, such as a ‘Christmas Tree’ (left) with algorithms based on nested For…Next loops.

More complex problems included repro­ducing Pascal’s Triangle, Permutations and Combinations and Maze solving. There was a high level of problem-solving ability among the students and some standout performances that went well beyond the standard range of school-level problems. One student, James McGowan, produced a very elegant solution to the Knight’s Tour. Another exercise involved chess; finding multiple solutions to the problem of placing eight Queens on the board so that no one piece could take any of the others using a standard Queen move.

Here is the definition of an early problem based on the Fibonacci Sequence:

  1. the standard Fibonacci Sequence begins 1, 1, 2, 3, 5, 8, 13, 21, 34, …;
  2. each new value is the sum of the two immediately preceding values;
  3. write a Function FIBO(i,m,n) where:
    1. all the parameter values are integer in the range 1–999 and need not be validated;
    2. I is the first value and m is the second value;
    3. n is the ordinal number of the target value to be returned by FIBO counting from I as 1, e.g. FIBO(2,3,6) would return 21;
    4. the I & m values are referred to in sequence;
  4. the result is to be displayed at Row 5, Col 3 as below with leading zeroes removed;

Sample layout:

The Fibonacci value xxx is xx places after xxx and xxx.

And here is a recursive solution for a problem involving combinations (note that the subroutine ‘comb’ calls itself from within the subroutine):

DECLARE SUB comb (n!, k!)

CLS

maxl = 7

DIM SHARED list$(maxl)

DIM SHARED n, z1

PRINT ("Supply a number in the range 3 to 6 to produce")

Print (" all possible combinations of letters A-C to A-F")

INPUT n

k = 1

CALL comb(n, k)

SUB comb (n, k)

FOR i = 1 TO n

list$(k) = CHR$(64 + i)

IF k = n THEN

PRINT "*";

FOR p = 1 TO n

PRINT list$(p);

NEXT p

PRINT " ";

z1 = z1 + 1

IF z1 MOD 10 = 0 THEN

PRINT USING "######"; z1;

PRINT

END IF

ELSE

CALL comb(n, k + 1)

END IF

NEXT i

PRINT "Done COMB";

END SUB

University staff around New Zealand set and judged the exercises for the nationals. Waikato University provided the problems in 1993, and this task was thereafter rotated around the staff of other Universities. The first facilities of the Internet, pre-World Wide Web were used for national finals. With the Internet still in its infancy, synchronising the dispatch and receipt of problems and solutions was problematic.

The Canterbury Team won (as they went on to do every year until 1997), and gained the right to represent New Zealand in the SEARCC international competition. Following their win at nationals, the team began a regime of intense training in the build-up to the competition. The team practiced by using problems from previous SEARCC competitions or made their own problems from scratch. Problems from college competitions in the US were also studied. As the participants were students, this had to be juggled with their studies and other schedules. Practice took up weekends and demanded total dedication from both students and their families. Families worked hard to raise funds for travel, uniforms and medical insurance. NZCS were not able to provide any funding, and all sponsorship had to be sought locally in Canterbury.

SEARCC allowed teams of up to three students, all of whom had to have their 16th birthday no later than January the first of that year, to compete. The team were allowed a single PC equipped with GWBASIC and no supplementary files. They were given three problems to solve over the course of two hours. File-handling problems were not involved. The solutions they provided were graded either ‘right’ or ‘wrong’ and time penalties applied.

The national team chose to use three members on an ‘A-Team’, with a reserve member on a separate ‘B-Team’. As their regional coach, I became their manager, coach and chaperon. Because of SEARCC’s format, the team spent time working out roles and leadership, and devising team strategies for the allocation of problems. The team situation emphasised cooperation, with a single person using the computer at a time. While one student used the computer, the others would attend to other tasks. If the seated student found the task too difficult, another would take his place. Many other teams in the competition tended to rely on their best programmer to deal with all problems instead of spreading out difficulties between a team. The New Zealand team’s strategy of sharing tasks was a critical factor in their success.

In 1993 New Zealand was placed tenth and thirteenth in SEARCC. For most of the team this was their first visit to an Asian country. In Hong Kong a tour to various institutes of technology was provided. The students found the advanced state of technology in Hong Kong both fascinating and educational.

Next year SEARCC was held in Karachi, Pakistan. The reserve from the earlier year’s competition now led the ‘A-Team’. The city of Karachi had been reported in Time magazine as the most violent in Asia some months before the competition began. The team was anxious for their personal safety and consulted numerous people for advice before leaving. Eventually, the team was accommodated in the Sheraton hotel next to the US embassy, which featured armed guards by the street doors and even beside the swimming pool. The competition itself was held in the hotel’s Crystal Ballroom.

The competition included a trial run, to ensure that the systems were working well. New Zealand did well in the trial, raising expectations high for the final event. The team’s solution was initially ruled incorrect, as it did not use the expected method of a recursive algorithm. However, the team appealed the decision and the solution was deemed acceptable. Therefore the junior ‘B-Team’ came sixth. This was a very satisfactory result for New Zealand, as the team was competing against countries with much more advanced technology and full-time coaching. New Zealand’s team was proud to bring home a trophy that year.

The winning team from Karachi 1984. From left, at back: Derham McAven, Roger Nesbitt, Toby Segaran; front: Phillip Pearson and James McGowan.

In 1995 the situation of the ‘A-Team’ being lead by the reserve of the previous year was repeated. SEARCC took place in Sri Lanka and the team came second to the host country. In 1996 the competition took place in Bangkok, Thailand. The team was placed eighth. 1997’s competition took place in New Delhi, India. The culture shock of great poverty, the huge masses of people, and the contrast between the ancient and modern had quite an impact on the team. Though the team suffered from dysentery; they recovered in time for SEARCC. A new system of ‘automated marking’ was introduced that year, which caused some concerns. There were also time delays in the event and one problem was changed late in the competition. The team was disadvantaged by these issues and was placed seventh.

Conclusion

Each of these competitions provided opportunities for the New Zealand students to see what life was like in other countries and experience some sightseeing, including visiting temples, shrines and jungles. The students gained positive insights into the wider world as well as the world of information technology.

In later years, New Zealand teams have won SEARCC twice, once in Auckland and again in Sydney. Participation since 1997 has been somewhat sporadic and the competition has received little publicity. However, for every New Zealand student who has participated in SEARCC, the experience has provided invaluable insights into the world of international computer programming and the event is well worth maintaining for the experiences and challenges that it provides to students.

Derham McAven MA, BCom, Dip Teach, honorary fellow of NZCS entered the world of computing in 1967 as an Assembler Programmer at what eventually became Databank. This was the first facility in the world where all of the trading banks in the country cooperated and cleared all their normal banking plus inter-bank transfers overnight. After nearly two years Derham was beginning to find Assembler Programming intensely tedious, so he moved to the South Island and joined The Canterbury Frozen Meat Company as a Systems Analyst. There he became heavily involved in the installation of the company’s first computer and the implementation of their first application, which was developed in COBOL.

Later Derham moved to Christchurch Polytechnic, where he spent 27 years in a variety of roles. Initially his time was split between teaching computing and working as a Systems Analyst on computing applications for educational administration. In the late 1980s Derham became manager of the Computing Resource Centre at the Polytechnic. During those years the computing power expanded from one Data General MV6000 (with 35 stations) plus a couple of PDP-11’s, to a network spanning two separate campuses with about 12 servers and 1300 PC stations.

After leaving the Polytechnic, he taught for a while at a private training provider and then for some five years at the University of Canterbury, retiring in 2007.

Derham attended his first meeting of the Canterbury branch of the New Zealand Computer Society in 1969; he was the NZCS representative on the committees that developed the New Zealand Certificate of Data Processing into the Technical Institute/Polytechnic specific qualification.