Abstract
This article describes a software tool called “Pursuit” that is intended to be used for both research and teaching on the topic of optimal foraging theory. The tool provides a dynamic graphical and auditory interface in which users encounter different prey animals and then must decide whether to pursue or ignore the encountered prey. Based on the characteristics of the prey in the foraging environment and the decisions of the player, each user harvests a set of prey per round and achieves a corresponding foraging return rate. Administrators of Pursuit specify the environmental parameters that determine what prey users will encounter. All environmental parameters and user decisions are tracked and logged for analysis. We created this tool for laboratory experiments, but we believe Pursuit could also be an engaging and effective teaching tool, whereby students adopt the role of forager, and through such play, experience a simulated foraging context and learn about foraging theory. Pursuit is freely available and can run on any platform that supports Java, including Mac OS, Windows, and Linux.
Introduction
Optimal foraging theory (OFT) is the evolutionary modeling of optimal decision making related to food acquisition (Stephens & Krebs, 1986). Classic problems addressed by OFT include allocation of time to different food patches (patch choice models) and choice of which food types to harvest and which to ignore (diet breadth models). These models can be used to make predictions about the behavior of any animal that makes decisions about where and what to eat. Researchers have employed these models in the analysis of human foraging behavior (Bird, Smith, & Bird, 2001; Hill, Kaplan, Hawkes, & Hurtado, 1987; Jones, Bird, & Bird, 2013; Koster, 2008; Sosis, 2002; Wood & Marlowe, 2014). Such studies have successfully predicted human behavior with simple assumptions of adaptive decision making, and especially when such predictions fail, helped illuminate the additional factors that influence foraging behavior. OFT is an active area of research in behavioral ecology, with new ideas continually being developed and tested with field observations, controlled experiments, and computer simulations (e.g., Alós, Palmer, & Arlinghaus, 2012; Bartumeus, Raposo, Viswanathan, & da Luz, 2013; Doniol-Valcroze, Lesage, Giard, & Michaud, 2011; Jensen et al., 2012; Watanabe, Ito, & Takahashi, 2014).
Several researchers have investigated how players interact with simulated environments performing foraging-related tasks. Wilke, Hutchinson, Todd, and Czienskowski (2009) developed a simulation in which players search for information; specifically, players were tasked with identifying anagrams in “patches” of scrambled letters. Mata, Wilke, and Czienskowski (2009) and Wolfe (2012) also simulated patch choice scenarios, in which players fished in ponds, or picked from berry bushes, respectively. All these studies examined whether various predictions derived from the patch choice model (Charnov, 1976) accorded with players’ actual decisions to stay in patches or move to new patches. A number of researchers have created simulations to study prey choice, but typically both the behavior of the forager and features of the environment are determined in the simulation (e.g., Hirvonen, Ranta, Rita, & Peuhkuri, 1999; Turner, Wu, Romme, & Wallace, 1993; Winterhalder, 1986;). By contrast, we intend Pursuit to be used with human players making prey choice decisions within simulated environments. Our system does not preclude the possibility that human players might adopt specific foraging “rules” such as might otherwise be programmed into a wholly software-based approach to foraging simulation.
Features of Pursuit
Software Design and Algorithm Details
Pursuit is written in Java and PHP. The graphics and sound rely upon the JavaFX 2 application programming interface (Pawlan, 2013). The program is free and can be downloaded from evolutionaryanthropology.com/pursuit. The administrator of Pursuit (i.e., the researcher or instructor) modifies the environment that players will experience by changing values specified in an environment file. As its name suggests, an environment file represents a single environment that users forage within. The environment file is a simple comma-delimited text file than can be opened, edited, or renamed using a spreadsheet or text editor application. An environment file includes a header row specifying the names of all prey-specific parameters. Each subsequent row of the environment file corresponds to a prey species in the foraging environment. A sample environment file can be downloaded from evolutionaryanthropology.com/pursuit. This example environment file is not meant to represent the parameters of any particular foraging environment, and administrators are encouraged to edit the file to suite their desired specifications. By editing this environment file, administrators can make a simulation fit the specifications of a desired foraging environment.
By editing an environment file, administrators can change all of the following parameters for each prey species: (1) mean prey weight in pounds, (2) standard deviation of prey weight in pounds, (3) mean number encountered per minute, (4) probability of being killed if pursued, (5) mean duration of successful pursuit in seconds, (6) standard deviation of the duration of a successful pursuit in seconds, (7) mean duration of a failed pursuit in seconds, (8) standard deviation of the duration of a failed pursuit in seconds, (9) mean duration of processing time in seconds, and (10) standard deviation of duration of processing time in seconds.
The system uses the parameters supplied in the environment file to stochastically construct the prey items that the player will encounter. For an individual prey, the system calculates prey’s weight, duration of pursuit, and duration of processing by sampling from normal distributions with mean and standard deviations as specified in the environment file for that prey species. The expected (mean) values associated with each prey species also determine what the optimal prey set is. The optimal prey set is essentially a list of prey species. If the user always pursues the prey species in the optimal set and always ignores the other prey species, then the user is expected to maximize their long-term rate of acquiring prey per second spent in game play (e.g., kg prey acquired/second in game play). The system uses the algorithm described by Stephens and Krebs (1986, p. 17) to calculate the optimal prey set. Two notes about this algorithm are in order. First, the algorithm assumes that foragers have complete information about expected prey encounter rates, handling costs, and harvest yields for each prey specified in the environment file. Second, this model employs only the expected mean values for each prey type’s encounter rates, handling times, and yields and does not consider the influence that stochastic variation around these expected values might have in prey choice decisions (Stephens & Charnov, 1982). The system calculates the optimal prey set in the background before game play begins, and the log of game activity notes whether each encountered prey is in that optimal set or not. The optimal prey set is not made known to the user during game play.
For each round and for each prey type, the system calculates the maximum number of prey to potentially be encountered (NE) by sampling from a binomial distribution ∼ Bin (n, p), with n = round length in seconds, and p = that prey’s encounter probability per second. Simultaneous encounters with two prey types are not permitted. Once NE is known, the system then determines the time that each encounter will take place by randomly distributing each encounter across the length of the round (LR) in seconds. For each round of play, the system resamples from the environment file, constructs new individual prey items, and schedules their encounters.
Encounters, Pursuits, and Kills
Potential prey encounters are scheduled across LR seconds, but in practice, the actual number of prey encountered is determined by the user’s decisions during game play, and how much time the user spends in search. During each second of game play, the user’s time is spent in one of three states: searching (S), encountering (E), or handling (H), such that LR = S+E+H. Prey encounters only occur when users are in the searching state. When players are not in the searching state, the system suppresses encounters that would otherwise have occurred.
Whether a prey is killed or not when pursued is determined by selecting a single random value from a uniform distribution between 0 and 1, and testing if that value is less than or equal to that prey’s probability of being killed if pursued (parameter #4 in the environment file).
It is fairly likely that the user will not encounter some prey items specified in an environment file during a single round, especially during short rounds or with prey that have low probabilities of encounter. As with any sampling process, the shorter the rounds, and the lower the prey encounter rates, the greater the chance a user will not encounter a prey item described in the environment file. While not all prey species in the environment may be encountered during each round, the system calculates the optimal prey set for the player considering all of the prey species in the environment. We think this is a reasonable mimic of real-world foraging experiences, in which foragers cannot expect to encounter all potential prey species that exist in an environment in one session of foraging.
Foragers who spend more time handling prey, rather than searching, will experience and learn of handling costs but will have less encounters and gain less information about encounter rates. Gaining information about these two types of environmental parameters generally trade off against one another (Stephens & Charnov, 1982). Disjunctions between predicted player behavior based on the assumption of complete information and actual player behavior when naively foraging in a landscape are to be expected. We suggest that studying the learning process involved could be one interesting research and teaching application of our tool.
User Experience
Pursuit is distributed as a java archive file called “Pursuit.jar,” approximately 9 MB in size. A Java runtime environment (JRE) must be installed on the user’s computer to run Pursuit. Security settings on player computers may need to be adjusted to allow the execution of applications from third party or independent developers. Once a JRE is installed, double clicking the file will start Pursuit. The splash screen that appears gives users the option of starting or quitting. When the start button is selected, the user is asked to input their name, age, sex, the duration of each round, the number of rounds to be played, and to browse to the location of the environment file. All the information that players input here will be viewable by other users of Pursuit, and so if a player wishes to remain anonymous, we suggest they use a game alias rather than provide their given name. Alternatively, administrators could assign players with unique IDs that they use during game play.
A sample environment file, called “neotropical.env,” is available for download from evolutionaryanthropology.com/pursuit. This sample environment file includes 20 characteristic mammal, bird, and reptile species found in the new world tropics. By editing the values in this environment file, administrators can build environments to their desired specifications. It would be good practice for administrators to rename an environment file when its parameters have been changed, for the sake of tracking game play and subsequent analysis. When the user selects an environment file, it is loaded into the system, and the simulation begins. When the user is in the search state, a screen like that shown in Figure 1 is displayed:

A search scene.
In the upper left-hand corner, the time in seconds that the user has spent in the current round is displayed. In the lower right-hand corner, the state of the forager is displayed, in this case, “Searching.” Recordings of ambient rainforest sounds are played by the system to build a sense of immersion. When prey are encountered, an audio signal signifies the encounter, and a view of the prey like that in Figure 2 is displayed:

An encounter scene.
In Figure 2, a spider monkey has been encountered. The user has the option to ignore the prey or to pursue it. To pursue the prey, the user must click upon the image of the prey. To ignore an encountered prey, the user can click the button that appears on the center right of the screen, in this case, labeled “ignore spider monkey.” The user has 3 s to make a decision whether to ignore or pursue an encountered prey. In the upper center of the image, in red, the system counts down the time remaining to make this decision. If 3 s pass without a decision, the prey will escape. If the user has decided to pursue a prey, the pursuit will result in a period of time spent in pursuit, after which the prey will either escape or be killed.
If a prey is killed, then another characteristic audio signal is played, the prey item rotates 180° and is framed by a red halo. The user then spends time processing the prey. After a prey item has been processed, it then appears in the upper right-hand portion of the screen, with its body mass displayed in white text.
The displayed numeric body mass of successfully harvested prey is critical information that users should be instructed to attend to. Following conventions in studies of optimal foraging, the body mass of harvested prey per unit time spent foraging is the customary measure by which player behavior will usually be tracked and evaluated. When designing the user interface, we endeavored to scale the images of encountered prey items in accordance with the species’ average body masses in nature, but this was done in an artistic rather than quantitative manner. It is also important to note that if the average body mass of a prey type is changed in the environment file, the images that represent the prey do not change in size but remain fixed.
Cycling through rounds
At the end of a round of play, a small window displays a tally of the prey harvested, their body weights, and the total mass of prey harvested by the user during that round. The user is given the option to continue to the next round or to quit.
Ending the game
The user is able to play one or more rounds in a given game. At the end of the game (or when the user terminates play between planned rounds), the system generates an output file that includes a log of the prey that the user has encountered, the user’s decisions to pursue each prey or not, and the outcome of each pursuit. This log file is a simple comma delimited text file, and it is saved locally.
The player log lists nineteen variables for each encounter, as described in Table 1.
Parameters Saved in Pursuit Log Files.
At the end of a game, using Hypertext Transfer Protocol (HTTP), the system also sends a copy of the user’s environment file and the log of the user’s decisions to a MySQL database server hosted at evolutionaryanthropology.com. The user must be connected to the Internet for this upload to occur. The uploading of user files to the central server enables players or administrators to easily view logs of game play and player environments, for the sake of research or teaching.
Analysis of Prey Choice Decisions
We built Pursuit in order to carry out research on simulated prey choice decisions under varying laboratory conditions. We therefore built this system with researchers as our primary audience. We built the system to permit maximum flexibility in the simulated environmental parameters, which is useful for analyzing prey choice decisions under varying conditions. To analyze prey choice decisions, the analyst needs to reference both the set of prey species available in the player’s environment and the record of player decisions in that environment. These two sets of information are encoded in two separate files: the environment file and the log of player decisions. From the log of player decisions, using simple software like Excel, researchers can easily calculate the fraction of times that users pursued particular prey species or calculate users’ foraging return rates within and between rounds of play. These analyses can be carried out using local copies of the environment files and player logs that exist on a players’ computers or by visiting www.evolutionaryanthropology.com/pursuit, where all the environment files and logs of player behavior that have been uploaded can be browsed and copied for analysis.
Figure 3 displays the data produced by a user who played two trials, composed of 10 rounds each, with each round lasting 180 s. In the first trial, the user pursued only three species, all of which were small game: paca, armadillo, and coati. In the second trial, the user focused on pursuing three different species, all of which were large game: tapir, white-lipped peccary, and collared peccary. Line graphs are an effective way to represent the resulting data.

Data produced by a player employing a large game focused strategy and a small game focused strategy in the same foraging environment. The player log and environment file from this simulation are viewable at evolutionaryanthropology.com/pursuit under game ID 6915**.
In the data presented in Figure 3, the average return for the player when focusing on small game was 22.9 kg per round, while the large-game-focused strategy produced on average 37.3 kg per round. On this measure, the large game focused strategy yielded a higher average foraging return rate. The small-game-focused strategy produced a lower average return, but it had one advantage: There were no rounds in which the user did not kill at least one animal. The large game focused strategy had a higher mean return rate but resulted in successful kills in only 4 of the 10 rounds played and thus carried a higher risk of failure per round. How foragers perceive or incorporate risk into their prey choice decisions is an active area of research in behavioral ecology (e.g., Jones et al., 2013) and Pursuit could be used to study this topic.
Teaching About Optimization and Foraging Theory
Since all organisms must acquire food energy to survive, the assumption that organisms will be selected to efficiently harvest food energy is consistent with basic principles of evolution by natural selection. Optimization theory has been widely used in the evolutionary analysis of decision making and behavior, and students being introduced to such theory are commonly given reviews of optimal foraging theory and specifically introduced to diet breadth modeling. We think playing Pursuit as a lab or take-home exercise would fit nicely into such a curriculum, and that students who played Pursuit would be better equipped to appreciate both the mathematical formalities of modeling, and the empirical realities of decision making. Students could play several rounds of the game and then calculate their own foraging return rates or those of their peers. How did such rates change through time? Why so? Students could discuss their decision-making processes in reference to the assumptions being made by the diet breadth model and discuss more generally the challenges of modeling behavior. We have found that students’ efficiency at foraging usually increases over time, especially when provided with incentives. Player tournaments with token rewards could be one way to actively engage students in such a learning process. We hope to release further versions of Pursuit and provide more foraging environments (e.g., savannah, tundra, etc.). In our teaching, in courses about human ecology and human behavioral ecology, students have reacted favorably to playing Pursuit as a lab exercise, and we welcome its more broad use.
Footnotes
Acknowledgments
The development of Pursuit was made possible by Jeremy Koster, who conceived of the idea for this simulation tool and provided support during its development. We thank Carla Wood Mallol for her help designing and evaluating Pursuit.
Cartoon-bing-low.wav (used to indicate for prey escape), downloaded from
, created by user Kantouth.
Declaration of Conflicting Interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: The National Science Foundation (#1062879).
