# Index to The Sudoku Experience

There are two introductory models and five workshops. The pages of the mini-books in these are as indexed below. Some code extracts and exercises that presented on these pages are included in the index. These are the appropriate focus for technical study of Empirical Modelling using EDEN.

** General introduction to the Sudoku script **

- Contemplating and Computing
- Many contexts for observation
- How observables are implemented in the model
- Implementing simple solving rules
- A simple solving strategy
- Implementing the simple solving strategy

%eddi ## NB remember to remove the invisible space ## from "%eddi " when cutting and pasting trueall = all; all !! [4];

- Manual implementation of the simple solving rules ...
- Redefining and observing observable values
%eden currdigit = 4; ?currdigit; %eddi ?diffcounttable;

- The automated checking process
- Acknowledgements
- Technical addendum

**Introduction to the Web EDEN environment**

- Introducing the Web-EDEN environment
- By way of practical preparation 1 ...
%eden a = 199; b = 20; c = 1; d is b*4 + 6*c; e is a - d; f = 336; g is float(a)/f *100; writeln(e); writeln(g);

- By way of practical preparation 2 ...
- By way of practical preparation 3 ...
- Meaning in Empirical Modelling
- By way of mental preparation ...
- Modelling in practice
- Tracking states of mind ...
- More about way the model was built ...
- Orientation on the EM Sudoku model
- A helpful analogy
- Interpreting interaction with the model
b_3 = 5; ## change cell value b_1 = 4; ## alter the given puzzle background_bgcolour="green"; ## redesign the grid display

- How we shall use the model
- Variables and observables ...
- Useful additional features ...
- Simple commands you can try out for testing purposes
%eden writeln(b2); writeln(b_2); ?b2; ## returns a string consisting of a single character ?b_2; ## returns the integer value of a digit b_2 = 3;

**Workshop 2A**

- Basic mechanics of Empirical Modelling
- Guidelines for walkers
- Observables in the Sudoku model
- Modifying the display
%scout screen = <A1/B1>;

**Exercise 1:**A basic exercise in Empirical Modelling- The six example Scout redefinitions for Exercise 1
`B1_bgcolour = A1_fgcolour; B1_fgcolour = A1_bgcolour; A1_bgcolour = "white";`

`a1 = b1; b1 = "2"; ## a1 and b1 are of type string - hence the quotes around 2`

`A1_bgcolour = B1_bgcolour;`

`A1_fgcolour = B1_fgcolour;`

`A1_bgcolour = if (a1=="2") then "red" else B1_bgcolour endif; ## '==' stands for 'equals'`

`A1_fgcolour = "#38c755";`

- Lessons to be learnt from Exercise 1
- Other kinds of observable
- Restoring the screen
- Observing rows, columns and regions in the grid
- Tables in Eddi
- Some basic Eddi operations ...
- Table observables defined by formulae ...
- Some sample queries to illustrate the : and % operations
`?sudokugrid : digit>0;`

`?sudokugrid : colix==4 % rowix, digit;`

`?sudokugrid : colix==4 % digit;`

`?sudokugrid : status == 1 : digit == 6 % rowix, colix;`

`?sudokugrid : status == 1 : colix == 4 % rowix;`

- Further table operators and definitions ...
**Exercise 2**- What information does the following Eddi query return?
%eddi ?all - sudokugrid : colix==4 % digit;

- How would you formulate a query to return the digits not in row 6 and not in column 7?
- What does the observable rowband1 describe? Why is the definition of rowband1 on the previous page not a very good one?
- Make your own definition of a new table called top3rows that defines the same result as rowband1 but uses a formula that contains '+' rather than '.'. Do you in fact need to use either '+' or '.'?
- Interpret the definition of the observable possdig12 on the previous page. Why doesn't it always exactly correspond to "the set of plausible digits for the cell B1"?

- What information does the following Eddi query return?
- What we've illustrated about the Sudoku model
- Putting it all together

**Workshop 2B**

