Intelligent Hinting

version 5 by Aaron Reed

  • Home page
  • Beginning
  • Previous
  • Next

  • Example: ** Slay Doctor Lucky - A more complex scenario showing off Intelligent Hinting's action inference abilities.

    To test out Intelligent Hinting more thoroughly, let's create a small project reminiscent of a popular indie board game. Trapped in the mansion of the smarmy Doctor Lucky with a bunch of fellow revenge-seekers, your goal is murder. The catch is, the deed must be done when no one else is in sight.

        "Slay Doctor Lucky"

        Use full-length room descriptions. Include Plurality by Emily Short. The maximum score is 80.

        When play begins: say "You slip into the foyer of the mansion quietly, but before you can wonder where everyone is, that scoundrel [a random suspect who is not Doctor Lucky] is whispering in your ear: 'Late as usual. The best weapons are already taken, of course. May the best killer win.'[paragraph break]As [it-they] creeps away, you are left with only your murderous desire to...".

        [We'll quickly create a map of the manor and populate it with pithy randomly generated descriptions.]

        Foyer is a room. Solarium is north of Billiard Room and west of Trophy Room. Library is east of Trophy Room and north of Studio. North Hall is south of Trophy Room and west of Studio. Gazebo is south of Studio and north of Drawing Room. Drawing Room is east of South Hall. Study is north of South Hall, south of North Hall, and east of Foyer. Foyer is south of Billiard Room and north of Kitchen. Kitchen is west of South Hall.

        The description of a room is usually "[one of]Only the finest[or]Ridiculously expensive[or]Posh[or]Fashionably antique[in random order][one of] furnishings[or] cabinets[or] furniture[or] centerpieces[in random order] and[one of] tasteful[or] outrageous[or] postmodern[or] sophisticated[in random order] [one of]carpeting[or]wall panelling[or]oak floorboards[or]chandeliers[in random order]. The exits are [exitflag][the list of adjacent rooms][exitflag].".

        exit flag is a truth state that varies. To say exitflag: if exit flag is true, now exit flag is false; otherwise now exit flag is true.

        Before printing the name of a room (called target) when exit flag is true:
            let way be the best route from location to target;
            unless way is nothing, say "[way] to the ".

        [Next, let's add the other characters.]

        A suspect is a kind of person. Professor Ochre is a male suspect in Studio. Madam Fuchsia is a female suspect in Study. Headmistress Periwinkle is a female suspect in Solarium. Cardinal Violet is a male suspect in South Hall. Doctor Lucky is a male suspect in Billiard Room.

        Every turn (this is the NPC movement rule):
            repeat with subject running through on-stage suspects:
                if a random chance of 3 in 4 succeeds:
                    let current space be location of subject;
                    let next space be a random accessible room which is adjacent to current space;
                    if subject is visible:
                        if subject is Doctor Lucky, say "[one of]With a wink[or]Stepping lightly[or]Humming something to himself[in random order]";
                        otherwise say "[one of]Sniffling[or]Eyeing you suspiciously[or]Slyly[or]Quietly[in random order]";
                        say ", [the subject] heads to the [next space][if subject holds alibi], taking [its-their] unbeatable alibi with [it-them][end if].[paragraph break]";
                    move subject to next space;
                    if subject is visible:
                        if subject is Doctor Lucky, say "[one of]With a smile and a nod[or]Strolling gaily through the doorway[or]Twirling his mustache playfully[in random order]";
                        otherwise say "[one of]Unexpectedly[or]Moving cautiously[or]Glancing at you angrily[in random order]";
                        say ", [the subject] arrives from the [current space][if subject holds alibi], sporting an enviable alibi[end if].[paragraph break]".

        [We'll give them some annoying behavior, to justify our later seemingly cold-blooded actions:]

        Every turn when player holds something (called loot) and a random chance of 1 in 6 succeeds and no suspects are visible and location is not in Off-Limits:
            move loot to a random accessible room;
            say "Suddenly [the loot] is snatched from your hands by [a random on-stage suspect], appearing from nowhere. 'I'll just be taking this,' [it-they] chortles, and slips away before you can react.".

        [Let's add a few locks and keys preventing us from immediately finding a murder weapon, to make things more challenging.]

        Off-Limits is a region. Definition: a room is accessible if it is not regionally in Off-Limits. Master Bedroom is a room in Off-Limits. Some french doors are a door. They are south of South Hall and north of Master Bedroom. They are locked, closed and openable. Understand "door" as doors.

        A display case is a fixed in place transparent openable closed container in Master Bedroom. The lead trophy is in display case. The description is "A 15-pound lead ball on a base just big enough for a solid grip."

        A cupboard is in Kitchen. It is fixed in place, openable, closed, locked, and lockable. A brass key is in cupboard. The brass key unlocks french doors. A lectern is fixed in place in Library. A small iron key is on lectern. A small iron key unlocks the cupboard.

        [Next, the foul act itself:]

        Understand the command "murder" as something new. Murdering it with is an action applying to two things. Understand "murder [someone] with [something]" as murdering it with.

        Instead of attacking, say "A simple attack won't do. No. This is a night... for murder.". Instead of murdering: say "That's hardly a suitable murder weapon.".

        Instead of murdering when at least 2 suspects are visible: let nearby chaps be the list of visible suspects; remove noun from nearby chaps; say "Not in the sight of [the nearby chaps]!".

        Instead of murdering something (called victim) with the lead trophy:
            say "You viciously murder [victim] with [the second noun]!";
            if victim holds alibi:
                move alibi to player;
                say "[line break]You pocket the convenient alibi dearly departed [victim] was carrying.";
            award 13 points;
            if victim is Doctor Lucky:
                say "[line break]You taste the hot red needle of victory. At last, your nemesis is defeated. For now...";
                end the game in victory;
                say "[line break]You stash the body [one of]under a handy chaise longue[or]inside a nearby Louis XIV[or]behind a dumbwaiter hatch[in random order].";
                remove victim from play.

        [For simplicity's sake, we assume that the other suspects are perpetually unsuccessful in their attempts to bump off the doctor.]

        [Finally, let's add two more obstacles that must be completed before the murder can take place: disposing some incriminating papers, and finding a somewhat whimsical alibi, which the other suspects are all trying to catch too:]

        A roaring fireplace is fixed in place in Drawing Room. Some blackmail material is in Trophy Room. Instead of inserting material into fireplace: remove material from play; award 7 points; say "You burn the hateful papers in the fire. Now there will be nothing to link you to the Doctor.".

        Instead of murdering Doctor Lucky with something when blackmail material is on-stage: say "First you must dispose of the blackmail material.".

        An alibi is a thing in Solarium.
        Every turn when alibi is on-stage:
            if location of alibi contains at least 1 suspect and alibi is not held by someone and a random chance of 3 in 4 succeeds:
                let holder be a random suspect enclosed by location of alibi;
                now holder holds alibi;
                if holder is visible, say "[one of]With a crafty smile[or]With a cunning grin[or]With swift fingers[in random order], [holder] snatches the alibi.";
            otherwise if someone (called holder) holds alibi and a random chance of 1 in 4 succeeds:
                move alibi to location of holder;
                if holder is visible, say "[one of]Distracted by noise in a neighboring room[or]Carelessly[in random order], [the holder] drops [its-their] alibi.".

        Instead of taking alibi when a suspect holds alibi: say "[A random person holding alibi] jerks it away from your grasp with a nasty smile.".

        After taking alibi: remove alibi from play; award 8 points; say "You snatch the alibi gratefully, and slip it carefully into your jacket until you need it.".

        Instead of murdering Doctor Lucky with something when alibi is on-stage: say "First you'd better find a decent alibi.".

        [And that's our scenario. Finally, we'll upgrade it for Intelligent Hinting:]

        Section - Puzzles

        Include Intelligent Hinting by Aaron Reed.

        Winning-The-Game requires Taking-Care-Of-Business and Killing-The-Doctor.

        Taking-Care-Of-Business is a not sequential puzzle. It requires Destroying-The-Evidence and Finding-An-Alibi.

        [These can be solved in either order, so we make the parent puzzle "not sequential."]

        Destroying-The-Evidence is a task with venue Drawing Room. Requirements for Destroying-The-Evidence: do the action of inserting blackmail materials into fireplace. Definition: Destroying-The-Evidence is complete if materials are off-stage.

        Finding-An-Alibi is a task. Requirements for Finding-An-Alibi: do the action of taking alibi. A red flag rule for Finding-An-Alibi: if alibi is held by someone, rule fails. Definition: Finding-An-Alibi is complete if alibi is off-stage.

        [Once we've burned the materials or taken the alibi, the acts can't be undone, so neither of these tasks need to be reversible. Note that if a suspect snatches the materials (or any other objects in the scenario), Intelligent Hinting automatically tracks them down again before continuing.]

        [We specify not to try taking the alibi if someone else holds it. Note that red flag rules are *always* for a specific task.]

        Killing-The-Doctor is a task. Requirements for Killing-The-Doctor: do the action of murdering Doctor Lucky with lead trophy. A red flag rule for Killing-The-Doctor: if the number of visible suspects > 1, rule fails.

        Test me with "e / n / n / suggest / take material / e / s / s / s / suggest".

    And that's it. Note that there is nothing in here about all of those locks and keys we mentioned earlier: Intelligent Hinting automatically deals with these obstacles, including the additional annoyance of suspects occasionally stealing them and hiding them somewhere else.

    For simplicity's sake, we haven't included the optional killing of the other suspects in the puzzle definition: you'll have to take matters into your own hands to score the full 80 points (equal to the number of mystery novels written by Agatha Christie, coincidentally.) This illustrates that Intelligent Hinting should always encode the path to one solution, but it does not necessarily have to be a perfect solution.