Jacques Mattheij made a small, but awesome, mistake. He went on eBay one evening and bid on a bunch of bulk LEGO brick auctions, then went to sleep. Upon waking, he discovered that he was the high bidder on many, and was now the proud owner of two tons of LEGO bricks. (This is about 4400 pounds.) He wrote, "[L]esson 1: if you win almost all bids you are bidding too high."

Mattheij had noticed that bulk, unsorted bricks sell for something like €10/kilogram, whereas sets are roughly €40/kg and rare parts go for up to €100/kg. Much of the value of the bricks is in their sorting. If he could reduce the entropy of these bins of unsorted bricks, he could make a tidy profit. While many people do this work by hand, the problem is enormous—just the kind of challenge for a computer. Mattheij writes:

There are 38000+ shapes and there are 100+ possible shades of color (you can roughly tell how old someone is by asking them what lego colors they remember from their youth).

In the following months, Mattheij built a proof-of-concept sorting system using, of course, LEGO. He broke the problem down into a series of sub-problems (including "feeding LEGO reliably from a hopper is surprisingly hard," one of those facts of nature that will stymie even the best system design). After tinkering with the prototype at length, he expanded the system to a surprisingly complex system of conveyer belts (powered by a home treadmill), various pieces of cabinetry, and "copious quantities of crazy glue."

The key part of the system was running the bricks past a camera paired with a computer running a neural net-based image classifier. That allows the computer (when sufficiently trained on brick images) to recognize bricks and thus categorize them by color, shape, or other parameters. Remember that as bricks pass by, they can be in any orientation, can be dirty, can even be stuck to other pieces. So having a flexible software system is key to recognizing—in a fraction of a second—what a given brick is, in order to sort it out. When a match is found, a jet of compressed air pops the piece off the conveyer belt and into a waiting bin.

After much experimentation, Mattheij rewrote the software (several times in fact) to accomplish a variety of basic tasks. At its core, the system takes images from a webcam and feeds them to a neural network to do the classification. Of course, the neural net needs to be "trained" by showing it lots of images, and telling it what those images represent. Mattheij's breakthrough was allowing the machine to effectively train itself, with guidance: Running pieces through allows the system to take its own photos, make a guess, and build on that guess. As long as Mattheij corrects the incorrect guesses, he ends up with a decent (and self-reinforcing) corpus of training data. As the machine continues running, it can rack up more training, allowing it to recognize a broad variety of pieces on the fly.

Here's another video, focusing on how the pieces move on conveyer belts (running at slow speed so puny humans can follow). You can also see the air jets in action:

