This story appears in ESPN The Magazine's March 4 Analytics issue. Subscribe today!

Bob Voulgaris had become one of the most successful sports gamblers in the world when, in 2004, he started to lose. It wasn’t just a streak of bad luck, a series of randomly unfavorable outcomes that could last only so long. His edge, he realized, was gone.

He had begun betting on sports in the late 1990s, and within five years, before he had reached his 30th birthday, Voulgaris had accumulated a fortune. He says he routinely wagered a million dollars in a single day of NBA games. He considered his mean to be an unholy winning percentage that approached 70 percent. A man of no fixed address, he dated models and traveled the world. He was also an accomplished poker player, buying his way into high-stakes games from Las Vegas to Macau. He was essentially leading the fantasy life of your basic under-35 North American male.

A specialist in the NBA, his sports gambling success was almost completely the result of a kind of studied perspicacity, born of a talent for pattern recognition and the stamina to watch uncountable hours of televised basketball. In betting parlance, the man could suss out an edge -- and in 2002, he discovered one that would line his pockets for years. It all had to do with how most bookmakers set their halftime totals, the predicted number of points scored in each half of the game. Each half, of course, is its own discrete period of play, and the fourth quarters of close games can end in elongated foul-clogged stretches of free throws, timeouts, fast play and, hence, a burst of scoring. But incredibly, bookmakers at the time didn’t account for this fact; they simply arrived at a total for the full game and cut that figure roughly down the middle, assigning some 50 percent of the points to the first half and 50 percent to the second.

For years, Voulgaris exploited this edge, playing both sides of it repeatedly. It is possible to say that it alone made him millions, combined with some keen observations regarding the game-management tendencies of three head coaches: Eddie Jordan, Jerry Sloan and Byron Scott. “Those were three coaches I had nailed perfectly,” Voulgaris, now 37, says. “I knew exactly what they were going to do. I mean, it was a joke, it was so easy.”

In retrospect, he regrets only not having bet more aggressively during this halcyon period. “I thought it would last forever,” he tells me

when I visit him at the house he was then renting in the Hollywood Hills for $12,500 a month. “But it didn’t.” Eventually, the bookmakers did finally catch on. Responding specifically to the money they saw Voulgaris minting -- though, for the most part, they didn’t yet know the identity of the gambler winning with such consistency -- they forever altered the method by which they set their NBA halftime totals.

And that’s when Voulgaris started to lose. And lose big. He lost a third of his bankroll in the final month of the 2003-04 season alone. Exasperated, his patience gone, he started to “tilt,” boosting the volume of his wagers in an effort to win back what he’d already lost. He won’t quantify exactly how much he gave back to the bookmakers all told except to describe it as a catastrophic time. He took the second part of the 2004-05 NBA season off. Mulling things over, he realized he needed a new approach. In essence, he decided he could no longer rely on his ability to suss out edges by his wits alone. He needed the help of a new machine.

Like baseball after sabermetrics, like Wall Street in the 1970s, sports gambling over the past decade has undergone a quantitative revolution. Nearly every successful sports bettor in the world now uses some form of computer model to assist in the handicapping of sporting events. Like their brethren inside hedge funds, these gamblers are known as quants. Like the advanced trading systems operating on Wall Street, the models used by this technologically adroit breed of sports bettor are sometimes called black boxes. Their models (and their identities) are shrouded in secrecy. Their algorithms are proprietary. And with each passing year, their sophistication mounts. One veteran Las Vegas handicapper, who goes by the pseudonym Steve Fezzik, laments, “They’ve left me, and others like me, in the dark ages.” Bayesian methods, Monte Carlo methods, Markov chains, k-nearest neighbor algorithms, Chapman-Kolmogorov equations -- the key advances in statistical analysis, probability theory and predictive modeling have been marshaled toward the object of beating the bookies out of a dime. Their goal is nothing less than a sustainable edge.

