Ejemplo n.º 1
0
 def test_eating_state_well(self):
     turn_state = TurnState()
     turn_state.eating_state = 3
     self.assertEqual(turn_state.eating_state, 3)
     self.assertFalse(turn_state.eating_poorly())
     self.assertFalse(turn_state.eating_moderately())
     self.assertTrue(turn_state.eating_well())
Ejemplo n.º 2
0
 def test_eating_state_invalid(self):
     turn_state = TurnState()
     turn_state.eating_state = 4
     self.assertEqual(turn_state.eating_state, 0)
     self.assertFalse(turn_state.eating_poorly())
     self.assertFalse(turn_state.eating_moderately())
     self.assertFalse(turn_state.eating_well())
Ejemplo n.º 3
0
 def test_construction(self):
     turn_state = TurnState()
     self.assertFalse(turn_state.illness)
     self.assertFalse(turn_state.injured)
     self.assertEqual(turn_state.eating_state, 0)
Ejemplo n.º 4
0
 def test_set_blizzard(self):
     turn_state = TurnState()
     turn_state.blizzard = True
     self.assertTrue(turn_state.blizzard)
     turn_state.blizzard = False
     self.assertFalse(turn_state.blizzard)
Ejemplo n.º 5
0
 def test_set_illness(self):
     turn_state = TurnState()
     turn_state.injured = True
     self.assertTrue(turn_state.injured)
     turn_state.injured = False
     self.assertFalse(turn_state.injured)
Ejemplo n.º 6
0
from oregon.events.turn import turn_event_selection
from oregon.events.instructions import print_instructions
from oregon.events.purchases import initial_purchases
from oregon.events.completed_trip import completed_trip

if __name__ == "__main__":

    if ask_yes_no("DO YOU NEED INSTRUCTIONS  (YES/NO)"):
        print_instructions()

    # initial purchases generate an inventory
    inventory = initial_purchases()

    calendar = Calendar()
    tracker = TripTracker()
    turn = TurnState()

    while not calendar.is_final_turn() and not tracker.reached_oregon():
        calendar.print_date()
        inventory.zeroize_negative_values()

        # Resolve health issues from the previous turn
        if turn.illness or turn.injured:
            inventory.spend(20)
            if inventory.money < 0:
                print("YOU CAN'T AFFORD A DOCTOR")
                if turn.illness:
                    print("YOU DIED OF PNEUMONIA")
                elif turn.injured:
                    print("YOU DIED OF INJURIES")
                dying()