예제 #1
0
def arrive_depart(j: int, gs: GameState) -> None:
    seg = gs.segment
    ta = announce_arrival(seg)
    td = seg.tdepart
    if ta > (td - 2): td = ta + 4  # ensure depart after arrival

    if j == 24: return  # end of game...

    if seg.tf == TimeFrame.Night:
        print("Asleep in your compartment, you barely notice that the")
        print(f"departure was right on time at {fmt_time(td)}.")
        cls(2)
        pause()
        return

    if j == 23: turkish_police(gs)

    print(f'Departure is at {fmt_time(td)}.')
    print()
    if said_y('Would you like to get off the train and stretch your legs? '):
        print('Ok, but be sure not to miss the train.')
        time.sleep(1.0)
    else:
        print('Ok, you stay in your compartment.')
    print()
    print('All aboard....')
    time.sleep(1.0)
    print('The train is leaving.')
예제 #2
0
def derail(gs: GameState) -> None:
    if gs.derailed or (random.random() > 0.02):
        return  # 2% chance of derailment
    gs.derailed = True
    gs.hazard_delay += 1
    cls(4)
    print(centered(" * * SCREEECH! * *"))
    time.sleep(1.0)
    cls(2)
    print("You hear a loud screeching noise as the train comes to a")
    print("crashing stop.  The engine, tender, and first coach are")
    print("leaning at a crazy angle.  People are screaming.")
    time.sleep(1.0)
    print()
    print("While not as bad as the derailment at Vitry-le-Francois in")
    print("November 1911, there is no question that the front of the")
    print("train has left the track.")
    time.sleep(1.0)
    print()
    print("You are stranded for exactly one day while the track is")
    print("repaired and a new locomotive obtained.")
    print()
    print(
        f"The train is now exactly {plural(gs.hazard_delay,'day')} behind schedule."
    )
    print()
    pause()
예제 #3
0
def turkish_police(gs: GameState) -> None:
    ci = CheckedInput('Who do you identify? ', int)
    ci.choices([1, 2, 3, 4, 5],
               "Please enter the number for your choice ([1-5])")

    cls(4)
    print("The Turkish police have boarded the train.  They have been")
    print("asked to assist you, but for them to do so you will have to")
    print("identify the killer (the dealer in machine guns) and the defector")
    print("(the Scotch drinker) to them.  The arms dealers are lined")
    print("up as follows:")
    print()
    print("  (1) Austrian, (2) Turk, (3) Pole, (4) Greek, (5) Rumanian.")
    print()
    print("They ask who the defector is. ", end='')
    gs.my_defector = ci.run()
    time.sleep(1.0)
    print()
    print("They ask who the killer is. ", end='')
    ci.ensure(lambda c: c != gs.my_defector,
              "You already chose him for the defector!")
    gs.my_killer = ci.run()
    time.sleep(1.5)
    print()
    print("The police take into custody the man you identified as the")
    print("killer and provide a guard to ride on the train with the")
    print("defector.  You return to your compartment, praying that")
    print("you made the correct deductions and identified the right men.")
    print()
    pause()
    print()
예제 #4
0
def snow(gs: GameState) -> None:
    x = random.random()
    if x > 0.65: return  # 65% chance of snow
    cls(4)
    print("It is snowing heavily ", end='')
    if x > 0.01:
        print("but the tracks have been cleared and the train")
        print("will not be delayed.")
    else:
        print("and the train is forced to slow down.")
        print()
        print("Oh no!  The train is coming to a stop.  Let's hope this is")
        print("not a repeat of the trip of January 29, 1929 when the Orient")
        print("Express was stuck in snowdrifts for five days.")
        print()
        time.sleep(1.0)
        print("But it looks like it is!")
        time.sleep(1.0)
        print()
        gs.hazard_delay += 2
        print(
            "You are stranded for two days until a snowplow clears the track.")
        print(
            f"The train is now exactly {gs.hazard_delay} days behind schedule."
        )
    cls(2)
    pause()
예제 #5
0
def serve_lunch() -> None:
    cls(4)
    print(
        "An enormous buffet luncheon has been laid out in the restaurant car.")
    pause('Press <return> when you have finished eating.')
    cls(4)
    print(centered(" * * B-U-R-P ! * * "))
    time.sleep(1.0)
예제 #6
0
def engine_malfunction(gs: GameState, reduction: float) -> None:
    cls(10)
    timed_banner(3, '* * ENGINE MALFUNCTION!!! * *', 0.5)
    cls(5)
    print(
        f'You will have to operate your engines at a {int(reduction*100)}% reduction'
    )
    print(f'in speed until you reach {trip[gs.seg+1].location}.')
    print()
    pause()
예제 #7
0
def run_game():
    random.seed()
    cls()
    print(title)
    pause()
    print(scenario)
    pause()
    state = GameState()
    while state.seg < (len(trip) - 1):
        one_segment(state)
    endgame(state)
예제 #8
0
def serve_breakfast() -> None:
    cls(4)
    print("Breakfast is now being served in the restaurant car.")
    pause("Press <return> when you're ready to have breakfast.")
    cls(8)
    print(centered("BREAKFAST MENU"))
    cls(3)
    for i in range(4):
        print(centered(breakfasts[(3 * i) + random.randrange(0, 3)]))
        cls(3)
    print(centered(breakfasts[12]))
    cls(4)
    pause('Press <return> when you have finished eating.')
