Social dynamics in which groups of people form and circulate during a party.

To start with, let's understand "room" to mean "a group of people talking". These groups can grow and shrink as people come and go, so we'll want to name and rename them; and we're also going to need some rules to motivate people moving around, and a description to narrate how they behave when we're with them.

"Emma"
by the banquet table is a room. at the corner is a room. next to the doorway is a room. by the window is a room.
Social clump is a kind of value. The social clumps are vacancy, lone person, couple, cluster, group.
A room has a social clump. Understand the social clump property as describing a room.
Before printing the name of a room:
   say "a [social clump] ".
After looking:
   assign clumping;
   say "Elsewhere in the room, you can see [the list of rooms which are not the location]."
Understand "go to [any room]" as joining. Joining is an action applying to one visible thing. Carry out joining: move player to the noun. Report joining: do nothing.
Understand "examine [any room]" as looking toward. Looking toward is an action applying to one visible thing. Carry out looking toward a room: say "In that direction you see [a list of other people in the noun]."
When play begins: assign clumping. Every turn: assign clumping.
To assign clumping:
   repeat with space running through rooms:
      now the social clump of the space is vacancy;
      if the space contains exactly 1 person, now the social clump of the space is Lone person;
      if the space contains exactly 2 people, now the social clump of the space is Couple;
      if the space contains more than 2 people and the space contains fewer than 5 people, now the social clump of the space is cluster;
      if the space contains more than 4 people, now the social clump of the space is group.
The room description heading rule is not listed in the carry out looking rules.
A person has a number called longevity. The longevity of a person is usually 0. A person can be active or passive.
Definition: a person is other if it is not the player.
Every turn:
   repeat with mover running through other people:
      now the mover is active;
      increment the longevity of mover;
      if longevity of mover is greater than 3 or the mover is bored:
         assign value of spaces for the mover;
         let destination be the nicest room;
         if the destination is not the location of the mover:
            if the player can see the mover, say "[The mover] makes excuses and drifts off to join [the destination].[paragraph break]";
            move the mover to the destination;
            now the mover is complacent;
            now the longevity of the mover is 0;
            if the player can see the mover, say "[The mover] wanders over.[paragraph break]";
            assign clumping;
            now mover is passive.
A room has a number called attractiveness.
Definition: a room is nice if its attractiveness is 1 or more.
To assign value of spaces for (mover - a person):
   repeat with space running through rooms:
      now attractiveness of the space is 0;
      repeat with figure running through people in the space:
         if the mover is bored, decrease attractiveness of the space by 2;
         if the mover likes the figure, increment attractiveness of the space;
         if the mover dislikes the figure, decrement attractiveness of the space;
         if the mover desires the figure, increase attractiveness of the space by 2.
Liking relates various people to various people. The verb to like means the liking relation.
Disliking relates various people to various people. The verb to dislike means the disliking relation.
Attraction relates various people to various people. The verb to desire means the attraction relation.
Mr Weston, Mr Woodhouse, Mr Elton, Mr Knightley, and Frank Churchill are men. Mrs Weston, Mrs Bates, Miss Bates, Harriet Smith, Emma Woodhouse, and Jane Fairfax are women.
Harriet Smith likes Mr Elton. Harriet Smith desires Mr Elton. Harriet Smith likes Emma Woodhouse.
Mr Elton desires Emma Woodhouse.
Emma Woodhouse likes Harriet Smith and Mr Knightley. Emma Woodhouse dislikes Jane Fairfax.
Mr Knightley likes Emma Woodhouse, Mr Weston, and Mrs Weston. Mr Knightley desires Emma Woodhouse.
Jane Fairfax desires Frank Churchill. Jane Fairfax likes Frank Churchill.
Frank Churchill desires Jane Fairfax and Emma Woodhouse. Frank Churchill likes Jane Fairfax.
Miss Bates likes Jane Fairfax, Emma Woodhouse, and Mrs Bates.
Mr Weston likes Frank Churchill, Emma, Knightley, and Mrs Weston.
Mrs Weston likes Frank Churchill, Emma, Knightley, and Mr Weston.
Mrs Bates likes Miss Bates.
A person can be complacent or bored.
When play begins:
   repeat with character running through other people:
      let space be a random room;
      move character to space.

And now we use writing a paragraph about… to describe character behavior in groups, when we join them:

Rule for writing a paragraph about Frank Churchill:
   if the location contains a woman (called flirt) who is desired by Frank:
      say "[Frank Churchill] is talking with great animation and slightly more than becoming warmth to [the flirt][if an unmentioned other person is in the location], while [the list of unmentioned other people in the location] look on with varying degrees of amusement or irritation[end if].";
      repeat with character running through people in the location:
         if the character is not Churchill and the character is not the flirt, now the character is bored.
Rule for writing a paragraph about Mr Elton:
   if the location contains an unmentioned woman (called flirt) who is desired by Elton:
      say "[Mr Elton] hangs on the sleeve of [the flirt], offering an assortment of studied gallantries that make you wonder about his good sense.";
      repeat with character running through people in the location:
         if the character is not Elton and the character is not the flirt, now the character is bored.
Rule for writing a paragraph about Harriet Smith:
   if the location contains Emma and Emma is unmentioned:
      say "[Harriet] and [Emma] are conversing in low tones -- Harriet, apparently, being too shy to speak so that everyone can hear her."
Rule for writing a paragraph about Mr Knightley:
   if the location contains an unmentioned man (called the listener) who is not Mr Knightley:
      say "[Mr Knightley] is speaking with [the listener] about agricultural matters.";
      now the listener is complacent.
Rule for writing a paragraph about Miss Bates:
   say "[Miss Bates] is giggling about the weather[if an unmentioned other person is in the location]. This does not seem to compel the interest of [the list of unmentioned other people in the location][end if].";
   repeat with character running through people in the location:
      if the character is not Miss Bates and character is not Mrs Bates, now the character is bored.

Since this is just an example, we'll stop here, but there's no reason we couldn't write such paragraphs for everyone.

Test me with "z / z / z / look / x corner / x doorway / x window / x table / go to the table".
Test me with "z / z / z / look / x corner / x doorway / x window / x table / go to the table".
You can see Mr Elton here.

Elsewhere in the room, you can see a cluster at the corner, a couple next to the doorway and a group by the window.

>(Testing.)

>[1] z
Time passes.

Mr Elton makes excuses and drifts off to join a couple next to the doorway.

Mr Knightley wanders over.

Mrs Weston wanders over.

>[2] z
Time passes.

>[3] z
Time passes.

>[4] look
You can see Mrs Weston and Mr Knightley here.

Elsewhere in the room, you can see a cluster at the corner, a cluster next to the doorway and a couple by the window.

>[5] x corner
In that direction you see Emma Woodhouse, Miss Bates and Mr Woodhouse.

Mr Weston wanders over.

Mr Knightley makes excuses and drifts off to join a cluster at the corner.

Mrs Weston makes excuses and drifts off to join a cluster at the corner.

>[6] x doorway
In that direction you see Jane Fairfax.

>[7] x window
In that direction you see Mr Woodhouse.

>[8] x table
In that direction you see Mr Weston.

>[9] go to the table
You can see Mr Weston here.

Elsewhere in the room, you can see a group at the corner, a couple next to the doorway and a lone person by the window.

Mr Weston makes excuses and drifts off to join a group at the corner.