By Pat Graham

Associated Press

The Chicago Cubs fan found the ideal seat at Wrigley Field almost by accident, sitting in the sunniest of spots along the left-field line and finding a friendly vendor to bring some nachos for his buddy. He even caught a foul ball that day.

Of course, that fan was Ferris Bueller and just part of his amazing day after ditching school in the 1986 classic “Ferris Bueller’s Day Off.”

Now the casual fan can find that sort of ideal seat at a major league park — with no principal chasing behind, either.

Joel Carben and two of his sports tech-savvy buddies created IdealSeat, a fan engagement platform that uses heat maps to chart the most likely sections to snare a souvenir foul ball. The site also collects weather information and ranks top concession spots.

So far, their research teams have logged the landing places of 10,000 game balls since its inception three years ago. The company is currently in six parks — AT&T Park in San Francisco, Camden Yards in Baltimore, Citi Field in New York, PNC Park in Pittsburgh, Safeco Field in Seattle, and Tropicana Field in St. Petersburg, Florida — with plans to expand.

Soon, their data gathering may include places such as Yankee Stadium, Fenway Park and, yes, Wrigley Field — an ode to Bueller, their foul ball-catching hero.

“That was the genius of Ferris: He was always in the ideal seat. His whole day was ideal — and he didn’t even need an iPhone,” said Carben, who has had more than 11,000 users visit both the website and mobile application. “Today, everyone is using an iPhone to create an ideal experience to choose their own adventure.”

Carben’s crew came up with the concept innocuously enough as they watched a fan catch a foul ball at a Mariners game.

Good fortune for that fan or good planning?

“Our brains went off: How can we use statistics to find seats with highest probability to find a foul ball?” Carben said.

Carben discovered the Mariners — or any major league team, really — didn’t actively track where foul balls were landing.

So, they began creating a mobile system to track baseballs. The sections shaded in red on the app means have your glove ready. The blue? Probably no need to bring out your mitt.

There’s also a link to a site selling seats, just to see if those best spots are available.

To broaden the fan experience, the company is now looking at stadium food (like where to get those garlic fries at Safeco Field) and weather (the intensity of the sun at a particular seat).

What’s more, they’re examining factors outside the gates of the park, such as the best hotels, hippest bars and tourist attractions. They want to become a TripAdvisor for the baseball fan.

“This is still evolving,” said Carben, who co-founded the company with Luis Carlos Hillon and Zain Khan. “We’re looking at the role of technology to understand and give the fans a great experience.”

At Wrigley Field the other day, a 65-year-old man sitting in the left-field bleachers made an unbelievable catch that has gone viral on video. Carben happened to see the catch and envisions that being one of his users.

“Exactly the place we want our fans to be,” Carben said. “Right place at the right time — and being prepared.”

This is how the operation works: The researcher in a city tracks the flight of every ball hit, logging on their phone app — or noting in an email — whether it’s fair or foul, even the angle at which the ball comes off the bat (popup or line drive, that sort of thing). Those numbers are then entered into the system.

Just to get a lay of the land, Erika Schaub, the research team manager for IdealSeat based out of Citi Field, even sat in every section. Ask Schaub the most likely place to catch a ball at Citi Field, and she instantly responds with section 128. It’s between third base and the left-field foul pole, incidentally.

“If you’re in that area, you always seem to get a foul ball,” Schaub said.

Precisely the point because, “everyone’s Holy Grail is to get a game-used ball,” said Davis Williams, a researcher at Tropicana Field.

Oakland A’s outfielder Sam Fuld is certainly intrigued by the concept, so much so that he joined the group as an adviser.

Fuld has long been a statistics person, and once even interned at the STATS company. He kept a detailed notebook of every pitch delivered to Triple Crown winner Miguel Cabrera and World Series MVP Mike Lowell a few seasons ago with the sole purpose of seeing if there was any correlation between fouling off pitches and their respective on-base percentages.

Before he could crunch his numbers, though, someone stole his notebook.

Hearing about the theft, Carben contacted Fuld and told him all about their research project. Fuld lends his expertise in blog entries on the website.

About Toronto’s Rogers Centre, Fuld wrote: “Usually jammed with autograph seekers by dugout. RF line during BP is a good spot. Also worth a try at getting a seat or a hotel room way up in CF. We players tend to like to throw baseballs all the way up there during BP (high degree of difficulty).”

“I’ve never been involved in anything like this. It’s cool,” Fuld said in a recent interview.

It’s already led Carben to the ideal place at Safeco. That would be section 142 on the third-base side, where the sun for an afternoon shines the brightest and there is a convenient concession stand where he can get a brat smothered in onions and peppers.

Oh yeah, quite a few foul balls land there, too.

Had Ferris Bueller been visiting Seattle, Carben believes the character “would definitely have ended up in that seat.”