A dictionary for the shopping-with-stock construal
randomIndex | A seed for random number selection that can be used to ensure repeatability |
price[1-6] | The prices of the six items for sale |
width* (in comments) | The diameters of the 8 coins - width20 is the width of a 20p piece etc |
ix[1-8] | The indices of the eight coins in the purse in the list of all coins [1,2,5,10,20,50,100,200] |
coinsselected | An array of 8 boolean values to record which of the coins in the purse have been selected |
itemsselected | An array of 6 integer values to record how many instances of each of the items have been selected |
imagelocation | The web address at which the images being retrieved are stored |
scaleWidth | The scaling factor that is used in specifying the screen layout |
Observables defined by dependency
item[1-6] | The six items that are for sale, each recorded as a pair comprising a name and price |
forsale | The complete list of items that are for sale, recorded as [item1, item2, .... , item6] |
items | The list comprising the six items that are for sale, each recorded as a pair comprising a name and price |
basket | The list of names of items that have been selected for purchase |
bill | The total cost of the items that have been selected for purchase |
coinlist | The list of coins, in which each denomination is recorded as an integer number of pence |
purse | The coins that the customer has available to spend |
spendingmoney | The total amount of money that the customer has to spend |
haveenoughmoney | Whether or not the cost of the currently selected items exceeds the total amount of money the customer has to spend |
shortfall | How far the cost of the currently selected items exceeds the total amount of money the customer has to spend or zero if the customer has enough money |
tendered | The amount of money the customer is offering for the items selected |
change | The amount of change the customer would be entitled to, or zero if the customer hasn't offered enough money |
coin[1-8]pic | The images used to depict the eight denominations of coin that can appear on the display |
item[1-6]pic | The images used to depict each of the six items selected (where appropriate) on the display |
item[1-6]pic0 | The images used to depict each of the six items for sale on the display |
coin[1-8]text | The text used to display the denominations of the coins belonging to the customer |
item[1-6]numtext | The text used to display the number of instances of each item selected by the customer |
item[1-6]text | The text used to display the price of each item for sale |
PurseContentText | The text used to designate the content of the purse on the display |
CoinsInHandText | The text used to designate the coins tendered on the display |
BasketContentText | The text used to designate the content of the basket on the display |
ItemsForSaleText | The text used to designate the items for sale on the display |
picture | The built-in observable used to specify the list of drawable components on the display |
optpic[1-6] | The optional drawable components used to display the items that have been selected by the customer |
The following user-defined functions are used to express dependency relationships:
listitems | Making a list of the selected items |
costitems | Calculating the cost of the selected items |
moneyinhand | Calculating the amount of money tendered |
coindisplay | Determining which image to display given an index of a coin in the list of coins |
listcoins | Making a list of the tendered coins |
itemdisplay | Determining which image to display given an index of an item in the list of items for sale |
denomdisplay | Determining what text to display given an index of a coin in the list of coins |
displaycurrency | Determining how to display a given quantity of money that is expressed in pounds |
pricedisplay | Determining what price to display given an index of an item in the list of items for sale |
mkstr | Displaying a non-zero integer as a string whilst displaying zero by the empty string |
The following agents are used to perform actions:
coin[1-8]picMove | The mouse click actions for selecting/deselecting coins |
item[1-6]picMove | The mouse click actions for returning selected items |
item[1-6]pic0Move | The mouse click actions for selecting items |