def test_random_advance(self):
     tracker = TripTracker()
     oxen = InventoryItem()
     oxen.value = 220
     tracker.random_advance(oxen)
     self.assertGreaterEqual(tracker.mileage, 200)
     self.assertLess(tracker.mileage, 210)
 def test_reached_oregon(self):
     tracker = TripTracker()
     tracker.add_mileage(1800)
     oxen = InventoryItem()
     oxen.value = 220
     tracker.random_advance(oxen)  # maximum added advance of 210
     self.assertFalse(tracker.reached_oregon())
     last_turn_mileage = tracker.mileage - 1800
     last_turn_mileage += tracker.total_trip_distance - tracker.mileage
     tracker.add_mileage(tracker.total_trip_distance - tracker.mileage)
     self.assertTrue(tracker.reached_oregon())
Exemple #3
0
        inventory.print_inventory()
        turn_response = ask_numeric("DO YOU WANT TO (1) STOP AT THE NEXT FORT, (2) HUNT, \nOR (3) CONTINUE", 1, 3)
        if turn_response == 1:
            next_fort(inventory, tracker)
        elif turn_response == 2:
            hunt(inventory, tracker)

        # Eating
        if inventory.food.value < 13:
            print("YOU RAN OUT OF FOOD AND STARVED TO DEATH")
            dying()
        eating(inventory, turn)

        # Advance mileage now, events may subtract from overall
        # progress for each turn
        tracker.random_advance(inventory.oxen)

        # Rider attack
        if do_riders_attack(tracker):
            riders_attack(inventory, tracker, turn)

        # Random per turn events
        turn_event_selection(inventory, tracker, turn)

        # Mountain events
        mountains(inventory, tracker, turn)

        # Move to next turn
        calendar.advance_date()

    # Turns have been exhausted or Oregon has been reached