Ejemplo n.º 1
0
    public List <string> SubmitResponse(Company company, Ship ship, int price)
    {
        ContractBidResponse response        = new ContractBidResponse(company, ship, price);
        List <string>       failureMessages = new List <string>();

        if (companies.Add(company))
        {
            foreach (ContractBidRequirement r in requirements)
            {
                if (r.evaluate(response) == false)
                {
                    failureMessages.Add(r.failureMessage);
                }
            }
            if (failureMessages.Count == 0)
            {
                responses.Add(response);
                return(failureMessages);
            }
            else
            {
                companies.Remove(company);
                return(failureMessages);
            }
        }
        else
        {
            failureMessages.Add("You've already submited a response to this Contract Bid");
            return(failureMessages);
        }
    }
Ejemplo n.º 2
0
 public static ContractBidCriteria LowMinimumCrewCriteria(int scoring)
 {
     return(new ContractBidCriteria(
                "Low Crew",
                "The submitted ship should be opperated with minimal crew",
                (List <ContractBidResponse> bidResponses) => {
         ContractBidResponse bestResponse = bidResponses[0];
         foreach (ContractBidResponse br in bidResponses)
         {
             if (br.ship.crew < bestResponse.ship.crew)
             {
                 bestResponse = br;
             }
         }
         bestResponse.score += scoring;
     }));
 }