private string DetermineMoleculeTake(LifeSample sample, GameState state)
 {
     if (sample == null)
     {
         Log("No sample deemed creatable with our molecules (we have non viable products in hand)"); return(null);
     }
     //TODO: We should prefer taking resources that are scarse
     if (sample.CostA > ProjectedA && state.AvailableA > 0)
     {
         return("A");
     }
     if (sample.CostB > ProjectedB && state.AvailableB > 0)
     {
         return("B");
     }
     if (sample.CostC > ProjectedC && state.AvailableC > 0)
     {
         return("C");
     }
     if (sample.CostD > ProjectedD && state.AvailableD > 0)
     {
         return("D");
     }
     if (sample.CostE > ProjectedE && state.AvailableE > 0)
     {
         return("E");
     }
     Log($"For sample {sample.SampleID} we could not determine a molecule");
     return(null);
 }
        private bool ResourceForSampleComplete(LifeSample sample)
        {
            bool sampleResourcesComplete = sample.CostA <= this.ProjectedA &&
                                           sample.CostB <= this.ProjectedB &&
                                           sample.CostC <= this.ProjectedC &&
                                           sample.CostD <= this.ProjectedD &&
                                           sample.CostE <= this.ProjectedE;

            return(sampleResourcesComplete);
        }
        private bool SampleCanBeMadeWithWorldResources(LifeSample sample, GameState state)
        {
            bool canBeCreated = sample.CostA <= state.AvailableA + ExpertiseA &&
                                sample.CostB <= state.AvailableB + ExpertiseB &&
                                sample.CostC <= state.AvailableC + ExpertiseC &&
                                sample.CostD <= state.AvailableD + ExpertiseD &&
                                sample.CostE <= state.AvailableE + ExpertiseE; //Should we mind the carried stuff from the other bot

            return(canBeCreated);
        }
Example #4
0
        private LifeSample ReadSample(string sampleString)
        {
            var        inputs = sampleString.Split(' ');
            LifeSample s      = new LifeSample()
            {
                SampleID      = int.Parse(inputs[0]),
                CarriedBy     = int.Parse(inputs[1]),
                Rank          = int.Parse(inputs[2]),
                ExpertiseGain = inputs[3],
                Health        = int.Parse(inputs[4]),
                CostA         = int.Parse(inputs[5]),
                CostB         = int.Parse(inputs[6]),
                CostC         = int.Parse(inputs[7]),
                CostD         = int.Parse(inputs[8]),
                CostE         = int.Parse(inputs[9])
            };

            return(s);
        }
 private int RankSample(LifeSample sample)
 {
     return(sample.Health * (sample.Rank + 1));
 }