Hex is a fictional computer featured in the Discworld novels by Terry Pratchett. First appearing in Soul Music, Hex is an elaborate, magic-powered, self-building computer (not unlike the 'shamble', a kind of magical device used by the Witches of the Discworld) featuring ants and cheese as part of its architecture, 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 because 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.
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 lift 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 The Last Continent it was explained that the aforementioned "invisible writings" were snippets of books that were written a long time ago and lost, snippets of books that hadn't been written yet, and snippets of books that would never be written. The theory behind this was, all books are tenuously connected, due to the fact that every book ever written cites information from every other book, whether the writers mean to or not. Hex helps Stibbons by magically trawling the ether for these scraps of information.
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."
Currently,[when?] Hex is activated by "initializing the GBL," which Ponder Stibbons reluctantly admits means "pulling the Great Big Lever" (similar to the Internet slang "BRS", or "big red switch"). This is also a reference to the IBM Mainframe terminology for booting, known as IPL. This action 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 advertisement 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 (pun for a computer pointer) 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," which was Hex's Hogswatchnight gift when Death stood in for the Hogfather. (FTB is a pun on FTP, the File Transfer Protocol.) 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 (BRL). This seems to worry it further, indicating sentient life because it is afraid of death (in this case shutting down). An example of this appears in Hogfather: when Death approaches Hex, it asks if it is "Big Red Lever time".
According to The Science of Discworld III: Darwin's Watch, another Hex-like machine has been invented by the smaller magical university of Brazeneck College. This is much simpler than the original, however; according to Stibbons, Hex is technically a Very Big Thing, while the Brazeneck 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 Brazeneck wizards would try and build an Even Bigger Thing, Ponder Stibbons corrected him. According to him, 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 Brazeneck college (of whom the Archancellor is the retired Dean of Unseen University), 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-world 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 videogame 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, 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...!?
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 several meanings of the word "hex": a hex can be a witch (hence the video game Hexen meaning witches) or 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; and refers to Hex, a game that encourages strategy and planning.
In 2019, Hex GBL was provided as an answer for a practice exam associated with Chapter 6 of Western Governors University's "Managing Cloud Security" course.