コード例 #1
0
    public static void Main()
    {
        Console.WriteLine("Basic Population Calculator");
        Console.WriteLine(" ");
        patch mainPatch = new patch();

        mainPatch.computePopulations();
        Console.WriteLine("Patch Data: Sunlight, Hydrogen Sulfide, Total Chloroplasts, Total Chemoplasts");

        Console.WriteLine(mainPatch.sunlight.ToString().PadLeft(15)
                          + ", " + mainPatch.hydrogen.ToString().PadLeft(15)
                          + ", " + mainPatch.totalChloroplasts.ToString().PadLeft(15)
                          + ", " + mainPatch.totalChemoplasts.ToString().PadLeft(15));

        Console.WriteLine(" ");
        Console.WriteLine("Species Data");
        Console.WriteLine("Population, Chloroplasts, Chemoplasts, Flagella, Pilus, Total Organelles, SpeedScore, Energy");

        foreach (species spec in mainPatch.listOfSpecies)
        {
            Console.WriteLine(spec.population.ToString().PadLeft(10)
                              + ", " + spec.chloroplasts.ToString().PadLeft(10)
                              + ", " + spec.chemoplasts.ToString().PadLeft(10)
                              + ", " + spec.flagella.ToString().PadLeft(10)
                              + ", " + spec.pilus.ToString().PadLeft(5)
                              + ", " + (spec.numberOfOrganelles - 1).ToString().PadLeft(12)
                              + ", " + spec.speedScore.ToString().PadLeft(14)
                              + ", " + spec.energy.ToString().PadLeft(10));
        }
    }
コード例 #2
0
    public static void Main()
    {
        //for each organelle which resource do they gather?
        Dictionary <string, string> resourceGathered = new Dictionary <string, string>()
        {
            { "thylakoid", "sunlight" },
            { "chloroplast", "sunlight" },
            { "rusticyanin", "iron" },
            { "chemoplast", "hyrdrogen" },
            { "flagella", "none" },
            { "pilus", "none" },
        };

        //how effective is that organelle at gathering resources
        Dictionary <string, float> gatheringEffectiveness = new Dictionary <string, float>()
        {
            { "thylakoid", 1.0f },
            { "chloroplast", 1.5f },
            { "rusticyanin", 1.0f },
            { "chemoplast", 1.0f }
        };

        //for this patch what resources are available?
        Dictionary <string, float> availablePrimaryResources = new Dictionary <string, float>()
        {
            { "sunlight", 10000.0f },
            { "iron", 10000.0f },
            { "hydrogen", 10000.0f },
        };

        Console.WriteLine("Population Calculator using lists");
        Console.WriteLine(" ");

        patch mainPatch = new patch(availablePrimaryResources, resourceGathered, gatheringEffectiveness);

        mainPatch.computePopulations(resourceGathered, gatheringEffectiveness);

        Console.WriteLine(" ");
        Console.WriteLine("Population, Energy Gathered, Organelles");
        foreach (species spec in mainPatch.listOfSpecies)
        {
            string organellesString = "     ";
            foreach (string organelle in spec.organelles)
            {
                organellesString += organelle;
                organellesString += ", ";
            }
            Console.WriteLine(spec.population.ToString().PadLeft(10)
                              + ", " + spec.energy.ToString().PadLeft(10)
                              + ", " + organellesString.PadLeft(10));
        }
    }
コード例 #3
0
    void Start()
    {
        patchList = new List<patch>();

        udpObj = GameObject.Find( "UDP" );
        patchObj = GameObject.Find("SandPatch Terrain");
        playerObj = GameObject.Find("OVRPlayerController");
        leftFootObj = GameObject.Find("LeftToeBase");
        patchLocations = udpObj.GetComponent<UDPComm>().getPatchArray();
        patchTypes = udpObj.GetComponent<UDPComm>().getPatchTypes();

        // Creates a list of patch objects
        for (int pNum = 0; pNum < patchLocations.Length; pNum++)
        {
            patch newPatch = new patch(patchObj,patchTypes[pNum],patchLocations[pNum]);
            patchList.Add( newPatch);
        }
    }
コード例 #4
0
 var(patch, disabled) = updater(application, registration.IsDisabled);