Being able to create randomness is a complex idea based on a simple invention that gave us play, gambling and maybe even ritual.

As the fire dwindles in the hearth, a family picks through the remains of their feast, turning over the bones for any remaining flesh. It is about 3000BC in Skara Brae, a small neolithic settlement on the west coast of Orkney’s Mainland, Scotland. These people live a comfortable lifestyle – and they have time to have fun. The satisfied diners take a moment to enjoy themselves.

One of the family finds a knucklebone – knobbly, bumpy and thumbnail-sized – and flicks it across the room. Someone else gathers a few together to stack in a tower. Soon, rules are drawn up – points scored for landing your bone closest to a target, flicking the most into a cup, or knocking over your opponent’s tower. Modern games like throwing jacks, tiddlywinks and Korean gonggi are all based on the same idea. We have flicked stuff around to amuse ourselves for millennia.

Our Skara Brae family were not the first to play with knucklebones – we have examples of knucklebone games throughout history. But what they do next has no earlier examples. They numbered the sides of the bones with dots.

If you were to walk into this house and sort through the family’s possessions as they slept, their belongings could be divided into two piles: things whose purpose we recognise and things we don’t recognise. On the “don’t know” side are strange objects – smooth, carved stone balls, for example, which were perhaps weapons or status symbols, and several other decorated stones that might have been “prized personal possessions”, writes Antonia Thomas, an archaeologist at the University of the Highlands and Islands, UK.

On the “know” side would be carved wooden cups, pieces of pottery – and our numbered bones. These bones are 5,000-year-old dice whose design and purpose have remained practically identical until today. A modern person would immediately know how to use them.

While knucklebones could provide amusement in their own right, numbering their sides created a whole new world of gaming opportunities. Dice are the original random number generators – they created the chance.

Dice are peculiarly universal. More often than not, from Europe to Asia, the sides are numbered with “pips” rather than writing, just like the two found in Skara Brae. Dice with pips have remained unchanged for millennia.

No one knows where and when the custom of numbering the opposing sides of a cubic die so that each opposing pair adds up to seven comes from. Irving Finkel, a philologist and expert on Mesopotamian language and culture at the British Museum, suggests people might have thought this made dice “fair” though there is no scientific reason why it would. Whatever the logic, the tradition has stuck, and almost all examples of six-sided dice throughout history have opposing faces adding up to seven.

Early dice almost certainly didn’t have six sides. In fact, knucklebone dice might have been rolled for “yes” and “no” questions before being numbered, with the two larger, flatter sides providing the result, says Finkel. One side might have been rubbed in charcoal so that one face was black and one white.

There are other contenders for the earliest dice; two-sided throwing sticks were used in Ancient Egypt at roughly the same time, “which long preceded the manufacture of six-sided dice”, says Finkel, and four-sided pyramids were used in the Middle East.

Knowing exactly which games played with dice came first is impossible, says Ulrich Schädler, director of the Swiss Museum of Games, unless the materials were carved in stone or bone. Some of the earliest games we can be certain about include one called “20 squares” in which players race counters across a board of 20 squares, some of which are safe, some of which are shared with your opponent, giving them a chance to send your counter back to the start. The game has been likened to backgammon.

Versions of this game have been found in North Africa, the Middle East and the Indian subcontinent, the most notable example of which is the Royal Game of Ur, named after the ancient city in Mesopotamia (now Iraq). The Ur board, inlaid with a mosaic made of seashells and played using a pyramid-shaped die, dates to the mid-third millennium BC and is on display at the British Museum. It was Finkel who uncovered its rules.

Another game called senet was played in Egypt around the same time. Several well-preserved boards have been found in tombs of the pharaohs and pictured in wall paintings.

But Schädler says that games like this were not just played by royalty. The Ur board is exquisite, but simple boards were scratched into stone or even the earth. He says it is difficult to know how earlier versions of these games developed if they were played on the earth with pebbles, so boards made for the rich left in burial chambers and illustrations on walls provide the best materials to work from.

“Things like that only appear in the high ancient civilisations like Egypt, Ur and the Indus Valley [around modern-day Pakistan and Afghanistan],” says Schädler.

Examples from earlier than the third millennium BC become contentious. There are stones carved with long rows of holes found in Africa, Arabia and the Middle East some of which date back between 7000BC and 9000BC. These holes have been likened to a modern African game called mancala in which two players race seeds or pebbles between the holes.

It is impossible to tell if these holes are an early version of mancala as the playing pieces do not remain. Schädler is not convinced: “Between these boards and the earliest real board games there would be 3,500 years of nothing. This is highly unlikely,” he says.

But Finkel says “they are more likely to be games than anything else. Some say they are a type of early calculator or were used in rituals. This is possible. But there was an excavation in Arad in southern Israel in which many houses had one of these flat, prepared boards with parallel holes. Maybe [the inhabitants] just sat there and made calculations all day – but I don’t believe it. I believe it was for fun.”

Did anything else come between 7000BC and 2500BC to expand gaming from racing pebbles across the earth to board games that entertained royalty?

One recent find has been suggested by some archaeologists to be a complex strategy game that dates between these periods. But Schädler is unconvinced. Dubbed “Dogs and Pigs”, it seems to comprise two dozen different stone items, including some pyramids, small pigs and dog heads. The items were found in a grave in Turkey that dates to about 3000BC.

