By Sean Sylver, 98.5 The Sports Hub

BOSTON (CBS) – It was a custom-made setup for the perfect April Sunday afternoon. 70 degrees and sunny. The Bruins (once again) fighting for their playoff lives at the Garden. The Celtics looking to wrest home court advantage from the Bulls. The Sox, following back-to-back first inning homers from Mookie Betts and Hanley Ramirez, with a comfortable lead in Baltimore. And then, Matt Barnes went off script. Or did he?

READ MORE: Mother Accused Of Putting Baby In Trash Can Charged With Attempted Murder

In the eighth inning, the right-hander sent a pitch careening for the eardrum of Orioles third baseman Manny Machado. The ball wound up behind Machado’s head, hitting his bat, and Barnes was ejected from the game.

It was immediately clear that the pitch was retaliation for what Red Sox manager John Farrell called an “extremely late” slide by Machado that injured Boston second baseman Dustin Pedroia on Friday night. Machado, once promoted to the Majors at the age of 20, has seen his share of controversy over the years, but by now appears to be settling in as the All-Star heir apparent to Brooks Robinson and Cal Ripken, Jr. on the left side of the Baltimore infield. In the moment, the Orioles’ slugger showed concern and later texted the Red Sox second baseman to apologize. For his part, Pedroia immediately downplayed the idea of malicious intent in the aftermath of Friday’s game and further distanced himself from Barnes’ retaliatory effort both during and after Sunday’s contest.

With the Red Sox off Monday and preparing for a Tuesday night tilt against the Yankees at Fenway Park, Red Sox fans, media (myself included, apparently) and even national pundits are still frothing at the mouth over the weekend’s events. We know three things: Pedroia is hurt (severity still unknown), Barnes is suspended, and Baltimore is peeved. With one heave from Barnes, the Red Sox flipped from being the aggrieved party to the bad guys. No longer is the focus on, “did Machado take out Pedroia on purpose?” There’s a whole new series of questions to unravel.

Did Pedroia instruct his teammates not to buzz Machado?

Did Farrell go around his veteran leader and order Barnes to hit Machado?

Did Barnes act alone? Was he actually throwing at the guy’s head?

Why did the Red Sox wait two games (and nine plate appearances) to retaliate?

READ MORE: Thieves Target Toyota Prius Catalytic Converters In Cambridge

Finally: Will the Orioles respond when the two teams play again next week?

And that’s why we’re here: The Code. The unwritten rules of the game by which baseball players, not the umpires, police various scenarios with regard to showboating and the taking of liberties, some of which (as in this case) have resulted in injury. Jason Turbow, author of The Baseball Codes, says the unwritten rules are “a highly effective technique by which players avoid escalating trouble, not something they utilize to find it. It’s a release valve for animosity that builds up over the course of a game, series or season.”

In its simplest form, a locker room agrees on the appropriate response to an affront and a nominee (usually a pitcher) dishes it out. The other team accepts it and everyone moves on. Most of the time. Some teams will take a brushback pitch; others harbor a grudge. Sometimes that brushback pitch or retaliatory takeout slide gets another player hurt. Then, you open the proverbial can of worms.

Usually, coaches and teammates act in concert: our side is right, theirs is wrong. That’s part of the beauty and frustration of The Code. As Will Leitch once wrote, the unwritten rules “can be fudged and contorted into whatever shape you want them to be.” That’s why Sheriff Brian McCann’s Atlanta Braves once spent an entire summer chewing out opposing players for having the audacity to hit home runs. That’s why the pattern of call-and-response can be disrupted by a bench-clearing fracas.

What if the team doesn’t agree on the appropriate response? What if the response goes haywire?

Unfortunately, that seems to be the situation for the Red Sox. In dishing out justice, there appear to have been a number of additional Code violations. First, the timing of the retaliation. A brushback pitch is expected in this circumstance, but almost always the following game or even during the next at-bat. Then, there was the act itself. Whether or not you agree that plunking someone in the rear end helps to diffuse a situation, throwing at their head certainly does not.

Dustin Pedroia took issue with both violations. By his own team.

We don’t know if Machado meant to take out Pedroia, or if Barnes meant to rifle the ball past Machado’s helmet (he did express remorse over the location of the pitch). We don’t know if Farrell or some other coach or player turned to Barnes to carry out an act of revenge, whether or not Pedroia vetoed it, or why the Red Sox waited two days to deliver on their payback. But it’s certain there will be lingering bad blood between two teams set to compete 12 more times over the course of the regular season.

In his book, Turbow quotes former Major League hurler and pitching coach Tom House: “The only way you can learn is by basically (messing) up.”

It may be that Matt Barnes did indeed mess up. It may be there are different interpretations of The Code in the Red Sox clubhouse. We’ll probably never know the intent. But we saw the act. Luckily, nobody got hurt on Sunday. Let’s hope Pedroia’s knee is OK, and we can all move on.

MORE NEWS: Mitt Romney Taken To Hospital For 'A Lot Of Stitches' After Fall In Boston

Sean Sylver is a contributor to CBSBostonSports.com who can be heard on 98.5 The Sports Hub. You can follow him on Twitter @sylverfox25.