Hex is an elaborate, Heath Robinson/Rube Goldberg-esque, magic-powered computer housed at Unseen University (UU) in the city of Ankh-Morpork, in author Terry Pratchett's Discworld series. The main structure works through the movements of large numbers of ants through the complex pipes and tubing which make up the main quantity of Hex's infrastructure.
Hex is a computer unlike any other the Disc has ever seen (which is not particularly hard since all other 'computers' on the Disc consist of druidic stone circles). Hex runs and evolves under the watchful eyes of wizard Ponder Stibbons, who becomes the de-facto IT manager at UU because he's the only one who understands what he's talking about.
Hex has its origins in a device that briefly appeared in Soul Music, created by Ponder Stibbons and some student Wizards in the High Energy Magic building. In this form it was simply a complex network of glass tubes, containing ants. The wizards could then use punch cards to control which tubes the ants could crawl through, enabling it to perform simple mathematical functions.
By the time of the novel, Interesting Times, Hex had become a lot more complex, and was constantly reinventing itself, meaning several new components of it were mysteries to those at UU. Part of it is now clockwork, which interfaces with the ant-farm via a paternoster the ants can ride on that turns a significant cogwheel. Its main purposes were to analyse spells, to see if there were simpler "meta-spells" underlying them, and to help Stibbons with his study of "invisible writings", by running the spells used to bring the writings into existence (these spells must be cast rapidly, and each one can only be used once before the universe notices they shouldn't work). In other words, data compression and information retrieval.
In Hogfather Hex contained several things that nobody remembered installing, and was asking about electricity. It was at around this time that the wizards become concerned that it may be trying to become something they didn't understand.
By The Science of Discworld Hex was capable of "once and future computing"; increasing its abilities simply by deducing that the required processing power would exist eventually. Presumably this requires a high expenditure of magic, as it has not been mentioned again (at the time, there was a massive excess of magic available due to a near catastrophic overload of the university's experimental thaumic reactor). This virtual memory appeared as translucent silver towers superimposed onto the real Hex. Hex was sufficiently intelligent by this time not to tell the wizards what it was doing, in case it worried them.
By the time of The Science of Discworld II: The Globe Stibbons had hooked it up to the University's clacks tower, and it worked out all the codes, meaning the University can now use the clacks for free, and has the Disc's first modem. (The legal issues have been carefully considered by Archchancellor Mustrum Ridcully, who concluded that no-one was going to find out so they may as well do as they please.)
In The Art of Discworld, Pratchett explains that "the wizards invented something sufficiently computerlike that computerness entered into it".
Currently, Hex is activated by initializing the GBL, which Stibbons reluctantly admits means "pulling the Great Big Lever" (similar to the Internet slang BRS (Big Red Switch)). This releases millions of ants into a much more complex network of glass tubes that makes up the bulk of Hex, hence the sticker on Hex that reads Anthill inside, a pun on Intel’s ad slogan Intel Inside. Hex "thinks" by controlling which tubes the ants can crawl through, thus allowing it to perform increasingly complex computations if enough ants are provided (that is, if there are enough bugs in the system). This is a reference to Douglas Hofstadter's Gödel, Escher, Bach in which there exists a sentient ant colony, with the ants acting as neurons. Hex can now be given input through a huge wooden keyboard, in analogue writing by means of a complicated mechanical eye designed by Hex itself, or vocally through an old hearing trumpet, and gives output by means of a quill on a hinged lever. It is all powered by a waterwheel covered in male sheep skulls (in other words, RAM). When it is particularly busy, an hourglass comes down on a spring—another sideways reference to Windows. Another apparently important feature is an aquarium, so the operator has something to watch when Hex is working (Hex's screensaver). Hex's long-term memory storage is a massive beehive contained in the next room; the presence of the bees makes this secure memory, because attempting to tamper with it would result in being "stung to death" (quoted from "Hogfather").
There is also a mouse that has built its nest in the middle of Hex. It doesn't seem to do anything, but Hex stops working if it is removed, or if Ponder forgets to feed it cheese (also from "The Hogfather"). Hex also stops working (with the error message "Mine! Waah!") if the FTB is removed. The FTB stands for Fluffy Teddy Bear, and it was Hex's Hogwatch night gift from the Hogfather. He is said to believe in the Hogfather, because he was told to by Death in "Hogfather". The FTB may be a reference to the Jdbgmgr.exe file found in windows operating systems which had a teddy bear as its icon. FTB may also be a play, or pun, on the existing File Transfer Protocol (FTP) which can be used to transfer large chunks of binary data between computers. Stibbons is concerned by these signs that Hex might be alive, but dismisses these thoughts, insisting that Hex only thinks he is alive.
Hex can apparently be shut down completely by means of a Big Red Lever. This seems to worry it, further indicating sentient life because he is afraid of death.
Oddly, The Science of Discworld puts the name Hex in small capital letters, , that are the same type as when Death speaks. In The Science of Discworld II: The Globe, Hex is written normally.
According to The Science of Discworld III: Darwin's Watch, another Hex-like machine has been invented by the smaller magical university of Braseneck College. This is much simpler than the original, however; according to Stibbons, Hex is technically a Very Big Thing, while the Braseneck device is barely a Quite Big Thing (the next step up would be a Great Big Thing, every particle of the universe being modelled within it; apparently these terms are quite exact, as when the Lecturer in Recent Runes postulated that the Braseneck wizards would try and build an Even Bigger Thing, Ponder Stibbons corrected him. Apparently a Very Big Thing is capable of pushing boundaries twice as big up to three times as far as a Quite Big Thing).
Hex can be seen as either a direct reversal of Arthur C. Clarke's Third Law, which states that "Any sufficiently advanced technology is indistinguishable from magic", or as a reference to Niven's Law - "Any sufficiently rigorously defined magic is indistinguishable from technology". Hex, as apparently the most advanced form of magic on the Discworld, has now become effectively indistinguishable from technology.
The inspiration for Hex, which evolves through seemingly unexplainable upgrades like extra cheese, a CWL (Clothes Wringer from the Laundry, for crunching numbers and other things) the FTB protocol (Fluffy Teddy Bear) and "small religious pictures" (icons), came from Pratchett's own early experiments with unfathomable upgrades on his ZX-81.
The name is a play on the multiple meanings of the word "hex"; a hex can be a "magical spell" and also an abbreviation of "hexadecimal". It may also be a play on HAL 9000, or on TLAs in general.
In 2001, a new SGI Origin 2800 supercomputer was installed as part of the University of Leicester's Centre for Mathematical Modelling and, with Pratchett's blessing, named HEX.
Quotes / error messages
- ++?????++ Out of Cheese Error. Redo From Start.
- Mr. Jelly! Mr. Jelly! Error at Address Number 6, Treacle Mine Road.
- Melon melon melon
- +++Wahhhhhhh! Mine!+++
- +++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
- +++Whoops! Here comes the cheese! +++
Hex's messages are often delimited by the sequence +++, which recalls the escape sequence in the Hayes command set, a standard used in modems.
"?REDO FROM START" is the somewhat unhelpful error message produced by the BASIC interpreter in many early home computers when non-numeric characters were entered in response to a prompt for numerical input.
There is a string of error messages that hex gives in the Playstation game "Discworld II: Missing, Presumed..." when the player asks Hex the question "Why?". This string of error messages is a bit different from the error messages in the books:
- *Blip* *Blip* *Blip* End of Cheese Error
- *Blip* *Blip* *Blip* Can Not Find Drive Z:
- *Blip* *Blip* *Blip* Unknown Application Error
- *Blip* *Blip* *Blip* Please Reboot Universe
- *Blip* *Blip* *Blip* Year Of The Sloth *Blip* *Blip* *Blip*
Hex was mentioned in the following books and games:
- Interesting Times (ISBN 0-06-105690-1)
- Soul Music (ISBN 0-06-105489-5)
- Hogfather (ISBN 0-06-105905-6)
- The Last Continent (ISBN 0-06-105907-2)
- Going Postal (ISBN 0-06-001313-3) —Hex controls the world's largest Omniscope
- The Science of Discworld (ISBN 0-09-188657-0)
- The Science of Discworld II: The Globe (ISBN 0-09-188805-0)
- The Science of Discworld III: Darwin's Watch (ISBN 0-091-89824-2)
- Making Money (ISBN 0-06-116164-0)
- Discworld II: Missing Presumed...!? (Playstation game)
- The Shepherd's Crown (Hex tells Ponder Stibbons that Esmeralda Weatherwax has died)