Exemple #1
0
        public void BestSingleTripLimitedByIsk()
        {
            /* the best route in which money is the limiting factor is:
             * 83 Kernite from Line 2 station 1 (sec 0.8) to Line 3B station 1 (sec 0.7)
             */
            parameters = new Parameters(1000.0f, 10000000.0f, null, TripType.SingleTrip);
            finder     = new TradeFinder(map, market, parameters);
            finder.SortByProfitPerWarp(true);
            Assert.Greater(finder.SingleTrips.Count, 0);
            SingleTrip best = finder.SingleTrips[0];

            Assert.AreSame(map.GetStation(21), best.Source);
            Assert.AreSame(map.GetStation(41), best.Destination);
            TransactionList tl = best.GetPurchases();

            Assert.AreSame(database.GetItemType("Kernite"), tl[0].Purchases[0].Type);
            Assert.AreEqual(1, best.Jumps(true));
            Assert.AreEqual(3, best.Warps(true));
            Assert.AreEqual(0.7f, best.Security);
            Assert.AreEqual(3, best.Quantity);  // can only affort 3 Kernite
            float buyFor  = 3.0f * 305.52f;
            float sellFor = 3.0f * 352.9f;

            Assert.AreEqual(buyFor, best.Cost);
            Assert.AreEqual(sellFor - buyFor - (sellFor * 0.01f), best.Profit);
            Assert.AreEqual((sellFor - buyFor - (sellFor * 0.01f)) / 3.0f, best.ProfitPerWarp(true));
        }
Exemple #2
0
        public void BestSingleTripLimitedByAvailability()
        {
            /* the best route in which money and cargo space are no object is:
             * 83 Kernite from Line 2 station 1 (sec 0.8) to Line 3B station 1 (sec 0.7)
             */
            parameters = new Parameters(10000000.0f, 10000000.0f, null, TripType.SingleTrip);
            finder     = new TradeFinder(map, market, parameters);
            finder.SortByProfitPerWarp(true);
            Assert.Greater(finder.SingleTrips.Count, 0);
            SingleTrip best = finder.SingleTrips[0];

            Assert.AreSame(map.GetStation(12), best.Source);
            Assert.AreSame(map.GetStation(12), best.Destination);
            TransactionList tl = best.GetPurchases();

            Assert.AreSame(database.GetItemType("Navitas"), tl[0].Purchases[0].Type);
            Assert.AreEqual(0, best.Jumps(true));
            Assert.AreEqual(0, best.Warps(true));
            Assert.AreEqual(SecurityStatus.Level.HighSec, best.Security);
            Assert.AreEqual(7487, best.Quantity);  // 7487 Kernite wanted at 32
            float buyFor  = 7487.0f * 344.45f;
            float sellFor = 7487.0f * 352.62f;

            Assert.AreEqual(buyFor, best.Cost);
            Assert.AreEqual(sellFor - buyFor, best.Profit);
            Assert.AreEqual((sellFor - buyFor) / 1.0f, best.ProfitPerWarp(true));
        }
Exemple #3
0
        public void BestSingleTripLimitedByCargo()
        {
            /* the best route where money is no object but cargo space is, is:
             * 83 Kernite from Line 2 station 1 (sec 0.8) to Line 3B station 1 (sec 0.7)
             */
            parameters = new Parameters(10000000.0f, 100.0f, null, TripType.SingleTrip);
            finder     = new TradeFinder(map, market, parameters);
            finder.SortByProfitPerWarp(true);
            Assert.Greater(finder.SingleTrips.Count, 0);
            SingleTrip best = finder.SingleTrips[0];

            Assert.AreSame(map.GetStation(31), best.Source);
            Assert.AreSame(map.GetStation(32), best.Destination);
            TransactionList tl = best.GetPurchases();

            Assert.AreSame(database.GetItemType("Kernite"), tl[0].Purchases[0].Type);
            Assert.AreEqual(0, best.Jumps(true));
            Assert.AreEqual(1, best.Warps(true));
            Assert.AreEqual(SecurityStatus.Level.HighSec, best.Security);
            Assert.AreEqual(83, best.Quantity);  // Kernite is 1.2 vol, so we can only fit 83 in our hold
            float buyFor  = 83.0f * 344.45f;
            float sellFor = 83.0f * 352.62f;

            Assert.AreEqual(buyFor, best.Cost);
            Assert.AreEqual(sellFor - buyFor - (sellFor * 0.01f), best.Profit);
            Assert.AreEqual((sellFor - buyFor - (sellFor * 0.01f)) / 1.0f, best.ProfitPerWarp(true));
        }