ESL Examples

Dining Philosophers

Dining philosophers can be implemented in ESL so that each philosopher is an actor that needs to grab two chopsticks in order to eat. A co-ordination mechanism must be used in the form of data locks so that two chopsticks are grabbed at a time, otherwise the philosophers can deadlock and starve. ESL can turn an execution history into a filmstrip that is shown as a picture. Dragging the marker left and right moves forward and backward through the execution showing that no deadlock occurs.

Learn More

Pacman

Pacman is a game where the player controls the movement through a maze of the yellow pacman who wants to eat all the food, and where the system controls the ghosts who are seeking to eat the pacman. All the ghosts are actors who move independently of the pacman that is controlled by the user via the mouse. The ghosts implement a suitable strategy by inspecting the current state of the world and making a decision about their next move.

Learn More

A Road Junction

A road junction is controlled by a pair of traffic lights. Cars travel with greater frequency right to left and therefore they should be given priority. However, the lights should monitor the situation so that the queue from the left does not become too long. This example shows how ESL can be used to implement data monitors where the traffic lights are actors and monitors are actors that trigger changes based on the execution history of the junction queues.

Learn More

Shopping

ESL can be used to define a simulation. A shop wishes to try out different arrangements of of tills and assistants based on simulations of customer behaviour. Customers enter the shop and may seek help choosing goods before waiting at a queue to pay. If a customer waits too long for assistance or waits too long in a queue at a till then they will abandon their purchase and leave the shop. EDB is used to create a dashboard that shows the current state of each shopper during their visit to the shop.

Learn More

Segregation

Segregation is a classic multi-agent simulation showing what happens in a typed society when there is slight bias towards co-locating with agents of the same type. The society starts of with randomly distributed agents typed red and blue. If the location of an agent is surrounded by agents of a different type then they will move to a random unoccupied location. Given a slight bias towards moving from a location, the simulation shows that the society becomes segregated as shown in the resulting pattern on the right.

Learn More

Predator-Prey

Predator-prey is a typical multi-agent application with two types of agent. A predator is trying to catch a prey in a world that contains obstacles and places for the oprey to hide. In the example, the wolves are trying to catch the sheep who can hide behind rocks. ESL runs the scenario and builds a filmstrip of the states of the game. Once completed EDB displays the filmstrip that can be played forwards and back to see how the prey evaded capture (or not!).

Learn More

Collisions

ESL supports integration with Java so that third-party libraries such as graphics can easily be integrated. In addition, EDB knows about particular Java interfaces so that a Java graphics component can be created within an ESL application and then displayed as an EDB tab as shown on the right. The application represents balls as ESL actors that check the world for collisions against the walls and other actors. The application is controlled using Swing buttons that communicate with ESL when they are pressed.

Learn More

Graph Colouring

ESL is a functional language that makes it easy to represent structured data. In addition, EDB integrates with a number of external libraries for data visualisation. The example shows a graph-colouring algorithm that first colours the graph and then displays it using GraphViz.

Learn More

Map/Reduce

Map/Reduce is a good example of data processing that can be implemented using concurrent processes. Data from many different sources is processed in parallel and given a key. Data with the same keys are then merged and finally reduced to produce a result. The independence of the initial data and then of the keys provides scope for increasing the efficiency of producing the result.

Learn More

Termites!

Termites is a nice example of emergent behaviour. The forest contains randomly distributed twigs. Termites like twigs and seek them out by moving at random. A termite will only pick up a twig if it not bounded by other twigs. Once it has picked up a twig, a termite will move randomly until it finds a location that is surrounded by several twigs. Then the termite drops the twig and starts over. Over time, the termites tidy the forest and produce piles of twigs, even though they have no knowledge of their overall collaborative task.

Learn More