Hex is a fictional computer featuring in the Discworld novels by Terry Pratchett. First appearing in Soul Music, Hex is an elaborate, magic-powered and self-building computer (not unlike the 'shamble', a kind of magical device used by the Witches of the Discworld), and is housed in the basement of the High Energy Magic Building at the Unseen University (UU) in the twin city of Ankh-Morpork.
Hex is a computer unlike any other the Disc has ever seen, which is not particularly exceptional since previously all other "computers" on the Disc had consisted of druidic stone circles. Programmed via 'Softlore', 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.
 Origins and evolution
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 punched cards to control which tubes the ants could crawl through, enabling it to perform simple mathematical functions.
By the time of the next novel, Interesting Times, Hex had become a lot more complex, and was constantly reinventing itself. 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, in a sense, data compression and information retrieval: 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 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 Unseen Academicals, Ponder Stibbons has placed a mask on the wall to communicate with, even though Hex's voice seems to come from everywhere as it travels in blit space. (Ponder comments "somehow, well, it feels better to have something to talk to.")
By the time of The Science of Discworld II: The Globe Stibbons has hooked Hex up to the University's clacks tower. Hex has 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'.) It is, however, debatable whether-or-not the Patrician, Lord Havelock Vetinari, knows.
In The Art of Discworld, Pratchett explains that "the wizards invented something sufficiently computer-like that computerness entered into it."
 Structure and technology
Currently, Hex is activated by "initializing the GBL," which Stibbons reluctantly admits means "pulling the Great Big Lever" (similar to the Internet slang "BRS", or "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 series of wooden blocks and later a quill on a hinged lever (echoing the real-world evolution of computer output from paper tape to video monitor).
It is all powered by a waterwheel covered in male sheep skulls, i.e. 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" (as described in Hogfather). As a further advantage, when Hex is turned off for the summer, the beehive will provide quite a lot of honey.
There is also a mouse (a possible reference to a "computer 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 Hogfather). Hex also stops working (with the error message "Mine! Waah!") if the FTB is removed/disengaged; "FTB" stands for "Fluffy Teddy Bear," and it was Hex's Hogswatchnight gift from the Hogfather. Hex is said to believe in the Hogfather, because it was told to do so 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 it 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 it is afraid of death. An example of this is shown in Hogfather where, when Death approaches Hex, it asks if it is "Big Red Lever time".
 Other Discworld computers
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 modeled 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).
The Hex-like machine was mentioned again in Unseen Academicals, as constructed by the staff of the Higher Energy Magic Building at Braseneck college, and was given the name Pex. Pex was apparently powered by chickens rather than ants, a technology which was considered superior as the eggs it provided were edible. Adrian Turnipseed was responsible for its construction and maintenance, using various technologies he had learned from Ponder while helping to build the original Hex. However, he had apparently not learned well enough, as a seventy-foot chicken broke out of the Higher Energy Magic Building and demolished much of Pseudopolis, and presumably Pex as well.
Hex has a habit of spewing bizarre messages. Its "Out of Cheese" error from Interesting Times caught the fancy of many information technology employees, turning up in real-word systems and in programming books.
It alludes to the many confusing error messages that technology users have had to put up with in the Information Age. "Out of Paper" (also seen as "PC LOAD LETTER" for some printers) is familiar to many office workers. "Redo From Start" was 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. Other inscrutable Hex-talk includes:
+++Mr. Jelly! Mr. Jelly!+++ +++Error At Address: 14, Treacle Mine Road, Ankh-Morpork+++ +++MELON MELON MELON+++ +++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++ +++Whoops! Here Comes The Cheese! +++ +++Oneoneoneoneoneoneone+++
In the PlayStation game Discworld II: Missing, Presumed..., if the player asks the question "Why?", Hex spits out various error messages different from those 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*
This echoes the science-fiction "does not compute" cliché, in which the protagonist confuses, locks up, or destroys a dangerous computer by giving it riddles or making paradoxical statements such as "everything I say is a lie".
Hex appears in the books Interesting Times, Soul Music (novel), Hogfather, The Last Continent, Going Postal, The Science of Discworld I, II and III, Making Money and Unseen Academicals and in the video game Discworld II: Missing Presumed...!?
 Real world connections
The inspiration for Hex, which evolves through seemingly unexplainable upgrades like extra cheese, the FTB protocol, a CWL (Clothes Wringer from the Laundry, for crunching numbers and other things), and "small religious pictures" (icons), came from Pratchett's own early experiments with upgrades on his ZX-81.
The name is a play on two meanings of the word "hex": a hex can be a magical spell, and "hex" is slang for hexadecimal, the base 16 system used to simplify the representation of binary numbers and widely used in the IT world. "hex" ("6" in Greek) also denotes the number of legs ants have.
- "Keefieboy" (July 5, 2005). "Out of Cheese Error" (blog). Adventures in Dubai. Blogspot. Retrieved 2009-06-20.
- Flaig, Ruediger-Marcus (2008). Bioinformatics Programming in Python. Wiley-VCH. ISBN 3-527-32094-6. Retrieved 2009-06-20.
- Nicholls, Peter (1979). The Science Fiction Encyclopedia. Doubleday. p. 124. ISBN 0-385-13000-7.
- Meikle, William. "Science Fiction Writing - Ten Cliches to Avoid". SD Editorials. StreetDirectory.com. Retrieved 2009-06-20.