It is a paradoxical quest. The history of sports betting is littered with the corpses of gamblers who have enjoyed spectacular runs only to flame out just as quickly when their edges die. When they see a gambler winning big, bookmakers correct their mistakes. Rival gamblers spot the same edges -- or copy them -- and bet the line back to plumb.

Indeed, while the wide availability of information in the Internet age and exponential increase in computer processing power have given rise to the sports gambling quant, those very same factors have made the pursuit of a sustainable edge that much more quixotic. The marketplace evolves. The betting public, square though it may be, is better informed than ever before: Reams of team and player statistics reside in the cloud, awaiting download. The bookmakers, meanwhile, have joined the quantitative battle. Some who formulate the opening lines (only a few still do so; all the others simply copycat) have engineered their own sophisticated models. Cantor Fitzgerald, the Wall Street trading firm, started a division called Cantor Gaming in 2008 to operate a sportsbook business in Las Vegas, then acquired the consulting firm that had been the oddsmaker of record for the gambling world. Cantor’s computer model is named Midas. Andrew Garrood, a former high-finance quant whose previous experience included developing pricing models for interest rate derivatives at a London bank, designed it. “It’s hubristic to believe that the edge you have today will be yours forever,” he says. “The marketplace will always catch up.”

None of this, of course, has stopped the world’s sharpest quant bettors from trying.

A slim six-footer with dark hair and dark eyes, Voulgaris talks fast. His eyes flit. He has the canny, quick-minded air of a merchant in a bazaar in the Eastern Mediterranean. Since birth, he seems never to have lacked for self-confidence. He likes to say that he had no mentors when it comes to his gambling career, but in reality, he did.

When Voulgaris was 18, he took a gap year between high school and college. First he traveled to Greece, visiting the hardscrabble villages -- Argos, Tripoli -- where his parents were born and raised before they immigrated, in their 20s, to Canada. (Voulgaris’ legal first name is Haralabos.) Then he and his father made a trip to Las Vegas, where they lived for most of the next two months at Caesars Palace. The elder Voulgaris had risen from poverty to become a successful Winnipeg entrepreneur. He developed commercial real estate; he owned and operated a Greek restaurant called Hermes -- the patron god of (among other things) games, sports and sudden enrichment. His net worth grew into the millions; he also happened to be an avid gambler. Voulgaris’ father bet on horses, sports of all kinds, card games, dice games, penny stocks. He was also, his son now suggests, the consummate square. “He would just hold up a newspaper and get a feel for what he wanted to bet. There was no rhyme or reason to it. He was very, very superstitious. He would have dreams, with, like, numbers and colors in them, and that would influence him.” Voulgaris says his father went broke twice, both times sending the family into near destitution. “Don’t write ‘degenerate,’ ” Voulgaris tells me. “He was an ‘unsuccessful’ gambler.”

Nevertheless, Voulgaris remembers those Vegas days fondly. He couldn’t join his father on the casino floor for his blackjack sessions; he was 18 and underage. So he spent most of his time in the Caesars sportsbook. Because it was basketball season, he watched a lot of NBA, but with a purpose. He paid attention to adjustments, the ebb and flow of the pace of play. He took notes on what he saw. He eavesdropped on his fellow gamblers. Even then, as a pup bettor, he had a dim view of this group: “Most people who are in a sportsbook in Las Vegas spouting their opinions are morons.” His father would join him at night. At times they wagered together. The younger Voulgaris recalls that his biggest bet the whole trip came on an Atlanta-Golden State game, $100 on the spread, “which I lost.” These were formative times. His two months in Vegas -- and, really, the whole of his childhood -- were an education by counterexample. But while many people, if faced with Voulgaris’ early experiences, might have renounced the gambling life with the fervor of a prohibitionist, Voulgaris seems to have gleaned a kind of edge from it. “I learned at a young age that it’s tough to beat the house,” he says. “Unless you know what you’re doing.” By the time the younger Voulgaris was enrolled at the University of Manitoba, working as a skycap at the airport and betting small amounts on the NBA and CFL, he and his brother -- two of four siblings in all -- were paying their parents’ rent.