In an email interview, Mattheij told Mental Floss that the system currently sorts LEGO bricks into more than 50 categories. It can also be run in a color-sorting mode to bin the parts across 12 color groups. (Thus at present you'd likely do a two-pass sort on the bricks: once for shape, then a separate pass for color.) He continues to refine the system, with a focus on making its recognition abilities faster. At some point down the line, he plans to make the software portion open source. You're on your own as far as building conveyer belts, bins, and so forth.

Whether you're planning a bachelorette party or recovering from a breakup, a well-curated playlist makes all the difference. If you don't have time to pick the perfect songs manually, services that use the AI-driven system Sonic Style may be able to figure out exactly what you have in mind based on your request.

According to Fast Company, Sonic Style is the new music-categorizing service from the media and entertainment data provider Gracenote. There are plenty of music algorithms out there already, but Sonic Style works a little differently. Rather than listing the entire discography of a certain artist under a single genre, the AI analyzes individual tracks. It considers factors like the artist's typical genre and the era the song was recorded in, as well as qualities it can only learn through listening, like tempo and mood. Based on nearly 450 descriptors, it creates a super-accurate "style profile" of the track that makes it easier for listeners to find it when searching for the perfect song to fit an occasion.

Playlists that use data from Sonic Style feel like they were made by a person with a deep knowledge of music rather than a machine. That's thanks to the system's advanced neural network. It also recognizes artists that don't fit neatly into one genre, or that have evolved into a completely different music style over their careers. Any service—including music-streaming platforms and voice-activated assistants—that uses Gracenote's data will be able to take advantage of the new technology.

With AI at your disposal, all you have to do as the listener is decide on a style of music. Here are some ideas to get you started if you want a playlist for productivity.

The only thing you can be certain about in life is death. Or is it? Merriam-Webster defines death as "a permanent cessation of all vital functions." The Oxford English dictionary refines that to "the permanent ending of vital processes in a cell or tissue." But determining when someone is dead is surprisingly complicated—the medical definition has changed over the centuries and, in many ways, is still evolving.

DEATH, DEFINED

For most of human history, doctors relied on basic observations to determine whether or not a person had died. (This may be why so many feared being buried alive and went to great lengths to ensure they wouldn't be.) According to Marion Leary, the director of innovation research for the Center for Resuscitation Science at the University of Pennsylvania, "If a person wasn't visibly breathing, if they were cold and bluish in color, for example, they would be considered dead."

As time went on, the markers for death changed. Before the mid-1700s, for example, people were declared dead when their hearts stopped beating—a conclusion drawn from watching traumatic deaths such as decapitations, where the heart seemed to be the last organ to give up. But as our understanding of the human body grew, other organs, like the lungs and brain, were considered metrics of life—or death.

Today, that remains true to some degree; you can still be declared dead when your heart and lungs cease activity. And yet you can also be declared dead if both organs are still working, but your brain is not.

In most countries, being brain dead—meaning the whole brain has stopped working and cannot return to functionality—is the standard for calling death, says neuroscientist James Bernat, of the Geisel School of Medicine at Dartmouth College in New Hampshire. "A doctor has to show that the loss of brain function is irreversible," he tells Mental Floss. In some cases, a person can appear to be brain dead if they have overdosed on certain drugs or have suffered from hypothermia, for example, but the lack of activity is only temporary—these people aren't truly brain dead.

In the U.S., all states follow some form of the Uniform Determination of Death Act, which in 1981 defined a dead person as "an individual who has sustained either (1) irreversible cessation of circulatory and respiratory functions, or (2) irreversible cessation of all functions of the entire brain, including the brain stem."

But that's not the end of the story. In two states, New York and New Jersey, families can reject the concept of brain death if it goes against their religious beliefs. This makes it possible for someone to be considered alive in some states and dead in others.

A BLURRED LINE

In the past, if one of a person's three vital systems—circulation, respiration, and brain function—failed, the rest would usually stop within minutes of each other, and there was no coming back from that. But today, thanks to technological advances and medical breakthroughs, that's no longer necessarily the case. CPR can be performed to restart a heartbeat; a person who has suffered cardiac arrest can often be resuscitated within a 20- to 30-minute window (in rare cases, people have been revived after several hours). And since the 1950s, machines have been used to take on the role of many of the body's vital functions. People who stop breathing naturally can be hooked up to ventilators to move air in and out of their lungs, for example.

While remarkable, this life-extending technology has blurred the line between life and death. "A person can now have certain characteristics of being alive and others of being dead," Bernat says.

People with severe, irreversible brain damage fall into this mixed category. Many lie in intensive care units where ventilators breathe for them, but because they have minimal reflexes or movements, they're considered alive, especially by their families. Medical professionals, however, may disagree, leading to painful and complex debates about whether someone is alive.

Take the case of Jahi McMath, whose tonsil surgery in 2013, at age 13, went terribly wrong, leaving her brain dead—or so doctors thought. Her family refused to believe she was dead and moved her from Oakland, California, to New Jersey, where she was provided with feeding tubes in addition to her ventilator. After several months, her mother began recording videos that she said were proof that Jahi could move different parts of her body when asked to. Additional brain scans revealed that although some parts of her brain, like her brain stem, were largely destroyed, the structure of large parts of her cerebrum, which is responsible for consciousness, language, and voluntary movements, was intact. Her heart rate also changed when her mother spoke, leading a neurologist to declare last year, after viewing many of her mother's videos, that she is technically alive—nearly four years after she was pronounced brain dead. By her mother's reckoning, Jahi turned 17 on October 24, 2017.

Organ donation adds another layer of complications. Since an organ needs to be transplanted as quickly as possible to avoid damage, doctors want to declare death as soon as they can after a person has been disconnected from a machine. The protocol is usually to wait for five minutes after a donor's heart and breathing have stopped. However, some believe that's not long enough, since the person could still be resuscitated at that point.

Bernat—whose research interests include brain death and the definition of death, consciousness disorders including coma and vegetative states, and ethical and philosophical issues in neurology—disagrees. "I would argue that breathing and circulation has permanently ceased even if it hasn't irreversibly ceased," he says. "It won't restart by itself."

THE FUTURE OF BRINGING PEOPLE BACK TO LIFE

As resuscitation technology improves, scientists may find new ways to reverse death. One promising approach is therapeutic hypothermia. Sometimes used on heart attack patients who have been revived, the therapy uses cooling devices to lower body temperature, usually for about 24 hours. "It improves a patient's chance of recovering from cardiac arrest and the brain injury [from a lack of oxygen] that can result from it," says Leary, who specializes in research and education relating to cardiac arrest, CPR quality, and therapeutic hypothermia.

One more out-there possibility—which had its heyday in the early 2000s but still has its proponents today—is cryonic freezing, in which dead bodies (and in some cases, just people's heads) are preserved in the hope that they can be brought back once technology advances. Just minutes after death, a cryonaut's body is chilled; a chest compression device called a thumper keeps blood flowing through the body, which is then shot up with anticoagulants to prevent blood clots from forming; and finally, the blood is flushed out and replaced with a kind of antifreeze to halt the cell damage that usually occurs from freezing.

The idea is highly controversial. "It makes a good story for a movie, but it seems crazy to me," Bernat says. "I don't think it's the answer." But even if cryogenics is out, Bernat does believe that certain types of brain damage now thought to be permanent could one day be subject to medical intervention. "There is currently a huge effort in many medical centers to study brain resuscitation," he says.

Genetics provides another potential frontier. Scientists recently found that some genes in mice and fish live on after they die. And even more surprisingly, other genes regulating embryonic development, which switch off when an animal is born, turn on again after death. We don't yet know if the same thing happens in humans.