private static void runInfieldProgression(Fielder fielder) { frmBaseballSimulator.updateLblTest("infield"); advanceRunners(); ProportionValue <string> checkIT = checkIfFielded(1); if (checkIT.InsertValue == "hasIt") { frmBaseballSimulator.addToLblTest(" has it"); infieldChallengeRunner(fielder); } else if (checkIT.InsertValue == "notYet") { frmBaseballSimulator.addToLblTest(" not yet"); if (onBaseList.Count > 0) { setRunnersNewBase(); } Lists.playDescription = ""; Lists.playDescription = "Error!"; frmBaseballSimulator.addPlayDescription(); frmBaseballSimulator.startAdvanceHalfTimer(1, true, 100); } }
private static void chooseInfielder(ProportionValue <string> fielderProp) { if (fielderProp.Value == "first baseman ") { inFielder = firstBaseman; } else if (fielderProp.Value == "second baseman ") { inFielder = secondBaseman; } else if (fielderProp.Value == "third baseman ") { inFielder = thirdBaseman; } else if (fielderProp.Value == "catcher ") { inFielder = catcher; } else if (fielderProp.Value == "short stop ") { inFielder = shortStop; } else if (fielderProp.Value == "pitcher ") { inFielder = pitcher; } }
private static void ChooseOutFielder(ProportionValue <string> fielderProp) { if (fielderProp.Value == "center fielder ") { outFielder = centerFielder; } else if (fielderProp.Value == "left fielder ") { outFielder = leftFielder; } else if (fielderProp.Value == "right fielder ") { outFielder = rightFielder; } }
private static void runOutfieldProgression(Fielder fielder) { frmBaseballSimulator.updateLblTest("outfield"); ProportionValue <string> checkIT = checkIfFielded(hasItOdds); //determine if players are running foreach (Player element in onBaseList) { if (element.BaseLocation < 0) { playersRunning = true; break; } else { playersRunning = false; } } //this is for a home run if (numToAdvance == 4) { frmBaseballSimulator.addToLblTest(" home run"); frmBaseballSimulator.startAdvanceHalfTimer(numToAdvance, false, 100); } else if (playersRunning) { frmBaseballSimulator.addToLblTest(" Players Running"); //fielder doesn't have it if (checkIT.InsertValue == "notYet") { frmBaseballSimulator.addToLblTest(" not yet"); numToAdvance += 1; if (onBaseList.Count > 0) { setRunnersNewBase(); } hasItOdds = .5; playersRunning = false; runOutfieldProgression(fielder); } //player fields it if (checkIT.InsertValue == "hasIt") { frmBaseballSimulator.addToLblTest(" has it"); outFieldChallengeRunner(fielder); } } else if (!playersRunning) { frmBaseballSimulator.addToLblTest(" Players Running"); if (checkIT.InsertValue == "notYet") { frmBaseballSimulator.addToLblTest(" not yet"); hasItOdds += .1; advanceRunners(); runOutfieldProgression(fielder); } else if (checkIT.InsertValue == "hasIt") { frmBaseballSimulator.addToLblTest(" has it"); addHitPlayDescription(); frmBaseballSimulator.startAdvanceHalfTimer(numToAdvance, false, 100); } } }
private static void outFieldChallengeRunner(Fielder fielder) { frmBaseballSimulator.addToLblTest(" outfieldchallengerunner"); Base priority = determineBasePriority(); ProportionValue <string> outOrSafe = outSafe.ChooseByRandom(); if (outOrSafe.InsertValue == "out") { frmBaseballSimulator.addToLblTest(" out"); if (priority.baseNumber == 1) { frmBaseballSimulator.addToLblTest(" priority.baseNumber == 1"); addHitPlayDescription(); Lists.playDescription += "Out at " + priority.name + "! (" + fielder.Position + ")\n\n"; removePlayerAfterOut(currentBatter, false, true); } else { frmBaseballSimulator.addToLblTest(" else"); addHitPlayDescription(); for (int i = 0; i < onBaseList.Count; i++) { if (-onBaseList.ElementAt(i).BaseLocation == priority.baseNumber) { Lists.playDescription += "Out! (" + fielder.Position + " to " + priority.name + ")\n\n"; removePlayerAfterOut(onBaseList.ElementAt(i), false, true); playerRemoved = true; } } if (playerRemoved == false) { priority.baseNumber = onBaseList.ElementAt(0).BaseLocation; Lists.playDescription += "Out! (" + fielder.Position + " to " + priority.name + ")\n\n"; removePlayerAfterOut(onBaseList.ElementAt(0), false, true); } playerRemoved = false; } } else if (outOrSafe.InsertValue == "safe") { frmBaseballSimulator.addToLblTest(" safe"); if (onBaseList.Count > 0) { setRunnersNewBase(); } numToAdvance += 1; playersRunning = false; Lists.playDescription = ""; addHitPlayDescription(); Lists.playDescription = "Safe! (" + fielder.Position + ")"; frmBaseballSimulator.startAdvanceHalfTimer(numToAdvance, false, 100); } }
private static void infieldChallengeRunner(Fielder fielder) { frmBaseballSimulator.addToLblTest(" infield challenge"); Base priority = determineBasePriority(); if (priority.baseNumber != fielder.BaseLocation) { frmBaseballSimulator.addToLblTest(" priority.baseNumber != fielder.BaseLocation"); if (priority.baseNumber == 1) { frmBaseballSimulator.addToLblTest(" priority.baseNumber == 1"); Lists.playDescription += "Out! (" + fielder.Position + " to " + priority.name + ")\n\n"; removePlayerAfterOut(currentBatter, true, false); } else { frmBaseballSimulator.addToLblTest(" else"); for (int i = 0; i < onBaseList.Count; i++) { if (-onBaseList.ElementAt(i).BaseLocation == priority.baseNumber) { Lists.playDescription += "Out! (" + fielder.Position + " to " + priority.name + ")\n\n"; removePlayerAfterOut(onBaseList.ElementAt(i), true, false); playerRemoved = true; } } if (playerRemoved == false) { priority.baseNumber = onBaseList.ElementAt(0).BaseLocation; Lists.playDescription += "Out! (" + fielder.Position + " to " + priority.name + ")\n\n"; removePlayerAfterOut(onBaseList.ElementAt(0), false, true); } playerRemoved = false; } } else { frmBaseballSimulator.addToLblTest(" else"); if (priority.baseNumber == 1) { frmBaseballSimulator.addToLblTest(" priority.baseNumber == 1"); Lists.playDescription += "Out at 1st!\n\n"; removePlayerAfterOut(currentBatter, true, false); } else { frmBaseballSimulator.addToLblTest(" else"); for (int i = 0; i < onBaseList.Count; i++) { if (-onBaseList.ElementAt(i).BaseLocation == priority.baseNumber) { Lists.playDescription += "Out at " + priority.name + "!\n\n"; removePlayerAfterOut(onBaseList.ElementAt(i), true, false); playerRemoved = true; } } if (playerRemoved == false) { priority.baseNumber = onBaseList.ElementAt(0).BaseLocation; Lists.playDescription += "Out! (" + fielder.Position + " to " + priority.name + ")\n\n"; removePlayerAfterOut(onBaseList.ElementAt(0), true, false); } playerRemoved = false; } } }