The first computer model put into the service of sports gambling dates to the late 1970s, when Michael Kent, a former nuclear submarine engineer for a Pentagon contractor, wrote a program that predicted NFL, college football and college basketball scores. Kent fed his algorithms, inscribed on punch cards, into a rented mainframe that had less processing speed than today’s high-end laptops. At the time, though, he was going up against green-eyeshade bookmakers armed with nothing more than adding machines and intuition. It was hardly a fair fight. Kent eventually moved to Las Vegas, where a betting syndicate -- the legendary Computer Group -- formed around his work, winning untold millions for its members well into the 1990s. Kent continued to develop models and bet on sports up until seven years ago. He is now retired, according to his lawyer, his whereabouts closely guarded. “He’s very reclusive,” the lawyer, Steven Brooks, says.

Billy Walters, a core member of the Computer Group, has, however, stayed in the game; he now has a staff of consulting mathematicians who have built advanced predictive models to project scores. Walters, Kent and their syndicates stood basically alone until the late 1990s, when PCs became powerful enough to do the computation work required by predictive models, and more data became available to feed them.

Voulgaris was well aware of these predecessors. Analytics and predictive modeling had “always fascinated me,” he says. “I’d always wanted to have a model of sorts.” Throughout his career, Voulgaris had been what is known as a subjective bettor, albeit one so astute that he became a whale. Two huge bets -- both for the Lakers to win the title in 1999 and 2000 -- had turned about $80,000 in savings into more than $1 million, his first fat bankroll. As a purely subjective bettor, Voulgaris had been placing perhaps 350 individual wagers each season. But after the disastrous end to the 2004 season, with his edge gone, he decided that he should increase his betting frequency by an order of magnitude but decrease the sums he was putting at risk on each wager. It only made probabilistic sense. If his return on investment (ROI) fell from 20 percent to, say, 5 percent, that was okay. Five percent of $50 million is better than 20 percent of $5 million (all figures are hypothetical; Voulgaris is as cagey as any gambler about the true size of his bankroll). This new approach would require an enormous amount of research and analysis. It would require projecting a score for each and every game in an NBA regular season -- all 1,230. A single human mind would be overwhelmed by the workload; only a computer program could handle it.

“If you think about it,” he says, “you’d be a slave to the game of basketball otherwise.”

Voulgaris chose the right moment to start building a predictive model for NBA games. Four years earlier, in the 2002-03 season, the league had for the first time made play-by-play information available to the public, whereas before only box scores were published. This trove of fresh information had no immediate practical value, except perhaps to assuage fan curiosity. But by 2006, a large enough sample of data had accumulated to employ it with scientific rigor.

To help him build his model, Voulgaris required a specialist in the field, a mind trained in the codes of statistics, mathematics and computer science. He started the search in 2005. It took him two years and six individual tryouts -- most of those interviewees were found online, Voulgaris says, and two of them landed in NBA front offices -- to find the right person. The right person was a literal math prodigy. As a preteen, he had won national math contests; he had been the subject of awestruck articles in major newspapers. He had scored a perfect 800 on the math portion of the SAT when he was in seventh grade. At the time of his interview with Voulgaris, he had just quit a high-paying job designing algorithms for an East Coast hedge fund with a roster of Nobel-grade quant talent. Voulgaris does not wish to have the name of this math whiz appear in print, presumably out of fear that some rival will attempt to find the whiz -- let’s call him the Whiz -- and poach him. When I visit Voulgaris at his rental in the Hollywood Hills, he tells me that he’s recently made the Whiz his partner. “50-50?” I ask.

“No.”

