More than 120 students got a chance to try code breaking inspired by a Second World War machine.

An Enigma machine, one of several used by the Allies to decypher secret German messages, was brought to Sheldon School in Chippenham by James Grime of the University of Cambridge.

Year 8 students from 20 schools saw the machine during a maths lesson.

Teacher Mark Lewis said: “The students all seemed to enjoy it, and they were very motivated.

“They carried out a variety of tasks, some of which were team-based and others were competitions, and then they had a go at some code breaking.

“It was a successful day and we are hoping to get the machine in again – it is something we would like to run again next year.”

The visit was organised as part of the Enigma Project, which is linked to the Millennium Mathematics Project.

The Enigma machine is owned by popular science author Simon Singh.