The Demon Headmaster and the Prime Minister's Brain by Gillian Cross
Things at school have been looking up for Dinah, Harvey and Lloyd since their defeat of the villainous Demon Headmaster. The pupils are acting normally, and their new headmaster seems perfectly ordinary. Then the arrival of a new computer game, Octopus Dare, with its competition to find the Junior Computer Brain of the Year, sends ripples of excitement through the school. Only Harvey and his friend Ingrid refuse to get involved. Because ever since the game arrived all the other pupils-even Lloyd and Dinah-have become obsessed with it. Suddenly everyone is competing to win, but it's clever Dinah who makes it to the final. And though she is fixated with the game, she doesn't like the way it makes her feel . . . it's almost as if she's being hypnotized. Too late Dinah realizes that she's being used to access the private computer files of the Prime Minister-the daring new target of none other than the Demon Headmaster!