The relationship got off to a rocky start. In 2007 the Whiz basically spun his wheels striving to build a model on his own during his first offseason in Voulgaris’ employ. “He was optimistic that he’d be able to come up with something by the time basketball season started,” Voulgaris says, “and he just flailed away.” Voulgaris decided to shorten the leash, and together the two determined that what they needed was a program that could simulate a game of basketball between any two teams at any point in a season and spit out a projected score. To do so, they would have to break the game down into its basic unit, the possession. Each simulation would therefore be a series of mini-simulations. First, the program would have to predict the number of possessions each matchup would likely produce. Then it would need to judge the likeliest outcome of each possession: Score or no score; one point, two points or three; micro-forecasts ascertained from historical performance data. It would also have to take into account a vast number of potential occurrences, each missed shot or successful rebound creating the possibility of still other occurrences -- a garden of explosively forking paths, as if in parallel universes. The program would run tens of thousands of simulations for each matchup, discarding the most outlandish or improbable results. It would be a black box -- prophecy as output.

Between the statistical analysis, the algorithms and the programming, it took two years to create their first model, version 1.0. Voulgaris continued to bet subjectively, marking time until the model was ready. When they finished, they called it Ewing. (It wasn’t named after Patrick, per se, but after the “Ewing Theory,” a purported phenomenon famously described by Bill Simmons under which a team improves whenever its overrated superstar leaves the franchise.) At some point in the process of breaking the game down into its component parts, they realized that Ewing would also require a kind of feeder model, one that could forecast the lineups a team would most likely use each game and the minutes each player was likely to see on the court. They called that model Van Gundy. Van Gundy, in turn, required its own feeder tool, one that would track the overall roster patterns for each team, the trades, the draft picks, the midseason player-acquisition tendencies. That database, less intricate than the other two, they at times jokingly referred to as Morey, as in Daryl Morey, the quant-minded GM of the Rockets. Ewing, Van Gundy, Morey. Player, coach, GM. The names of each corresponding, of course, to the job of each tool.

In the summer of 2007, Voulgaris and the Whiz took Ewing on a dry run, testing the simulator against games from the previous season to see how accurately it could retroactively “predict.” But something funky was happening. Every score the model spit out was higher than the average lines produced by the bookmakers -- the standard by which they would be judging themselves. The model, in other words, was recommending that Voulgaris bet the over in every single game. After weeks spent poring through code, Voulgaris finally caught the flaw. When assigning variables in the model, the Whiz had somehow assumed that the league-average free throw percentage was 88 percent, when in fact it’s around 75 percent -- an absurd mistake on the part of the Whiz, whose basketball knowledge at the time was practically nil. In more advanced versions of Ewing, they would jettison this primitive free throw method. Now, says Voulgaris, they’ve adjusted Ewing so that it predicts the player most likely to be fouled on any given individual possession, then uses that player’s specific free throw percentage to run its simulation.

If Ewing has a secret sauce, it’s just this sort of thing: Finding scraps of information, sliced and diced ever more finely, that reveal something about how a system -- in this case, a game of pro basketball -- will operate in the future. The key is to find those scraps that are more predictive than others. Case in point: One of Ewing’s most important functions is to assign values to players. Each player has two values -- on offense and as a defender -- and those values are constantly changing. Ewing will also automatically adjust the value depending on who’s guarding whom. Oklahoma City’s Kendrick Perkins “is more valuable guarding Dwight Howard than he is guarding Shane Battier,” Voulgaris says. Why? “Because Howard is a unique player, and you need a big to defend him.” Likewise, according to Voulgaris, Celtics seven-footer Jason Collins is “useless every game, except when he’s guarding Howard, which he does really, really well.” Player values also change across a season and a career. So Voulgaris and the Whiz created, for Ewing, an aging component. Further number-crunching revealed that different types of players, based on position and size, will reach their zeniths at different ages and on trajectories that are possible to predict. Ewing now grasps the curve of the lifespan of the point guard, the shooting guard, the forwards, the center -- and predicts the downslope and expiration date of every NBA career.

When Ewing went live with actual betting for the first time toward the end of the 2008 season, Voulgaris was not yet sold on its powers. For one thing, his subjective-gambler side wasn’t ready to surrender control to a machine. For another, the model was performing unremarkably with their money on the line -- right above the break-even line. But Voulgaris had something in mind, “a long project, like a six-month-long project, to model a certain part of the game of basketball.” He and the Whiz spent the offseason pursuing this mysterious project, the precise nature of which Voulgaris will not discuss. “I don’t even want to allude to what it might be,” he says when I press him, “because I don’t think anyone else is doing anything like it.”

