Mr Shafi decided to develop the software himself and created Professor MacDinosaur and a team of animated dinosaurs to help children from the age of four to master the basics using a computer.
Three years on, the Bafta-nominated Dinosaur Chess will soon be available in eight languages and Mr Shafi's son Declan, now 7, is winning chess tournaments all over Scotland. "I think he's going to be a much better player than me," laughs Mr Shafi, whose game will be available free to any interested primary schools.
Pupils at Hillside Primary in Dundee took part in a pilot project using the electronic game and teacher Donna Officer, who runs its chess club, developed resources so the game can be used to support learning in other curriculum areas: "The game is organised in lessons and after a child completes it they are allowed to fight a dinosaur. That's the grabbing point - the children want to finish the lesson so they can fight the dinosaur."
Rebecca Brown, 10, says: "I like the game because it starts from the basics and the dinosaur fights are fun. The chess matches have different levels of difficulty - it's brilliant."
Mrs Officer developed Promethean flipcharts and worksheets so the package can be used with whiteboards for problem-solving.
The game will be distributed to IT co-ordinators in every authority and made available, with teaching resources, to primary schools that want it.