“In the museum, they place [the pieces] on a chessboard,” says Schädler. “This is a very typical reaction but is premature for several reasons. The fact these pieces are found together in a grave does not mean they belonged together before being in the grave. Maybe several people put some of the pieces into the grave. Maybe the person buried was a stone worker and this is just an assemblage of the type of pieces he produced.”

Schädler adds that assuming the pieces were played like a game of chess is a huge leap. Games like senet and mancala involve racing simple counters. Chess had innovations that would take thousands of years to develop.

Some archaeologists assume that mancala was played thousands of years ago based on holes found in stones – but there is little other evidence of this, and who knows what rules it was played with. The games that we know were played in the second and third millennium BC have two things in common; they needed dice and they were for two players. Two of the earliest games that we know did not use dice are Go (whose origins are shrouded in folklore but the first board dates from 150BC) and chess (from the Sixth Century AD onwards). Chess also introduced a new innovation – the pieces can make different movements.

Why did it take so long to move away from dice-based games? Schädler thinks it might be because our mathematical abilities were not so sophisticated. “It seems unlikely that at 7000BC they were able to develop such a concept of abstract mathematical thinking,” he says.

Then Schädler suggests that if consciousness then was not as developed as it is now, we couldn’t imagine games that were not reliant on chance. American psychologist Julian Jaynes popularised an idea in the 1970s that even as recently as the Ancient Greeks people believed they were directed by divine intervention.

Jaynes’s definition of consciousness is specific and narrow, says Andrea Cavanna, a neuropsychiatrist at the University of Birmingham, UK, and author of several critiques of Jaynes’s ideas. Jaynes believed that even though people were able to speak, judge, reason, solve problems and do many of the things we associate with intelligence, they were not conscious.

“He argued that there is evidence of such pre-conscious mentality in the earliest extensive text of Western culture, The Iliad,” says Cavanna of the Ancient Greek epic poem from around 1200BC. “The human beings told of in The Iliad are portrayed [as] ‘noble automata’ executing divine orders.”

Jaynes suggested the brain was split in half, with the right hemisphere creating hallucinations that gave the impression of a divine voice. “This ‘bicameral mind’ literally broke down around 1400-600BC,” says Cavanna. From The Odyssey onwards literary characters appear to have a consciousness that is familiar to us.

Jaynes’s ideas are controversial in the field of neuroscience, but “everything we know about the evolution of consciousness in our species is still mostly speculation”, says Cavanna. “The questions ‘What is human consciousness?’ and ‘How did human consciousness evolve?’ are intertwined and stand as a yet unanswered conundrum.”

If Jaynes was right that humans as recently as the Ancient Greeks thought they lacked any autonomy over their decision-making, perhaps this is why they were unable to think of a game that was not reliant on chance, says Schädler. “In light of this theory, it was not possible to imagine a gaming piece on the board with an internal capacity to move. It had to move from something external – a random generator.”

Chess is having a moment in the sun as a result of Netflix’s The Queen’s Gambit. The show stars Anya Taylor-Joy as Beth Harmon, a young prodigy who takes on the game’s establishment. Does the game’s invention mark a point at which human thinking changed? Unfortunately, chess did not arrive fully formed into the world and early examples of the rules suggest it still relied on chance.

The 1283 Spanish book Libro de los Juegos (Book of Games) is one of the earliest texts on games and describes dozens of ways to play chess, including a four-player game that required dice. There was also no mention of the queen piece in the book. The queen might date from later or just was not used in Spain.

“The rise of women leaders in medieval Europe changed the power of that character,” says Mary Flanagan, author of Critical Play and a professor of film and media studies at Dartmouth College, United States. “The change in one game can reflect a change in cultural values. It was the case that the king used to be the most powerful piece, and then the queen was.”

Innovations in gameplay might reflect culture more than biology, says Flanagan. Some historians link early games with divination methods – both of which seemed to use boards, pieces and dice.

In divination, you need random generators. The role of the interpreter is then to look at the random outcome and divine meaning – Ulrich Schädler

“We do not really know which is the hen and the egg,” says Schädler. “In divination, you need random generators. The role of the interpreter is then to look at the random outcome and divine meaning.”

Flanagan agrees. “Games have a link to the occult and folk practices,” she says. “They used largely the same materials. It is easy to see the link people drew between random events on a board and ritual.”

Did people play in order to find higher meaning? The “neurophysiological data provide weak support for a bicameral structure of the preconscious mind”, says Cavanna, and “by placing [the mind’s] breakdown in historical times, rather than biological eons, Jaynes somewhat overstated his case and exposed himself to grounded criticism. But this does not detract from his extensive work and audacious attempt to fill a gap in our knowledge about a key feature of what makes us human.”

Finkel is also sceptical. “If you wishy-washily destroy the border between [games and ritual] you can say anything is anything. [A game’s] job on the globe is to bring us pleasure.”

Creating randomness was essential to kick start structured play and gave rise to games any of us would know how to play today. But working out how to play without chance opened up even more possibilities. Perhaps that is all there is to it, concludes Finkel. “Humans have always innovated new ways to have fun.”