By 2009, once they’d added this mysterious additional model to Ewing’s inner workings -- version 2.0 -- they started making bets based on the scores it produced after the All-Star break. “We just, like, crushed the second half of the season,” Voulgaris says. Since then, as each subsequent season has passed, Voulgaris’ confidence in Ewing has increased. So too has the frequency of his wagering. In a season, he now regularly puts down well over 1,000 individual bets. “I mean, I don’t want to sit here and brag,” he says. “But this is literally, like, the greatest thing ever when it comes to sports betting.”

Despite believing himself to be in possession of the world’s most lethal gambling device, Voulgaris, in the middle of Ewing’s second season on the job, nearly walked away from it all. It might come as little surprise to learn that Voulgaris has intermittently dreamed of becoming the general manager of an NBA franchise. “This is going to sound really arrogant,” he says. “But the whole process” -- of studying the game of basketball with the end of beating the books -- “has led me to believe that I’d be able to put together a better team than almost any general manager in the league. If not maybe all.”

In pursuit of this, in 2010 Voulgaris broke one of the cardinal rules of the sharp sports bettor: He sought publicity, conducting interviews with gambling and NBA-centric blogs. As with everything Voulgaris does, it was a calculated move. He wanted to burnish his bona fides as a quantitative basketball expert. And it worked. Despite the fact that he was giving up a yearly income that he says would dwarf all but the highest-paid executive in the NBA -- who is Jerry West of Golden State, Voulgaris is quick to point out -- he stopped gambling and signed a contract during the 2009-10 season with one of the co-owners of an NBA franchise to consult on matters of player acquisition and roster assembly. The owner, according to Voulgaris, made certain alluring pledges. “He was like, ‘You could be my GM someday; we can do this together.’ It was this whole spiel.”

Voulgaris won’t name names, nor will he say how he first met this particular owner. He has had contact with other NBA executives; he has met, for example, Daryl Morey. (Voulgaris has assured me that it wasn’t the Rockets he consulted for.) As his move to the NBA suggests, there is today much common currency between the analytical work of the sports gambler and that of an increasing number of professional teams’ front offices; one of the chief goals of both, after all, is to value players. The quant revolution in sports at large has brought these two worlds closer together than ever before, at least intellectually. Every winter at the MIT Sloan Sports Analytics Conference, members of the gambling community openly intermingle with GMs and their staffs of wonkish analysts.

“If I were the general manager of a team,” says Voulgaris, who will be attending the Sloan conference for the second time, in early March, “and I had someone building models and doing quantitative work -- if that person could not beat the Las Vegas line, his model wouldn’t be worth anything to me.” The reason? The way he sees it, the best and perhaps the only way to test one’s theories about player value is to take those theories to market. And the only market that’s liquid with money flows in the billions is the betting line, where opinions have a daily price. “Over thousands of samples of games, our model is constantly being tested on whether it’s right or wrong,” Voulgaris says. “If we’re wrong, we lose money. If we’re right, we make money.”

Voulgaris spent five months working for the NBA franchise. He says he advised his co-owner client on several trades. But he also felt excluded, held at arm’s length. “It was like if someone put a puzzle in front of you and said, ‘Solve this.’ But then, in order to solve it, you needed this special key that they weren’t going to give you.” He feels now that for all the momentum of the quant revolution in the NBA, there may be a glass ceiling for its true practitioners. “There’s a real disconnect between the basketball people, the business people and the -- for lack of a better word -- stats nerds. The stats nerds have no chance of ever becoming general managers. They’re just being used as a resource to mine.” At the end of the contract’s term, in the summer of 2010, Voulgaris decided to end his NBA flirtation and go back to being a gambler.

