Exemplo n.º 1
0
    private static void disposeAndRenewBoxer(ref DataPool worldData, int managerIndex)
    {
        float        currentManagerELO = worldData.Managers[managerIndex].ManagerELO;
        List <Boxer> boxers            = WorldBuilderProtocol.generateBoxerRecruits(ref worldData, worldData.Managers[managerIndex].TownIndex, currentManagerELO);

        int   bIndex = 0;
        float max    = 0.0f;

        for (int i = 0; i < boxers.Count; i++)
        {
            float boxerEval = EvaluationProtocol.evaluateBoxer(boxers[i], worldData.Managers[managerIndex].Preference);

            if (boxerEval > max)
            {
                max    = boxerEval;
                bIndex = i;
            }
        }

        worldData.Boxers.Add(boxers[bIndex]);

        worldData.Managers[managerIndex].recruitBoxer(worldData.Boxers.Count - 1);
        worldData.Managers[managerIndex].setRank(TournamentProtocol.Level.E);
        updateELO(ref worldData, managerIndex);
    }
Exemplo n.º 2
0
    void Start()
    {
        worldData = new DataPool();

        WorldBuilderProtocol.createWorld(ref worldData, 220, 220);

        Manager manager = new Manager("Capn", "AT", 0, 155.0f, BoxerClass.Type.Bullseye);

        worldData.Managers.Add(manager);

        List <Boxer> boxers = WorldBuilderProtocol.generateBoxerRecruits(ref worldData, manager.TownIndex, 0);

        int   bIndex = 0;
        float max    = 0.0f;

        for (int i = 0; i < boxers.Count; i++)
        {
            float boxerEval = EvaluationProtocol.evaluateBoxer(boxers [i], worldData.Managers [0].Preference);

            Debug.Log(boxerEval);
            boxers [i].logBoxerStats();

            if (boxerEval > max)
            {
                max    = boxerEval;
                bIndex = i;
            }
        }

        worldData.Boxers.Add(boxers [bIndex]);
        manager.recruitBoxer(worldData.Boxers.Count - 1);

        for (int i = 0; i < 5; i++)
        {
            Debug.Log("Year " + (i + 1));
            for (int j = 0; j < 48; j++)
            {
                ManagerProtocol.executeWeek(ref worldData, 0);
                worldData.Boxers [manager.BoxerIndex].logBoxerStats();
            }
        }
    }
Exemplo n.º 3
0
    private static void createManagerBasedOnTown(ref DataPool worldData, int townIndex, int regionIndex)
    {
        for (int j = 0; j < 2; j++)
        {
            List <BoxerClass.Type> typeList = BoxerClass.getTypeList();

            Manager manager = new Manager(
                worldData.generateFirstName(), worldData.generateLastName(), townIndex, generateRandomInt(145, 225), typeList[generateRandomInt(0, typeList.Count - 1)]);
            manager.Record.setELO(getEloFromRegion(worldData.Towns[townIndex].RegionLevel));
            manager.setupHomebase(ref worldData, true);
            worldData.Managers.Add(manager);

            List <Boxer> boxers = WorldBuilderProtocol.generateBoxerRecruits(ref worldData, manager.TownIndex, manager.Record.ELO);

            int   bIndex = 0;
            float max    = 0.0f;

            for (int i = 0; i < boxers.Count; i++)
            {
                float boxerEval = EvaluationProtocol.evaluateBoxer(boxers[i], worldData.Managers[worldData.Managers.Count - 1].Preference);

                if (boxerEval > max)
                {
                    max    = boxerEval;
                    bIndex = i;
                }
            }

            TournamentProtocol.Level boxerLevel = (TournamentProtocol.Level)generateRandomInt(0, (int)worldData.Towns[townIndex].RegionLevel);

            worldData.Boxers.Add(boxers[bIndex]);
            manager.recruitBoxer(worldData.Boxers.Count - 1);
            ManagerProtocol.updateELO(ref worldData, worldData.Managers.Count - 1);
            manager.upgradeFacilities(ref worldData);
            manager.setRank(boxerLevel);
            ageAndDevelop(ref worldData, worldData.Boxers.Count - 1, boxerLevel);

            worldData.Regions[regionIndex].addManager(worldData.Managers.Count - 1);
        }
    }
