Beispiel #1
0
 public void get_deal(deal current_deal)
 {
     int index_of_organization = find_index_of_organization(current_deal.organization_name);
     if (index_of_organization == -1)
     {
         throw new System.ArgumentException("bank know nothing about current organization");     
     }
     else
     {
         int risk_mod = 0;
         if (current_deal.sum_of_deal > Program.sum_of_cheap_deal)
         {
             risk_mod = 200 / all_organizations[index_of_organization].credit_of_trust;
         }
         int number_for_decision = Program.main_random.Next(100) + risk_mod;
         if (number_for_decision > all_organizations[index_of_organization].credit_of_trust)
         {
             int check_of_deal = perform_audit(current_deal);
             if (check_of_deal < 0)
             {
                 all_organizations[index_of_organization].change_credit_of_trust(-10);
             }
             else if (check_of_deal > 1)
             {
                 all_organizations[index_of_organization].change_credit_of_trust(5);
             }
         }
     }
 }
Beispiel #2
0
 public int do_audit(deal current_deal)
 {
     int try_to_find_out = Program.main_random.Next(100);
     if (try_to_find_out <= chance_of_mistake)
     {
         useless_audit_count += 1;
         return 0;
     }
     else if (current_deal.fair_deal)
     {
         useless_audit_count += 1;
         return 1;
     }
     else
     {
         useful_audit_count += 1;
         return -1;
     }
 }
Beispiel #3
0
 public void add_deal_to_list_of_protocols(deal current_deal)
 {
     list_of_deals.Add(new protocol(current_deal.organization_name, current_deal.sum_of_deal));
 }