About 90 pupils from Dunedin schools were at Otago Museum's Hutton Theatre for the 2011 RoboCup Junior Otago Challenge on Saturday.
RoboCup organiser Donald Liddell said the dozens of Lego robots on display were assembled and programmed by the pupils to complete one of three tasks - dancing, performing a search and rescue operation or playing two-on-two robot football.
Each robot was assembled from Lego kits, with programmable on-board computers and infrared sensors, allowing them to perform tasks such as following infrared "footballs" or tracing the path of a black line.
"The robots are actually thinking their way through problems.
They run several routines and they are all autonomous robots," Mr Liddell said.
Otago Boys' High School pupil Jason Crabbe (17) - in his sixth year competing at the event - had been working all year to complete his pair of dancing robots.
One was capable of playing the piano, while another displayed lights, to the tune of Billy Joel's Piano Man, he said.
OBHS pupil Max Clarke (14), on the other hand, had designed a squat mechanical friend capable of finding its way to a tin can playing the part of a "victim" in a search and rescue simulation.
Max's interest was in the coding behind the project, and he hoped to continue studying computer programming at university.
Both boys said Saturday's competition was a chance to have fun.
"It's nice to be in a group of people who share interests with me, and have a competition about something I like," Max said.