def generate_training_stats(years_in_majors, position): exp_term = 0 if years_in_majors == 0: pass else: exp_term = 16.0 / (1 + 60.0 / (years_in_majors * years_in_majors)) params1 = parameters() params2 = parameters() stat1 = redistribute(int(rand_skill_seed(params1[0], params1[1]))) stat2 = redistribute(int(rand_skill_seed(params2[0], params2[1]))) total = stat1 + stat2 hitting, fielding, pitching = 0, 0, 0 if Pos.is_infield(position): hitting = int(round(total * 1.0 / 2.0)) fielding = int(round(total * 1.0 / 2.0)) pitching = MIN_VALUE elif Pos.is_outfield(position): hitting = int(round(total * 3.0 / 5.0)) fielding = int(round(total * 2.0 / 5.0)) pitching = MIN_VALUE elif Pos.is_pitcher(position): index = int(total * 0.02999) params = distro_set[index] pitching = redistribute(int(rand_skill_seed(params[0], params[1]))) fielding = redistribute( int(rand_skill_seed(distro_set[3][0], distro_set[3][1]))) hitting = redistribute( int(rand_skill_seed(distro_set[1][0], distro_set[1][1]))) else: hitting = int(round(total * 4.0 / 5.0)) fielding = int(round(total * 1.0 / 5.0)) pitching = MIN_VALUE return redistribute(hitting), redistribute(fielding), redistribute( pitching)
def generate_all_caps(cls, height, weight, birthdate, current_date, years_in_majors, position): atts = cls.set_of_attrs(height, weight, birthdate, current_date, years_in_majors, position) #Overall composure = cls.redistribute( int(gauss(atts[cls.cal], choice(cls.STDEVS)))) judgment = cls.redistribute( int(gauss(atts[cls.sha], choice(cls.STDEVS)))) reaction = cls.redistribute( int(gauss(atts[cls.ref], choice(cls.STDEVS)))) memory = cls.redistribute(int(gauss(atts[cls.sha], choice(cls.STDEVS)))) run_speed = cls.redistribute( int(gauss(atts[cls.agi], choice(cls.STDEVS)))) acceleration = cls.redistribute( int(gauss(atts[cls.agi], choice(cls.STDEVS)))) slide = cls.redistribute(int(gauss(atts[cls.ref], choice(cls.STDEVS)))) awareness = cls.redistribute( int(gauss(atts[cls.sha], choice(cls.STDEVS)))) patience = cls.redistribute( int(gauss(atts[cls.cal], choice(cls.STDEVS)))) ocs = OC(composure, judgment, reaction, memory, run_speed, acceleration, slide, awareness, patience) #Hitting power = cls.redistribute(int(gauss(atts[cls.mus], choice(cls.STDEVS)))) contact = cls.redistribute( int(gauss(atts[cls.hit], choice(cls.STDEVS)))) bat_speed = cls.redistribute( int(gauss(atts[cls.mus], choice(cls.STDEVS)))) pitch_recognition = cls.redistribute( int(gauss(atts[cls.sha], choice(cls.STDEVS)))) bunt = cls.redistribute(int(gauss(atts[cls.hit], choice(cls.STDEVS)))) hcs = HC(power, contact, bat_speed, pitch_recognition, bunt) #Fielding field_range = cls.redistribute( int(gauss(atts[cls.agi], choice(cls.STDEVS)))) glove = cls.redistribute(int(gauss(atts[cls.fie], choice(cls.STDEVS)))) throw_range = cls.redistribute( int(gauss(atts[cls.mus], choice(cls.STDEVS)))) throw_speed = cls.redistribute( int(gauss(atts[cls.mus], choice(cls.STDEVS)))) accuracy = cls.redistribute( int(gauss(atts[cls.fie], choice(cls.STDEVS)))) jump = cls.redistribute(int(gauss(atts[cls.ref], choice(cls.STDEVS)))) fcs = FC(field_range, glove, throw_range, throw_speed, accuracy, jump) #Pitching pcs = 0 if Pos.is_pitcher(position): stamina = cls.redistribute( int(gauss(atts[cls.mus], choice(cls.STDEVS)))) arm_strength = cls.redistribute( int(gauss(atts[cls.mus], choice(cls.STDEVS)))) arm_speed = cls.redistribute( int(gauss(atts[cls.agi], choice(cls.STDEVS)))) pitch_accuracy = cls.redistribute( int(gauss(atts[cls.pit], choice(cls.STDEVS)))) spin = cls.redistribute( int(gauss(atts[cls.pit], choice(cls.STDEVS)))) focus = cls.redistribute( int(gauss(atts[cls.cal], choice(cls.STDEVS)))) pickoff = cls.redistribute( int(gauss(atts[cls.sta], choice(cls.STDEVS)))) pcs = PC(stamina, arm_strength, arm_speed, pitch_accuracy, spin, focus, pickoff) else: stamina = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) arm_strength = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) arm_speed = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) pitch_accuracy = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) spin = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) focus = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) pickoff = cls.redistribute(int(gauss(cls.MIN_VALUE, 2))) pcs = PC(stamina, arm_strength, arm_speed, pitch_accuracy, spin, focus, pickoff) return Capabilities(ocs, hcs, fcs, pcs)