In truth, though, what Voulgaris says he missed most during his five-month hiatus from gambling was the gamble itself: “I was bored out of my tree.” Little wonder, given the frisson of his betting sessions. During the NBA regular season, which he splits between any number of North American and international ports of call, he watches as many games as he can, clocking more than 80 hours a week. No matter where he is -- LA or, say, Monaco, where he rents a flat -- his normal position during his game-day gambling shifts is supine on a couch, feet up on an ottoman, body nearly horizontal, a MacBook Pro resting between his lap and his knees, Ewing’s interface on the laptop’s screen, his dog (a Jack Russell named Coltrane) lying under his feet. He typically faces a wall against which rises a rack of Samsung flat-screens: a 65-inch central TV flanked on both sides by vertical ranks of three 40-inch screens, each showing a game. From here, he orchestrates his wagering: Ewing spits out a projected score and a number representing its level of confidence for each potential wager. Any projection above a certain threshold on that confidence scale Voulgaris will bet, though he sometimes overrides Ewing’s recommendations. He shows no emotion while watching the games on which he’s laid tens and perhaps hundreds of thousands, though he does very much sweat it on the inside, he says. In his words, “You’d have no chance of telling whether I was winning or losing.” During the season, he will bet, watch games, eat and sleep -- in that order of importance -- and do little else. To stay in shape, he doesn’t consume food after nightfall. This is a lifestyle not exactly conducive to relationships: He partly attributes his recent breakup with a girlfriend of five years to his odd hours during the season.

Despite it all, Voulgaris faces the same issue that all sharps face: the sustainability of his edge, no matter how sophisticated the model that produces it. When he returned to gambling for the 2010-11 season, Voulgaris says Ewing clocked an ROI of more than 6 percent. By 2011-12, it had fallen to 5.14 percent. Of course, the lockout-shortened season made for a bizarre outlier year, and Voulgaris and the Whiz had to adjust. Basically they subtracted a varying amount from the scores Ewing gave them, trying to account for the rust that kept scoring low at the start of the season, and the compressed number of games that later fatigued players -- and also kept scoring low -- toward the end of the season. But the limits of Ewing were apparent to Voulgaris. Already he sensed the inevitable. “We’re probably already at the point where my capability to make money is decreasing every year,” he says. “Every time you make a bet, you’re educating the people taking the bets. They’re learning the right way to make a line. They figure s -- out based on what you’ve already figured out.”

If, year after year, his margins are deteriorating, Voulgaris must increase the number of bets he makes in order to account for that slippage, just as he did when he moved from a subjective to a quant approach. He and the Whiz tweak Ewing in a ceaseless effort to incrementally improve its ability to spit out projections that carry high-enough confidence readings. “You’re not even improving it so much as trying to stop it from getting worse.” Like a fund manager, he must cope with the fine line between ROI, the number of bets he makes and the natural volatility caused by the random. The more he wagers, the more he courts ruin. In one unguarded moment, he tells me, “You can’t do this forever.”

When I visit him in LA over the summer, he and the Whiz are working to finish several potential alterations to Ewing, incorporating offseason player movements and adjusting the model to account for the weird data produced by the 2011-12 campaign. The predictive tool will end up responding in a very predictable way: Its margins will continue to narrow. By the middle of the 2012-13 season, Voulgaris will only say, “This has been one of the more difficult years.”

Voulgaris has only a blurry eye on his own future; Ewing’s simulations can’t help with that sort of prediction. Maybe, he muses at one point, it will be that sports gambling is someday legalized throughout the U.S., which will unleash a thundering flood of square money from casual bettors, exponentially increasing the liquidity in the market. The limits that bookmakers place on bets would increase and so would Ewing’s edge. The prospect makes Voulgaris as giddy as it’s possible for him to be. “That would literally be, like, the best thing ever,” he says. He wonders whether he could become a gambler akin to the Brit Tony Bloom, whose predictive soccer model won him enough quid to acquire the recently promoted Brighton FC. “It’s good to have goals in life, no matter how unrealistic,” Voulgaris says with a wry grin. And with enough gambling winnings, he says he would have only one goal.

“I would buy a basketball team.”