All - I'm finishing up some moderate engine fixes and improvements and came across one I'd like some help on.

As you know, there are double-switches in the engine at the start of an inning. I'm trying to introduce double-switches in the middle of an inning when a reliever enters.

Here's the most common real-life scenario:
7th inning, Team A up by 3.
Team B gets a couple runners on.
Team A opts to bring in relief pitcher.
Pitcher spot is due up 2nd next inning.
Manager makes double-switch, with new left-fielder entering in P slot, P entering in LF slot.
Now, reliever can stay in beyond this inning half and won't be lifted for a PH.

Trying to do that in the engine is proving difficult because defensive replacements and/or player rest moves are done at the beginning of the inning half. So, if a reliever needs to be brought in, the manager can't find anyone on the def rep or player rest hierarchy to enter because they've already entered.

I've been thing of a couple ideas:
1) Consider bringing in a player rest player as part of double-switch 1 inning earlier than settings specified.
2) Consider holding off on 1 player rest / def rep if pitcher slot is due up next inning in the event of a pitching change. This gets a bit tricky because manage must decide which position to hold back (which factors in current spot in batting order) and must evaluate if pitcher will go more than one inning.

Let me know your thoughts and ideas. If you have any existing boxscores where you think a double-switch should have occurred while team is in field, please post link and mention inning half and team.

this may not be a perfect example - but this at least shows a good scenario:

BOXSCORE

The situation - TEAM A is up by 2 in the bottom of the 8th - after a 2 run HR - the starter is pulled and TEAM A's closer is brought in - he records 2 outs with 6 pitches and the inning ends. Pitchers spot is 4th up - and after a runner gets on, TEAM A's CLOSER is pinch hit for - PH'er gets out. In the bottom of the 9th, TEAM A's Set Up A is brought in and gives up the winning run.

Like I said - maybe not a perfect example - I'd probably have just a many questions as to why the Set up A wasn't brought in first in the 8th, saving the closer for the 9th or later - but that's for a different time and place :)

If a double switch had occured - TEAM A's closer could have been brought in, and after no runs were scored in the top of the 9th - could have remained in the game longer - instead of being replaced for a pinch hitter after just 6 pitches.

I would imagine this sort of thing is a nightmare to program. Writing it out in words is hard enough.

-Checking the TPC for the pitcher you're bringing in is a must. If it's 20 or higher, and he's one of the first 3 hitters, then you probably want to initiate a double-switch, if the game score is within a certain number of runs.

-What exactly is the job of the hitter you're bringing in? It's hitting, right? So then you would use the PH hierarchies? Defensive replacement isn't right... I don't want my light-hitting defensive shortstop hitting 3rd in the inning any more than I want my pitcher hitting. But the guy also has to be able to field the position you're putting him in. I might not want my D/D bench LF going in to play LF for 2 batters either.

Posted by GregNLFan on 12/8/2012 4:04:00 PM (view original):I bet it's higher than 10, or at leas near 10, for many NL teams. They're built with that option in mind.

Indeed. That said, in real life you don't have completely terrible (200K) players on your bench. You have guys that are marginally worse than the starters for most players... the difference between a mediocre starter and a backup is not nearly as great as it usually is in the SIM.

Also consider platoon options and other forms of rotational play that exist in real life.