예제 #9
0
def run_convo(gs: GameState) -> None:
    if gs.segment.nconv == 0: return
    cls(2)
    print("Later, in your compartment: ")
    for i in range(gs.segment.nconv):
        cls(2)
        convo = gs.conversations.pop()
        ring_doorbell()
        person = convo.who or people[random.randrange(2, 25)]
        print(f'Standing there is {person}, who tells you:')
        print(convo.msg)
        cls(2)
        pause('Press <return> when finished with the conversation...')
예제 #10
0
def serve_dinner() -> None:
    cls(4)
    print("Dinner is now being served in the restaurant car.")
    pause("Press <return> when you're ready to have dinner.")
    cls(8)
    print(centered("DINNER MENU"))
    cls(2)
    for i in range(7):
        print(centered(dinners[(3 * i) + random.randrange(0, 3)]))
        print()
    for i in [22, 23, 24]:
        print(centered(dinners[i]))
        print()
    pause('Press <return> when you have finished eating.')
예제 #11
0
def determine_outcome(gs: GameState) -> None:
    d, k = defector(), killer()

    # Did you get everything right?
    if gs.my_defector == d and gs.my_killer == k:
        gs.perfection = True
        return

    # The defector is killed by bandits if you didn't either
    # protect him or arrest him
    if d not in [gs.my_defector, gs.my_killer]:
        print()
        print("You are suddenly awakened by what sounded like a gunshot.")
        print("You rush to the defector's compartment, but he is okay.")
        print("However, one of the other arms dealers has been shot.")
        time.sleep(2.0)
        print()
        print("You review the details of the case in your mind and realize")
        print("that you came to the wrong conclusion and due to your mistake")
        print("a man lies dead at the hand of bandits.  You return to your")
        print("compartment and are consoled by the thought that you correctly")
        print("identified the killer and that he will hang for his crimes.")
        print()
        print("At least, you hope that's true...")
        pause()

    # if you didn't identify the killer, he kills you!
    if k != gs.my_killer:
        ring_doorbell()
        print("A man is standing outside.  He says, 'You made a")
        print("mistake.  A bad one.  You see, I am the machine gun dealer.'")
        if gs.my_killer == d:
            print()
            print(
                "'Moreover,' he says, 'you identified the man who was cooperating"
            )
            print(
                "with you as the killer.  So the state will take care of him.  Ha.'"
            )
        print()
        time.sleep(2.0)
        print("He draws a gun.  BANG.  You are dead.")
        print()
        print("You never know that the train arrived at 12:30, right on")
        print("time at Constantinople, Turkey.")
        cls(3)
        gs.alive = False
        pause()
예제 #12
0
def endgame(gs: GameState) -> None:
    cls(4)
    print("Your journey has ended.  Georges Nagelmackers and the")
    print("management of Cie. Internationale des Wagons-Lits ")
    print("hope you enjoyed your trip on the Orient Express, the")
    print("most famous train in the world.")
    if gs.perfection:
        print()
        print("Whitehall telegraphs congratulations for identifying both")
        print("the killer and defector correctly.")
        time.sleep(1.0)
        for _ in range(3):
            cls(2)
            print(centered('* * CONGRATULATIONS! * *'))
            time.sleep(1.5)
    cls(4)
    pause()
예제 #13
0
def first_departure() -> None:
    print("The taxi has dropped you at Victoria Station in London.")
    print("The Orient Express is standing majestically on Track 14.")
    print('All aboard....')
    time.sleep(1.0)
    pause('Press <return> to board the train...')
    print('The train is leaving.')
    time.sleep(1.0)
    whoIdx = random.randrange(3, 23)
    who = people[whoIdx:whoIdx + 3]
    print()
    print(f'"You speak to some of the passengers--{who[0]},')
    print(f'{who[1]}, {who[2]} and others--and ask them to keep')
    print('their eyes and ears open and to pass any information--no')
    print('matter how trivial--to you in compartment 13.  The Channel')
    print('crossing is pleasant and the first part of the trip uneventful.')
    cls(4)
    pause()
예제 #14
0
def bandits(gs: GameState) -> None:
    if gs.bandits or (random.random() > 0.04): return  # 4% chance of bandits
    gs.bandits = True
    cls(4)
    print(centered(" * * CLANG! * *"))
    time.sleep(1.0)
    cls(4)
    print("You are rudely awakened from a deep sleep by a loud noise")
    print("as the train jerks to a halt.")
    time.sleep(1.0)
    print()
    ring_doorbell()
    print()
    print("You are shocked to see a bandit waving a gun in your face.")
    print("He demands you give him your wallet, jewelry, and watch.")
    time.sleep(1.0)
    print()
    print("The bandits are off the train in a few moments with")
    print("their loot.  They disappear into the forest.  No one")
    print("was injured, and the train resumes its journey.")
    cls(3)
    pause()
예제 #15
0
def intro() -> None:
    cls()
    print(title)
    pause()
    print(scenario)
    pause("Press <return> to call a taxi...")