- Practical exercises in Empirical Modelling
**Exercise 1**: Adapt the Sudoku grid to make a simple form of electronic blackboard on which to demonstrate primary school arithmetic.- Helpful pointers
- A note on definition and assignment
- Arithmetic in Eden
- The classical computer programming problem
- Further help for Exercise 1
- Exercises in converting between coordinate systems
- The row-col and region coordinates for the Sudoku grid
**Exercise 2**: Devise Eden definitions to convert from row-col to region coordinates.**Exercise 3**: Devise Eden definitions to convert from region to row-col coordinates.- Further guidance for Exercises 2 and 3
- Answers to Exercises 2 and 3

** Workshop 2C **

- Task 2C: Building colour variations of sudoku
- Colouring cells
- Making colours depend on cell contents
- Operators you can define yourself
- Using plausibles for colouring
- Recreating colour sudoku
- Extensions to colour sudoku

** Workshop 3A **

- Observables and agency in the EM Sudoku model
- Revisiting the model
- A reminder
**Exercise 1**: Agency in the EM Sudoku model- Programmed agency
**Exercise 2**: More agency in the EM Sudoku model- Hint for Exercise 2
**Exercise 3**Fix your attention on one of the possible Sudoku puzzles only. For each of the following redefinitions that can be introduced into the Input Window, say whether or not it can be made through the display and button interface (i.e. without using the Input Window). (The e4_focus observable says whether or not the cell E4 is selected.)

1. a_1 = 8; 2. b_1 = 7; 3. c_1 = 10; 4. d1 = ""; 5. a_1 is i_9; 6. e4_focus = 1

- More about Exercise 3
- Answer to Exercise 3
- To summarise ...
- Thinking about solving Sudoku
- Automating simple steps in solving a Sudoku puzzle
The simplest deductions we can make when solving a Sudoku puzzle involve checking (a) whether there is only one plausible digit for a cell, and checking (b) whether there is only one location for a particular digit in a given row, column or region. Imagine that we are focusing on one row r of the puzzle, and that we can see the number of plausible digits that there are for each cell in that row. Now suppose that one of the digits x that we need in order to complete the row is discounted, and that we recalculate the number of plausible digits there are for each cell in the row.

**Exercise 4**Explain how you may be able to determine where to put the digit x in row r according to criterion (a) and (b) by inspecting the values of the counts for the row r before and after we discount the digit x

- Hint for Exercise 4
- Automating our technique
- Interpreting the definition ...
- Automating the checks for (a) and (b)
- Rough and ready automation of the manual procedure
- Using the Sudoku model to record hidden knowledge
- An illustrative example
- Adding "hidden" information to the model

**Workshop 3B**

- Applying Empirical Modelling in practice
- Cricketing concepts revisited
- Adding agency to the cricket model
**Exercise 1**Before reading on, think about what needs to change when a single ball is played by a batsman. Take a few minutes to reflect on what single observable can be used to account for the changes to all of these observables.

- Extending the model
- How the observables depend on the scoring record
- An Eden function to relate a, b and c to the scoring record
- The extended scoring model
- The dynamic scoring model
- Using the model
- Automating human agency
- A computer agent to update the scoreboard
- An agent to assist Sudoku solving
**Exercise 2**The following template defines a suitable Eden agent that will insert a digit in the cell D1 when there is no other candidate for that cell:proc D1_checkonedigit: ... { if ((...) && (...) ) ## the && stands for 'and' d_1 = possdigit14[1][1]; }

Your task is to supply:- the missing observable that is required to trigger the update
- the missing conditions that have to be substituted in the brackets after the if

- Hints on Exercise 2
- Making use of agents in Sudoku solving
- Towards more advanced solving methods
- Automating patterns of reasoning
**Exercise 3**Why is it so inefficient to directly imitate the check on counts of plausibles that we might carry out for each digit, and each row, column and region in turn?

- Towards more efficient automation
- Step 1: Computing the effect of changing 'all' on the plausible counts for all cells
- Displaying the counts of plausibles before and after changing 'all'
- Deciding whether a given digit has just one place in a row
- Putting it all together
- Displaying the result