Exemplo n.º 4
0
    void Start()
    {
        worldData = new DataPool();

        WorldBuilderProtocol.createWorld(ref worldData, 220, 220);

        List <Boxer> boxers = WorldBuilderProtocol.generateBoxerRecruits(ref worldData, 0, 500);

        foreach (Boxer b in boxers)
        {
            b.logBoxerStats();
        }

        Debug.Log("-----------");
        Boxer boxer = boxers [Random.Range(0, boxers.Count)];

        Debug.Log("Introducing ");

        worldData.Boxers.Add(boxer);

        Exercise accuracyTraining  = new Exercise("Double End Bag", worldData.getExerciseDescription("Double End Bag"), true);
        Exercise enduranceTraining = new Exercise("Punch Glove", worldData.getExerciseDescription("Punch Glove"), true);
        Exercise speedTraining     = new Exercise("Sprints", worldData.getExerciseDescription("Sprints"), true);
        Exercise strengthTraining  = new Exercise("Punching Bag", worldData.getExerciseDescription("Punching Bag"), true);
        Exercise healthTraining    = new Exercise("Laps", worldData.getExerciseDescription("Laps"), true);

        List <int> accuracyTrainingFactors  = worldData.getExerciseProgressAcculumative(accuracyTraining.Name, 2);
        List <int> enduranceTrainingFactors = worldData.getExerciseProgressAcculumative(enduranceTraining.Name, 2);
        List <int> speedTrainingFactors     = worldData.getExerciseProgressAcculumative(speedTraining.Name, 2);
        List <int> strengthTrainingFactors  = worldData.getExerciseProgressAcculumative(strengthTraining.Name, 2);
        List <int> healthTrainingFactors    = worldData.getExerciseProgressAcculumative(healthTraining.Name, 3);

        accuracyTraining.setFactors(
            accuracyTrainingFactors [0], accuracyTrainingFactors [1], accuracyTrainingFactors [2],
            accuracyTrainingFactors [3], accuracyTrainingFactors [4], 20);
        enduranceTraining.setFactors(
            enduranceTrainingFactors [0], enduranceTrainingFactors [1], enduranceTrainingFactors [2],
            enduranceTrainingFactors [3], enduranceTrainingFactors [4], 20);
        speedTraining.setFactors(
            speedTrainingFactors [0], speedTrainingFactors [1], speedTrainingFactors [2],
            speedTrainingFactors [3], speedTrainingFactors [4], 20);
        strengthTraining.setFactors(
            strengthTrainingFactors [0], strengthTrainingFactors [1], strengthTrainingFactors [2],
            strengthTrainingFactors [3], strengthTrainingFactors [4], 20);
        healthTraining.setFactors(
            healthTrainingFactors [0], healthTrainingFactors [1], healthTrainingFactors [2],
            healthTrainingFactors [3], healthTrainingFactors [4], 20);

        accurracyTrainingFacility = new Facility();
        accurracyTrainingFacility.createExerciseFacility(2, accuracyTraining);

        enduranceTrainingFacility = new Facility();
        enduranceTrainingFacility.createExerciseFacility(2, enduranceTraining);

        healthTrainingFacility = new Facility();
        healthTrainingFacility.createExerciseFacility(3, healthTraining);

        speedTrainingFacility = new Facility();
        speedTrainingFacility.createExerciseFacility(2, speedTraining);

        strengthTrainingFacility = new Facility();
        strengthTrainingFacility.createExerciseFacility(2, strengthTraining);

        //trainStrength ();
        trainEverything();
    }