Coronavirus (Covid-19): Latest updates and information
Skip to main content Skip to navigation

Lab 3 Exercises

This lab introduces the EDEN interpreter. The lab is based on a workshop given at the Constructionism 2010 conference in Paris in August 2010. In the workshop, we study a construal for human solving of Sudoku puzzles. It is not difficult to write a program to solve Sudoku puzzles, but much harder to guarantee to produce solutions that are intelligible to the human solver at every step. The Sudoku construal has been developed with a broad exploration of what is involved in solving a Sudoku puzzle: what the human solver observes, what sort of dependencies are characteristic of puzzle solving, and what agency the human solver exercises in understanding a puzzle. One by-product of this development was the creation of a conventional program to support the solution of a Sudoku puzzle via a 'colour Sudoku' variant.

To understand the entire construction of the Sudoku construal in detail is a complex task. The construal comprises some five thousand observables, was developed by several model-builders, and uses several 'definitive notations', including Eden, Scout and Eddi. One of the exercises entails adding additional observables in the line drawing notation Donald.  Scout, Eddi and Donald are concerned with describing screen layout, relational tables and line drawings respectively. In these notations there is essentially just one kind of statement: a definition using the '=' symbol which establishes a spreadsheet-style dependency. All three notations are translated into Eden, the definitive notation at the core of the EDEN interpreter, which allows relationships between scalar types, primarily integers, floats and strings to be formulated using list structures and functions specified in a simple C-like programming language.  In this lab, your use of these notations will be 'scaffolded' via the Empirical Modelling Presentation Environment (EMPE) developed by Antony Harfield, so that you will not need to learn the somewhat tricky syntax needed to integrate the many different kinds of observable.

Getting Started with EDEN

We begin with some preliminary generalities about the use of definitive notations to represent state.

A definitive script is a set of definitions (in most contexts 'set' is actually more appropriate than 'script', which suggests an activity rather than a description, but the term "definitive script" has been used extensively in EM publications). The LHS of a definition is an observable, and the definition expresses a dependency amongst observables. Informally, when we redefine the value of one observable the values of any observable defined in terms of this observable are 'instantly' updated. (What 'instantly' means here is a subtle issue to be explored in the module.) The observables are of different types, each associated with a definitive notation used to formulate the formulae that define values. Different definitive notations have different kinds of values and operators to express one value in terms of others.

Exercise 1: Using the EDEN interpreter to explore or develop a definitive script

There is no counterpart of the Cadence (or Java) IDE: you need to set up your own environment for creating EDEN models. Typically, you will have a different directory for each model, and this may comprise many files.The pattern for organising work on an EDEN model commended here is one that can be applied quite generally to model-building and exploration.

First create a personal directory cs405practical for your CS405 practical work. Copy the contents of the directory /dcs/emp/empublic/teaching/cs405/lab3 into your cs405practical directory. On Linux, you can do this by making cs405practical your current directory and executing the command:

cp -r /dcs/emp/empublic/teaching/cs405/lab3 .

(NB note the ' .'  at the end of this command - and the ' ' before the '.'!) Within your cs405practical directory you should now have a ConstructionismWS subdirectory which contains the EDEN files for the Sudoku construal which is the main subject of the lab.  It also contains a much smaller directory entitled cabinetdigit which has the EDEN specification for a visual pun that will be discussed in the next lecture. Enter the cabinetdigit directory and type the following command within it:


This should bring up the input window for the tkeden interpreter. Now select Execute from the File menu on the tkeden-1.73 Input Window, select the file name Run.e from the list of contents of the directory and double click on it. You should get a line drawing display.

Now use your favourite editor to inspect the contents of the files Run.e and eight.d (you can do this by pressing Alt+F2 and invoking the editor in the command box). The file eight.d is the Donald source of the line drawing on display.

Exercise 1A: By inspecting the contents of the file eight.d, figure out which of the line drawings represents a digit in an LED display, and which is intended to represent the floorplan of a filing cabinet that is currently fully open.

In the spirit of Empirical Modelling, you should address Exercise 1A (a simple example of construing) by observation and experiment. Look at the definitions of observables in the eight.d script, identify the dependencies between them, and explore the consequences of redefining observables. If you need help to understand the syntax and semantics of Donald, consult the 'Donald quick reference' under the Help tab on the tkeden Input Window.

Exercise 1B: See if you can find which observables you should redefine in order: (a) to change the digit being displayed; (b) to change the dimensions of the filing cabinet; (c) to open and close the filing cabinet drawer; (d) to simulate an LED in which one of the display components is broken.

Exercise 1C: Observe what happens if you pull the drawer out too far, and note that this is inconsistent with the intended construal. See if you can find a simple way to fix this.

Record your solution / attempted solution to exercise C in a separate file called fixdrawer.e within your cabinetdigit directory. You can build up this file interactively by entering definitions into the EDEN interpreter in a speculative exploratory fashion until you are satisfied that you are making progress and preserving only those redefinitions that prove useful and instructive. If you want to annotate your file, you can observe the comment convention "##..." illustrated in file eight.d. If you forget to update fixdrawer.e in the excitement of interacting with EDEN, you can review what you have done by checking the View History item under the View tab on the EDEN input menu. It is also useful to know that you can save the Command History in order to reconstruct an interactive session, and that the system automatically saves the Command History on termination of your session. Saved Command History files can be found in your home directory and have filenames with the prefix .tkeden-history.

The Constructionism 2010 workshop

There were four sessions in the Construction 2010 workshop. These can be accessed within the ConstructionismWS subdirectory. The first session illustrated the general principles of modelling with dependency by developing a Sudoku grid within a spreadsheet application, such as Excel. The focus for the rest of today's lab is on the second session. The counterpart of the Run.e file for this second session is the file entitled Part2-IntroToEM.eden. You can execute this file directly by invoking the command:

~empublic/bin/tkeden Part2-IntroToEM.eden

Somewhat alarmingly, the tkeden Input Window will disappear from the display when this input has been accepted: this is because your routine interaction with the Sudoku construal takes place in the EMPE environment, which will take some time to load and initialise. The pattern for your interaction should be relatively easy to follow within the environment. The buttons Expand/Hide, Next and Previous buttons at the bottom of the display enable you to display/hide the construal display and to move between slides in the presentation. Where you encounter EDEN code embedded in the text of a slide, you have the option of executing it directly, or copying it into the (pseudo) Input Window within the EMPE, where you can edit it as you see fit. Note that the pseudo Input Window is intended for interpreting relatively simple commands such as appear in the slides in the EMPE: it is not designed for the most general forms of EDEN input - for that you need to use the real EDEN input window (see the supplementary notes).

Whereas the first part of the lab introduced you to the working environment that is appropriate for developing EDEN construals, studying the Sudoku construal in the EMPE helps to frame the appropriate mindset to accompany such development. The aim is to consolidate your understanding of the concepts of observables, dependencies and agents, and to acquaint you with what it feels like to develop a mature EM construal - a process which ideally involves an extended period of thoughtful interaction and interpretation: learning by construction.