<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>5000 Characters at Video Frame Rate using Declarative Programming</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Samuel Hill</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ian Horswill</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>11th Experimental Artificial Intelligence in Games Workshop</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Northwestern University</institution>
          ,
          <addr-line>2233 Tech Drive, Evanston, IL, 60208</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Video games have historically been limited in the number of characters under AI control. This is all the more true for games that use declarative systems which are generally used for turn-based or otherwise non-real-time games. While a declarative system can obviously be used for a real-time simulation, we wanted to test the limits of how far it can be scaled for large numbers of characters. This paper shows how 5000 characters can run simultaneously and in real-time with 60fps performance on a modern laptop using a declarative logic programming language.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Declarative programming</kwd>
        <kwd>Logic programming</kwd>
        <kwd>Needs-based AI</kwd>
        <kwd>crowd simulations 1</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Performance considerations have traditionally
restricted the number of simultaneous NPCs,
particularly when those characters are driven by
symbolic rules or other declarative methods. Many
systems that do support this kind of character AI are
also turn-based rather than real-time. In this paper,
we show that 5000 The Sims-style characters can be
run simultaneously on a modern laptop using a
version of logic programming.</p>
      <p>Although Sims-style ‘needs-based AI’ is relatively
simple, and the rendering of the characters in our
demo is extremely simple (particle-like dots on the
screen), this still demonstrates that symbolic,
declarative techniques can be pushed well beyond
what would have been though possible. In this paper,
we will discuss the system, and the techniques used to
make it so efficient.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        Many AI-based games have used symbolic declarative
systems - logic, symbolic rules, or some kind of rule
engine - for social reasoning and character control.
Façade [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] used a reactive planner, ABL [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], that
incorporated a forward-chaining production system.
Prom Week [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] also used a forward-chaining
production system, Comme Il Faut [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. CiF’s successor
the Ensemble Engine [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] is similarly a
forwardchaining production system. The Sims 3 [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] used a
rule system to script the interactions between
situations, personality traits, and actions available to
a given character [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. MKULTRA [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] and City of
Gangsters [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] both used logic programming to
implement social reasoning [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. F.E.A.R. makes use of
a planner, GOAP, that allows for declarative
definitions of various AIs in the GDBEdit database tool
[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
      </p>
      <p>
        One of the earliest and most influential symbolic
systems for games is the Inform 7 language [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]
that allows designers to build interactive narrative
systems using declarative statements. The Versu
simulationist narrative system [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] used a
custom logic programming language, Praxis, based on
an exotic modal logic called eremic logic (aka
exclusion logic) [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]. The Lume system [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] made
extensive use of Prolog’s definite clause grammars
[
        <xref ref-type="bibr" rid="ref18">18</xref>
        ], [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] for text generation. Lapeyrade has also used
Prolog for better character decision making [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ].
      </p>
      <p>
        All these games and systems use declarative
programming for either some component of character
control and/or social reasoning. Some are turn-based
games like in the Versu platform, others are batch like
jobs used in Townlikes (that still need to run fast but
not at any particular frame rate), and others are
realtime systems like with GOAP in F.E.A.R.. Even when
used for real-time character control the number of
NPCs is usually relatively low and the portion of the
game logic that is declarative are the relations
between possible actions and the world state. The
code for how a Goal executes is still usually written in
an imperative manner [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
      </p>
      <p>
        There are also entire games that have been built
using declarative languages, such as those built with
the video game description language - VGDL [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ].
Currently this technique is used to generate 2D tile
arcade style games with the help of ASP and
evolutionary search [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ], [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ]. These games are
playable by a human and are fully declarative
everything from character controls to game logic to
the tilemap itself are declared in text files that are
      </p>
      <p>
        Copyright © 2024 for this paper by its authors. Use permitted under
Creative Commons License Attribution 4.0 International (CC BY 4.0).
used to generate a game. The purpose of these games
is largely to allow for testing of general video game
playing (GVGP) algorithms on several different games
[
        <xref ref-type="bibr" rid="ref24">24</xref>
        ].
      </p>
      <p>
        In large part because of the expense of AI
simulation, games involving large-scale character
simulation are relatively rare. The best known is
Dwarf Fortress [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ], which supports real-time
simulation of small hundreds of characters. Achieving
this level of performance requires implementation in
C++ and significant programmer effort to optimize
cache locality and minimize pointer chasing.
RimWorld is a very similar game that also involves
social simulation for the purpose of storytelling [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ].
Caves Of Qud is a game that is more like adventure
mode in DF and, similarly, features hundreds of
characters that all have various social relations and
need to choose what action to take each tick [
        <xref ref-type="bibr" rid="ref27">27</xref>
        ].
Unlike DF Fortress mode and RimWorld, this
roguelike experience is turn based and as such doesn’t need
to run at a particular frame rate. While all these games
feature large numbers of characters acting in a world,
none use declarative systems for the control of these
NPCs.
      </p>
      <p>
        Some large-scale crowd simulation exist for use in
film and other rendered media forms [
        <xref ref-type="bibr" rid="ref28">28</xref>
        ], [
        <xref ref-type="bibr" rid="ref29">29</xref>
        ]. Some
of these tools even allow the behaviors of the agents
to be stated in sentence form for specific decision
nodes [
        <xref ref-type="bibr" rid="ref30">30</xref>
        ]. These tools target rendered scenes for
film and television and as such do not need to run in
real-time.
      </p>
      <p>
        Some crowd simulation techniques have been
used to study crowd dynamics and the creation of
autonomous agents for visualization [
        <xref ref-type="bibr" rid="ref31">31</xref>
        ], [
        <xref ref-type="bibr" rid="ref32">32</xref>
        ]. Shao
have claimed real-time performance at 30fps when
animating up to 1400 characters moving and
pathfinding around a 3D scene on 2007 hardware
[
        <xref ref-type="bibr" rid="ref31">31</xref>
        ]. This was done with over 50,000 lines of C++ and
uses a simple action selection method reminiscent of
needs-based AI.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Needs-based AI</title>
      <p>
        Needs-based AI is a famous technique for controlling
characters in video games that was created for The
Sims [
        <xref ref-type="bibr" rid="ref33">33</xref>
        ], [
        <xref ref-type="bibr" rid="ref34">34</xref>
        ], and has been used in other games like
Roller Coaster Kingdom and an RPG for Lord Of the
Rings [
        <xref ref-type="bibr" rid="ref34">34</xref>
        ].
      </p>
      <p>
        Needs-based AI attempts to fulfill various needs
for NPCs by searching over the actions of each object
available to them (i.e. advertisements) and weighting
the cost of completing the action against each
character’s needs with some scoring function [
        <xref ref-type="bibr" rid="ref34">34</xref>
        ].
Each character goes about completing actions that
have been selected/assigned to them, potentially
getting rewarded for the various tasks. When no more
actions remain in the queue of selected actions the
NPC searches for all the advertisements on all the
objects around them then scores each action based on
their needs and selects the best scoring
advertisement. The equation for selecting the best
scoring advertisement is  ( ) where  is the
set of all scored advertisements for a given character.
The complexity of scoring all advertisements is
 ( ), where  is the number of people,  is the
objects nearby, and  is the advertisements at each
location. Once you have scored all advertisements for
all characters, you can run the argmax equation for
each character. Since argmax is operating on the set of
all advertisements for each person, the complexity of
selecting an action from the scored set is  ( ),
where  is the number of people,  is the objects
nearby, and  is the advertisements. Given that these
two steps are each of the same complexity, and that
the two iterations are sequential, the total complexity
of action selection is  ( ).
      </p>
      <p>
        The selected advertised action sequence is then
added to the queue of actions to be completed.
Needsbased AI has always had the ability to sequence
actions, a technique called action chaining [
        <xref ref-type="bibr" rid="ref34">34</xref>
        ], but in
The Sims 4 the developers wanted to be able to have
more interesting action sequences. To accomplish this
the developers allowed the system to simultaneously
dispatch multiple actions from the queue when those
actions would not interfere with one another [
        <xref ref-type="bibr" rid="ref35">35</xref>
        ].
      </p>
      <p>
        The Sims 3 had a goal of creating a larger varied
living world, and to do this while remaining playable
several optimizations were employed [
        <xref ref-type="bibr" rid="ref36">36</xref>
        ]. Some
execution optimizations such as hierarchical planning
and commodity-interaction maps as well as some
level of detail (LoD) optimizations such as auto-satisfy
curves and story progression [
        <xref ref-type="bibr" rid="ref36">36</xref>
        ]. Hierarchical
planning takes the usually  ( ) approach of
searching for every person ( ), for every location ( ),
and then for every advertised action ( ), and makes
it  ( +  +  ) by instead selecting each step one at
a time. Commodity-interaction maps are essentially
dictionaries of needs and the actions that satisfy those
needs, and they are used to trade off compute time
searching over all advertisements on all objects to see
if they satisfy a sim’s needs with storage cost. The LoD
optimizations tick the actions of sims not in the
current focused level when they come into focus
(auto-satisfy), and tick certain subsystems like the
wants of the town itself at a lower rate (story
progression). As a result, although the simulation
notionally supports hundreds of characters, the vast
majority of them are effectively idle at any given time.
As well, although The Sims 3 has many more possible
degree to which NPCs attenuate distance. The value
motives (needs) than the 8 used in previous versions,
2870 was not chosen at random, it relates to the size
any individual character has a small number of those
of the map that the characters move on and effectively
possible motives.
      </p>
      <sec id="sec-3-1">
        <title>3.1. Scoring functions</title>
        <p>
          The scoring function that we use here is the most
sophisticated function listed in Zubeks description of
needs-based AI, an attenuated need-delta scoring
function that is additionally attenuated based on
distance [
          <xref ref-type="bibr" rid="ref34">34</xref>
          ]. One difference in our version is that
each action can only satisfy one need. In the version of
action performance outlined by Zubek, some actions
can be sequences, and this can potentially allow for
multiple needs to be fulfilled by an advertisement. As
such, the algorithm for calculating an advertised
action score must sum the attenuated scoring across
all needs. Instead of summing across all needs, with
each action only satisfying one need, we can simplify
the attenuated need-delta scoring with distance
attenuation to:
where
        </p>
        <p>is the current need value of a particular
need type,  advertised need delta,  
attenuation function, and 
is
the distance
is an
attenuation function.  
Zubek, but instead of the mentioned  ( ) =
( ) = 10 as is discussed in</p>
        <p>2
function ours is  ( ) =

1+( 2870 2) to tune down the
scales 
to a max of 82369).</p>
        <p>2 to be between 1 and 30 (as opposed</p>
        <p>One more simplification in the current demo is
that all locations only advertise a single action. In
effect, a location has a type that correlates to a need.
As such, the complexity of this scoring algorithm can
be given as  (</p>
        <p>), where  is the number of NPCs
that need to select actions and  is the number of
locations to search over.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Real-time logic programming</title>
      <p>To test the scaling limits of declarative symbolic
logical methods for real-time NPC control, we built a
state-fair simulator, as one might find in a tycoon
game, using a logic-programming implementation of
needs-based AI. NPC’s wander through the state fair
eating, drinking, seeking entertainments, and so on.
The simulation consists of a map with 367 locations,
onto which we spawn a few thousand NPCs. Each
character has 6 motivations (hunger, bathroom,
games, amusement,</p>
      <p>music, and shopping) that
influence their action selection.</p>
      <sec id="sec-4-1">
        <title>4.1. Needs-based AI in logic programming</title>
        <p>
          The logic for the core steps of scoring all available
actions and then selecting the best action for each
character is contained in the few lines of code found in
language implementation are outside the scope of this
Code Fragment 1 and 2. For a discussion of the
paper but see [
          <xref ref-type="bibr" rid="ref37">37</xref>
          ], [
          <xref ref-type="bibr" rid="ref38">38</xref>
          ] for more information.
programming language used, see [
          <xref ref-type="bibr" rid="ref37">37</xref>
          ], [
          <xref ref-type="bibr" rid="ref38">38</xref>
          ], but the
Another important optimization might be called
following fragments can be explained thusly:
implicit need decay. Normally, a needs-based AI
Code Fragment 1 defines a predicate that is true
system
would update each need state of each
when a given person performing a given advertised
character on every tick. For our system, this would be
action at a given location has a given score. It states
prohibitively
expensive.
        </p>
        <p>Instead,
we
store
that it has that score when the location advertises that
timestamped need values; a need value is represented
action, it fulfills some need, and score is the result of
distance-based scoring, above, along with some noise
as a tuple of ( ,  ,  ) stating that the need had value 
at time  , and was decaying at rate  . We can then
to add a small amount of randomness to the action
compute the current need value on demand as:
selection:</p>
        <sec id="sec-4-1-1">
          <title>Code Fragment 1</title>
          <p>Action Scoring
PersonActionScoring = Predicate("…",
person.Indexed, actionType.Indexed,
location.Indexed, score).If(</p>
          <p>ReadyToSelectAction,
CoordForPerson[person, coords],
LocationAdvertisements,
deltaOffset == delta +</p>
          <p>
            RandomFloat[
            <xref ref-type="bibr" rid="ref2">-2, 2</xref>
            ],
ActionSatisfiesNeed,
FairgroundLocations[location, __,
NeedByType[person, needType, need],
DistanceScoring[need, deltaOffset,
          </p>
          <p>otherCoords],
coords, otherCoords,
score]);</p>
          <p>Given this, Code Fragment 2 defines a predicate
stating a given action/location pair is best for a given
character (note that this is essentially the same as the
argmax equation, just written in logic):</p>
        </sec>
        <sec id="sec-4-1-2">
          <title>Code Fragment 2</title>
          <p>Action Selection
PersonActionBestScore = Predicate("…",
person.Key, actionType.Indexed,
location.Indexed).If(</p>
          <p>ReadyToSelectAction[tempPerson],
Maximal((person, actionType,</p>
          <p>location), score,
PersonActionScoring[tempPerson,
actionType, location, score] &amp;
person == tempPerson));</p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Implementation optimizations</title>
        <p>The performance of the system is dependent on
several optimizations. Many of these have to do with
the specific programming language implementation:
strong
typing,
bottom-up
execution,
parallel
execution, native code compilation. The details of the
 
= max( − ( − 

) ∗  )
with</p>
        <p>being the current time. Since these values
are read infrequently but would otherwise be updated
frequently, this is
much
more efficient.</p>
        <p>As is
recommended by Zubek, decay rates for a given need
vary slightly from character to character to give them
slightly different “personalities”. These decay rates
are chosen randomly (Appendix A, Code Fragment 3).</p>
      </sec>
      <sec id="sec-4-3">
        <title>4.3. Action States</title>
        <p>For characters to perform a selected action they must
move to the location of the selected action and then
take some steps to complete the action before the
need is satisfied. While we could allow for completion
of actions instantaneously, to be more in line with The
Sims implementation - as specified by Zubek – we
instead have some action performance before a need
is satisfied.</p>
        <p>When an action is initiated, the system tells the
unity code to start moving the character, and then
marks the character as being in progress towards that
location. When the character arrives at the location
they are marked as no longer moving towards their
destination. When the action is completed, unity
informs the system, and the system updates the need
states, and generates a new next action (Appendix A,
Code Fragment 6, 7, 8, 11). In place of the animations
that would normally be running when performing an
action, we simulate an animation running by starting
a timer that indicates the selected action is being done
(Appendix A, Code Fragment 9).</p>
        <p>Unlike in The Sims all actions in this simulation
are individual, there is no chaining of actions nor are
there any concurrent interactions. This simplification
is what allows us to use a timer for each person taking
an action, when the timer is running the “animation”
is playing and when the timer completes the character
has completed the action and finished its animation.
While we do not have proper animations for each sim,
when on a timer for an action the sim is moving
randomly around the location that they have selected
an action at.</p>
      </sec>
      <sec id="sec-4-4">
        <title>4.4. Destinations &amp; Unity Interface</title>
        <p>For control of character movements, we have a simple
interface between the action selection simulation and
the Unity code that performs movements. The
Simulog code provides a table of people and the
destination they are moving to (Appendix A, Code
Fragment 7) that the Unity code iterates over each tick
to adjust NPC positions. The Unity code in turn
provides a function that we can call to ask if someone
has arrived at their destination. With this simple
interface of action selection assigning destinations to
the Unity code and Unity only needing to report back
when someone has arrived at the destination, we are
able to change out the underlying movement
implementation without needing to do any
modifications to the action selection algorithm.
Currently, the movement is all simple vector addition
moving sims at a set speed straight towards their
destination.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Performance</title>
      <p>With 5000 NPCs running this simulation on an Apple
M3 Pro we are able to achieve 60fps or better for 95%
of frames when running some performance tests. Our
average inner-frame time was 13.87ms with a
standard deviation of 2.077ms. Figure 3 shows our
performance curve once stable (from 12500 to 25000
ticks) which is somewhat bell curve shaped with a
longer tail to the right. Most of the tail to the right is
likely garbage collection or some other Unity process
as that performance tail is not present in Figure 4
when we show the performance curve for just the rule
execution times.
simulation on 5000 characters without any action
selection takes about 1ms.</p>
      <p>The graph in Figure 2 shows the progression of the
simulation over a 25,000-tick run time. The first 5000
ticks spawn one person every tick causing the slow
rise in compute time for both the action selection
mechanism and the inner-frame updates. For the next
7500 ticks characters begin to arrive at their first
destination and need to select their next action,
creating a tiered slope in the action selection
performance as various numbers of characters need
to select an action. From 12500 ticks on we have a
steady state where performance is consistent and
linear with NPCs now moving around and selecting
actions at a rate of 13.7 actions selected on average
per tick for our sample with a σ of 3.8 actions.</p>
      <p>The cost of moving 5000 NPCs and rendering the
scene (amongst other functions that Unity runs) is the
difference between the action selection rule execution
time and the inner-frame time. As can be seen in
Figure 1, this difference (looking from 5000 ticks to
9000 ticks where action selection has not yet taken
off) is about 7ms. There is also a baseline cost to
running the rest of the declarative simulation when
not performing action selection. As can be seen in
Figures 2 and 4, the cost of running our declarative
After these baseline costs, the variation in
performance largely comes down to the number of
characters selecting actions on any given tick. The
performance cost for one NPC selecting an action
averages to just under 0.3ms. This gap between each
number of agents selecting is clearly visible in Figure
2 and 5 with both the color mapped data points and
green lines indicating the moving average for each
tier. The same gaps are not visible in the inter-frame
time data (grey dots in Figure 2), although there is
clearly a correlation between the range of
performance for rule execution and for total
interframe time.</p>
      <sec id="sec-5-1">
        <title>5.1. Pushing character counts</title>
        <p>
          The performance shown above is only possible when
we first compile our rules down to native C# code, the
process for which is described in [
          <xref ref-type="bibr" rid="ref37">37</xref>
          ], [
          <xref ref-type="bibr" rid="ref38">38</xref>
          ], and then
we run our compiled code in parallel. The type of
parallelism employed is per predicate, not per sim,
utilizing the dependency graph for all predicates to
spin up tasks that run the compiled rules for a given
predicate only when its dependencies have finished.
Without these optimizations the maximum character
count at nearly the same performance is 2000 NPCs.
        </p>
        <p>One optimization that could be employed to
further stabilize performance (and potentially allow
for more NPCs) is to throttle the number of characters
that are selecting actions on a given tick. With a limit
on the number of characters selecting actions that is
slightly higher than the un-limited average number
selecting you could effectively cap the cost of doing
action selection while still eventually performing the
same sets of needs-based calculations. This technique
was not employed in this demo but a commercial
system that cares more about never dropping below
60fps may want to implement such a throttle.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusion</title>
      <p>AI character control based on declarative
programming can be surprisingly performant.
Through a combination of compilation, parallel
evaluation, and careful optimization, thousands of
characters can be run at video frame rate. Although
this demonstration involves simple needs-based AI,
we intend to investigate more complicated techniques
in the future.</p>
    </sec>
    <sec id="sec-7">
      <title>A. Code Appendix</title>
      <p>Other than the two code fragments inside the body of
this document, the remain fragments in this appendix
contain the entirety of the Simulation code written in
TED/Simulog.</p>
      <sec id="sec-7-1">
        <title>Code Fragment 1</title>
        <p>NPCs (people) and their Needs
People = Exists("People", person);
NeedByType = Predicate("NeedByType",
person.JointKey, needType.JointKey, need);</p>
      </sec>
      <sec id="sec-7-2">
        <title>Code Fragment 2</title>
        <p>NPC start and end conditions
Unsatisfied = Definition("Unsatisfied",
person).Is(NeedByType[person, __, need],</p>
        <p>NeedValue[need] == Zero);
People.StartWhen(People.Population[count],
count &lt; 5000, RandomPerson)
.EndWhen(People[person],</p>
        <p>Unsatisfied[person]);</p>
      </sec>
      <sec id="sec-7-3">
        <title>Code Fragment 3</title>
        <p>Need assignments
foreach (var needOfType in NeedTypeList)
People.StartCauses(Add(NeedByType[person,
needOfType, need]).If(
NewNeed[RandomFloat[0.002f, 0.007f],
need]));</p>
      </sec>
      <sec id="sec-7-4">
        <title>Code Fragment 4</title>
        <p>Locations and their Advertisements
FairgroundLocations = Parse(
"FairgroundLocations", location.Key,
locationType.Indexed, coords.Indexed,
ParseFairgroundLocations());
LocationAdvertisements = Parse(
"LocationAdvertisements",
location.Indexed, actionType.Indexed,
delta, ParseLocationAdvertisements());</p>
      </sec>
      <sec id="sec-7-5">
        <title>Code Fragment 5</title>
        <p>Action satisfies need table
ActionSatisfiesNeed = Parse("ActionSatisfi…",
actionType, needType,
DefaultActionSatisfiesNeed.Select(</p>
        <p>pair =&gt; (pair.Key, pair.Value)));</p>
      </sec>
      <sec id="sec-7-6">
        <title>Code Fragment 6</title>
        <p>Person action state table
PersonActionAt = Predicate("PersonActionAt",
person.Key, actionType.Indexed,
location.Indexed, moving.Indexed);
PersonActionAt.Overwrite = true;
PersonMovingTo = Definition("PersonMovingTo",
person, location).Is(PersonActionAt[</p>
        <p>person, __, location, true]);</p>
      </sec>
      <sec id="sec-7-7">
        <title>Code Fragment 7</title>
        <p>Destinations and Arrivals
Destinations = Predicate("Destinations",
person, coords)
.If(People[person], PersonMovingTo[person,
location], FairgroundLocations);
ArrivedAtDestination = Predicate("…", person)
.If(People[person], PersonMovingTo[person,
__], HasPersonArrived[person]);</p>
      </sec>
      <sec id="sec-7-8">
        <title>Code Fragment 8</title>
        <p>Arrival state update</p>
      </sec>
      <sec id="sec-7-9">
        <title>Code Fragment 9</title>
        <p>Action timer</p>
      </sec>
      <sec id="sec-7-10">
        <title>Code Fragment 10</title>
        <p>Ready to select action</p>
      </sec>
      <sec id="sec-7-11">
        <title>Code Fragment 11</title>
        <p>Action assignment</p>
      </sec>
      <sec id="sec-7-12">
        <title>Code Fragment 12</title>
        <p>Action completion and reward</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Mateas</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Stern</surname>
          </string-name>
          , Façade. (
          <year>2005</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M.</given-names>
            <surname>Mateas</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Stern</surname>
          </string-name>
          , “
          <article-title>A behavior language for story-based believable agents</article-title>
          ,
          <source>” IEEE Intell. Syst.</source>
          , vol.
          <volume>17</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>39</fpage>
          -
          <lpage>47</lpage>
          , Jul.
          <year>2002</year>
          , doi: 10.1109/MIS.
          <year>2002</year>
          .
          <volume>1024751</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>McCoy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Treanor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Samuel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Reed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Wardrip-Fruin</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Mateas</surname>
          </string-name>
          , “Prom week,”
          <source>in Proceedings of the International Conference on the Foundations of Digital Games, in FDG '12</source>
          . New York, NY, USA: Association for Computing Machinery, May
          <year>2012</year>
          , pp.
          <fpage>235</fpage>
          -
          <lpage>237</lpage>
          . doi:
          <volume>10</volume>
          .1145/2282338.2282384.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>McCoy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Treanor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Samuel</surname>
          </string-name>
          , N. WardripFruin, and M. Mateas, “
          <article-title>Comme il Faut: A System for Authoring Playable Social Models,”</article-title>
          <source>Proc. AAAI Conf. Artif. Intell. Interact. Digit. Entertain.</source>
          , vol.
          <volume>7</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>158</fpage>
          -
          <lpage>163</lpage>
          , Oct.
          <year>2011</year>
          , doi: 10.1609/aiide.v7i1.
          <fpage>12454</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B.</given-names>
            <surname>Samuel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Reed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Maddaloni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mateas</surname>
          </string-name>
          , and
          <string-name>
            <surname>N.</surname>
          </string-name>
          <article-title>Wardrip-Fruin, “The Ensemble Engine: Next-Generation Social Physics”</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <article-title>[6] The Sims 3</article-title>
          . (
          <year>2009</year>
          ). Maxis.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>R.</given-names>
            <surname>Evans</surname>
          </string-name>
          , “
          <article-title>AI challenges in Sims 3,”</article-title>
          <string-name>
            <surname>Artif. Intell. Interact. Digit. Entertain.</surname>
          </string-name>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>I. Horswill</surname>
          </string-name>
          , “Postmortem:
          <string-name>
            <given-names>MKULTRA</given-names>
            ,
            <surname>An Experimental AI-Based</surname>
          </string-name>
          <string-name>
            <surname>Game</surname>
          </string-name>
          ,
          <source>” Proc. AAAI Conf. Artif. Intell. Interact. Digit. Entertain.</source>
          , vol.
          <volume>14</volume>
          , no.
          <issue>1</issue>
          ,
          <string-name>
            <surname>Art</surname>
          </string-name>
          . no.
          <issue>1</issue>
          ,
          <string-name>
            <surname>Sep</surname>
          </string-name>
          .
          <year>2018</year>
          , doi: 10.1609/aiide.v14i1.
          <fpage>13027</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9] City of Gangsters. (
          <year>2021</year>
          ). SomaSim, Chicago.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>R.</given-names>
            <surname>Zubek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            <surname>Horswill</surname>
          </string-name>
          , E. Robison, and
          <string-name>
            <given-names>M.</given-names>
            <surname>Viglione</surname>
          </string-name>
          , “
          <article-title>Social Modeling via Logic Programming in City of Gangsters,”</article-title>
          <source>Proc. AAAI Conf. Artif. Intell. Interact. Digit. Entertain.</source>
          , vol.
          <volume>17</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>220</fpage>
          -
          <lpage>226</lpage>
          , Oct.
          <year>2021</year>
          , doi: 10.1609/aiide.v17i1.
          <fpage>18912</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>J.</given-names>
            <surname>Orkin</surname>
          </string-name>
          , “
          <article-title>Three States and a Plan: The</article-title>
          <string-name>
            <surname>A.I. of F.E.A.R.</surname>
          </string-name>
          ,”
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>G.</given-names>
            <surname>Nelson</surname>
          </string-name>
          , Inform 7. (
          <year>2006</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>G.</given-names>
            <surname>Nelson</surname>
          </string-name>
          <article-title>, “NATURAL LANGUAGE, SEMANTIC ANALYSIS</article-title>
          AND INTERACTIVE FICTION,”
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>R.</given-names>
            <surname>Evans</surname>
          </string-name>
          and
          <string-name>
            <given-names>E.</given-names>
            <surname>Short</surname>
          </string-name>
          , “
          <string-name>
            <surname>Versu-A Simulationist Storytelling</surname>
            <given-names>System</given-names>
          </string-name>
          ,
          <source>” IEEE Trans. Comput. Intell. AI Games</source>
          , vol.
          <volume>6</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>113</fpage>
          -
          <lpage>130</lpage>
          , Jun.
          <year>2014</year>
          , doi: 10.1109/TCIAIG.
          <year>2013</year>
          .
          <volume>2287297</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>R. P.</given-names>
            <surname>Evans</surname>
          </string-name>
          and
          <string-name>
            <given-names>E.</given-names>
            <surname>Short</surname>
          </string-name>
          , “
          <article-title>The AI Architecture of Versu”</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>R.</given-names>
            <surname>Evans</surname>
          </string-name>
          , “
          <article-title>Introducing Exclusion Logic as a Deontic Logic,” in Deontic Logic in Computer Science</article-title>
          , vol.
          <volume>6181</volume>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Governatori</surname>
          </string-name>
          and G. Sartor, Eds.,
          <source>in Lecture Notes in Computer Science</source>
          , vol.
          <volume>6181</volume>
          . , Berlin, Heidelberg: Springer Berlin Heidelberg,
          <year>2010</year>
          , pp.
          <fpage>179</fpage>
          -
          <lpage>195</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>642</fpage>
          -14183-6_
          <fpage>14</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>S.</given-names>
            <surname>Mason</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Stagg</surname>
          </string-name>
          , and
          <string-name>
            <given-names>N.</given-names>
            <surname>Wardrip-Fruin</surname>
          </string-name>
          , “
          <article-title>Lume: a system for procedural story generation</article-title>
          ,”
          <source>in Proceedings of the 14th International Conference on the Foundations of Digital Games</source>
          , San Luis Obispo California USA: ACM, Aug.
          <year>2019</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>9</lpage>
          . doi:
          <volume>10</volume>
          .1145/3337722.3337759.
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>F. C. N.</given-names>
            <surname>Pereira</surname>
          </string-name>
          and
          <string-name>
            <given-names>D. H. D.</given-names>
            <surname>Warren</surname>
          </string-name>
          , “
          <article-title>Definite clause grammars for language analysis-A survey of the formalism and a comparison with augmented transition networks,” Artif</article-title>
          . Intell., vol.
          <volume>13</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>231</fpage>
          -
          <lpage>278</lpage>
          , May
          <year>1980</year>
          , doi: 10.1016/
          <fpage>0004</fpage>
          -
          <lpage>3702</lpage>
          (
          <issue>80</issue>
          )
          <fpage>90003</fpage>
          -
          <lpage>X</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>F.</given-names>
            <surname>Pereira</surname>
          </string-name>
          and
          <string-name>
            <given-names>S. M.</given-names>
            <surname>Shieber</surname>
          </string-name>
          , “Prolog and
          <string-name>
            <given-names>NaturalLanguage</given-names>
            <surname>Analysis</surname>
          </string-name>
          ,”
          <year>1987</year>
          . [Online]. Available: https://api.semanticscholar.org/CorpusID:
          <fpage>2642</fpage>
          <lpage>03475</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>S.</given-names>
            <surname>Lapeyrade</surname>
          </string-name>
          , “
          <article-title>Reasoning with Ontologies for Non-player Character's Decision-Making in Games,”</article-title>
          <source>Proc. AAAI Conf. Artif. Intell. Interact. Digit. Entertain.</source>
          , vol.
          <volume>18</volume>
          , no.
          <issue>1</issue>
          ,
          <string-name>
            <surname>Art</surname>
          </string-name>
          . no.
          <issue>1</issue>
          ,
          <string-name>
            <surname>Oct</surname>
          </string-name>
          .
          <year>2022</year>
          , doi: 10.1609/aiide.v18i1.
          <fpage>21980</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>T.</given-names>
            <surname>Schaul</surname>
          </string-name>
          , “
          <article-title>A video game description language for model-based or interactive learning,” in 2013 IEEE Conference on Computational Inteligence in Games (CIG), Niagara Falls</article-title>
          ,
          <string-name>
            <surname>ON</surname>
          </string-name>
          , Canada: IEEE, Aug.
          <year>2013</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          . doi:
          <volume>10</volume>
          .1109/CIG.
          <year>2013</year>
          .
          <volume>6633610</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>T. S.</given-names>
            <surname>Nielsen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. A. B.</given-names>
            <surname>Barros</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Togelius</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Nelson</surname>
          </string-name>
          , “
          <article-title>Towards generating arcade game rules with VGDL</article-title>
          ,” in
          <source>2015 IEEE Conference on Computational Intelligence and Games (CIG)</source>
          , Tainan: IEEE, Aug.
          <year>2015</year>
          , pp.
          <fpage>185</fpage>
          -
          <lpage>192</lpage>
          . doi:
          <volume>10</volume>
          .1109/CIG.
          <year>2015</year>
          .
          <volume>7317941</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Nelson</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Mateas</surname>
          </string-name>
          , “Towards Automated Game Design,” in
          <source>AI*IA</source>
          <year>2007</year>
          :
          <article-title>Artificial Intelligence</article-title>
          and
          <string-name>
            <surname>Human-Oriented</surname>
            <given-names>Computing</given-names>
          </string-name>
          , vol.
          <volume>4733</volume>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Basili</surname>
          </string-name>
          and M. T. Pazienza, Eds.,
          <source>in Lecture Notes in Computer Science</source>
          , vol.
          <volume>4733</volume>
          . , Berlin, Heidelberg: Springer Berlin Heidelberg,
          <year>2007</year>
          , pp.
          <fpage>626</fpage>
          -
          <lpage>637</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>540</fpage>
          -74782- 6_
          <fpage>54</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>J.</given-names>
            <surname>Levine</surname>
          </string-name>
          et al.,
          <source>“General Video Game Playing,” Schloss Dagstuhl - Leibniz-Zentrum für Informatik</source>
          ,
          <year>2013</year>
          , p.
          <volume>7</volume>
          <fpage>pages</fpage>
          ,
          <volume>336517</volume>
          bytes. doi:
          <volume>10</volume>
          .4230/DFU.VOL6.
          <volume>12191</volume>
          .77.
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [25]
          <string-name>
            <given-names>T.</given-names>
            <surname>Adams</surname>
          </string-name>
          and
          <string-name>
            <given-names>Z.</given-names>
            <surname>Adams</surname>
          </string-name>
          , Slaves to Armok:
          <article-title>God of Blood Chapter II: Dwarf Fortress</article-title>
          . (
          <year>2006</year>
          ). Bay 12 Games.
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          [26]
          <string-name>
            <given-names>T.</given-names>
            <surname>Sylvester</surname>
          </string-name>
          , RimWorld. (Oct.
          <year>2018</year>
          ). Ludeon Studios.
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          <source>[27] Caves of Qud. (Jul. 15</source>
          ,
          <year>2015</year>
          ).
          <article-title>Freehold Games, South Bend</article-title>
          , IN and Berkeley, CA.
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          [28]
          <string-name>
            <surname>“</surname>
            <given-names>MIARMY</given-names>
          </string-name>
          | Home.”
          <source>Accessed: Aug. 29</source>
          ,
          <year>2024</year>
          . [Online]. Available: https://www.miarmy.com/#/
        </mixed-citation>
      </ref>
      <ref id="ref29">
        <mixed-citation>
          <source>[29] “Massive Software.” Accessed: Aug. 29</source>
          ,
          <year>2024</year>
          . [Online]. Available: https://www.massivesoftware.com/
        </mixed-citation>
      </ref>
      <ref id="ref30">
        <mixed-citation>
          [30]
          <string-name>
            <surname>“Defuzz Process - Feishu Docs</surname>
          </string-name>
          .”
          <source>Accessed: Aug. 29</source>
          ,
          <year>2024</year>
          . [Online]. Available: https://basefount.feishu.cn/wiki/GhgswVsrfidf OVkmFcgc1XoYnKA
        </mixed-citation>
      </ref>
      <ref id="ref31">
        <mixed-citation>
          [31]
          <string-name>
            <given-names>W.</given-names>
            <surname>Shao</surname>
          </string-name>
          and
          <string-name>
            <given-names>D.</given-names>
            <surname>Terzopoulos</surname>
          </string-name>
          , “Autonomous pedestrians,
          <source>” Graph. Models</source>
          , vol.
          <volume>69</volume>
          , no.
          <issue>5-6</issue>
          , pp.
          <fpage>246</fpage>
          -
          <lpage>274</lpage>
          , Sep.
          <year>2007</year>
          , doi: 10.1016/j.gmod.
          <year>2007</year>
          .
          <volume>09</volume>
          .001.
        </mixed-citation>
      </ref>
      <ref id="ref32">
        <mixed-citation>
          [32]
          <string-name>
            <given-names>Q.</given-names>
            <surname>Yu</surname>
          </string-name>
          and
          <string-name>
            <given-names>D.</given-names>
            <surname>Terzopoulos</surname>
          </string-name>
          , “
          <article-title>A Decision Network Framework for the Behavioral Animation of Virtual Humans”</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref33">
        <mixed-citation>
          [33]
          <string-name>
            <given-names>W.</given-names>
            <surname>Wright</surname>
          </string-name>
          , The Sims.
          <article-title>(</article-title>
          <year>2000</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref34">
        <mixed-citation>
          [34]
          <string-name>
            <given-names>R.</given-names>
            <surname>Zubek</surname>
          </string-name>
          , “
          <article-title>Needs-based AI,” in Game Programming Gems 8</article-title>
          ,
          <string-name>
            <given-names>A. Lake.</given-names>
            ,
            <surname>Cengage</surname>
          </string-name>
          <string-name>
            <surname>Learning</surname>
          </string-name>
          , Florence,
          <string-name>
            <surname>KY</surname>
          </string-name>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref35">
        <mixed-citation>
          [35]
          <article-title>“Concurrent Interactions in The Sims 4</article-title>
          .” Accessed: Aug.
          <volume>30</volume>
          ,
          <year>2024</year>
          . [Online]. Available: https://gdcvault.com/play/1020190/Concurre nt
          <article-title>-Interactions-in-The-Sims</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref36">
        <mixed-citation>
          [36] “
          <article-title>Modeling Individual Personalities in The Sims 3</article-title>
          .” Accessed: Aug.
          <volume>29</volume>
          ,
          <year>2024</year>
          . [Online]. Available: https://www.gdcvault.com/play/1012450/Mo deling-Individual-
          <article-title>Personalities-in-The</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref37">
        <mixed-citation>
          [37]
          <string-name>
            <given-names>I.</given-names>
            <surname>Horswill</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Hill</surname>
          </string-name>
          , “Fast, Declarative,
          <source>Character Simulation Using Bottom-Up Logic Programming,” presented at the AIIDE Workshop on Experimental Artificial Intelligence in Games</source>
          , University of Utah, Utah, USA, Oct.
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref38">
        <mixed-citation>
          [38]
          <string-name>
            <given-names>I.</given-names>
            <surname>Horswill</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Hill</surname>
          </string-name>
          , “
          <article-title>Fast, Declarative, Character Simulation Using Bottom-Up Logic Programming,” in AIIDE 24, PersonActionAt</article-title>
          .Set(person, moving, false) .
          <article-title>If(ArrivedAtDestination); CompletedAction = Definition("…", person</article-title>
          , needType, delta).
          <source>Is( ActionTimer</source>
          .TimerFinished, PersonActionAt, ActionSatisfiesNeed[actionType, needType], LocationAdvertisements);
          <article-title>NeedByType.Set((person</article-title>
          , needType), need).
          <article-title>If( CompletedAction[person</article-title>
          , needType, delta],
          <source>NeedByType[person</source>
          , needType, needCol], UpdateNeed[needCol, delta, need]);
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>