%eden
/* Here are some simple direct interactions with the model that illustrate
the way that the lift artefact can support 'human computing' activities */
/* THIS SECTION IS COMMENTED OUT:
locX = 0;
/* move X into the lift */
locX = _liftfloor;
/* move X out of the lift */
_liftfloor++;
/* move lift upwards one floor */
%donald
open3 = true # door 3 open
open3 = false # door 3 closed
button1 = true # button on floor 1 selected
button1 = false # button on floor 1 not selected
car1 = true # button 1 in lift car selected
car1 = false # button 1 in lift car not selected
%eden
/* scenario for lift confusion */
_liftfloor = 3;
locZ = 3;
_liftfloor--;
_button3=1;
locX = locY = locI = 1;
destX = destI = 4;
destY = 5;
_button1=1;
locZ = 3;
destZ = 1;
_liftfloor--;
_open1 = 1;
_button1 = 0;
locX = locY = locI = 0;
_open1 = 0;
_car4=1;
_car5=1;
_liftfloor++;
locZ = 2;
_liftfloor++;
_open3=1;
_button3 = 0;
locZ=1;
locX = 3;
_open3=0;
_liftfloor++;
_open4=1;
_car4 = 0;
locY=4;
_open4 = 0;
_liftfloor++;
_open5 = 1;
_car5 = 0;
locI=5;
_open5=0;
END OF COMMENTED OUT SECTION */
commentary = 1;
/* use initplay() to set up the lift initially */
proc initplay {
secs = 0;
eager();
locX = locY = locZ = locI = 7;
_open1 = _open2 = _open3 = _open4 = _open5 = 0;
_button1 = _button2 = _button3 = _button4 = _button5 = 0;
_car1 = car2 = _car3 = _car4 = _car5 =0;
secs is (commentary) ? 3 : 1;
}
procmacro playlift {
_liftfloor = 3;
if (commentary) {
writeln("\TRAVAILS IN A LIFT");
writeln("\nX, Y and I wait for lift\n");
}
locX = locY = locI = 1;
destX = destI = 4;
destY = 5;
if (commentary) {
writeln("Z arrives at floor 3 as lift passes floor");
writeln("Z wants to take the lift to floor 1\n");
}
locZ = 3;
destZ = 1;
_liftfloor--;
if (commentary)
writeln("Z calls lift to floor 3\n");
_button3=1;
if (commentary)
writeln("X calls lift to floor 1\n");
_button1=1;
if (commentary)
writeln("Lift arrives at floor 1, door opens\n");
_liftfloor--;
_open1 = 1;
_button1 = 0;
if (commentary)
writeln("X, Y and I enter the lift\n");
locX = locY = locI = 0;
if (commentary)
writeln("Door closes\n");
_open1 = 0;
if (commentary)
writeln("X selects floor 4\n");
_car4=1;
if (commentary) {
writeln("Y knows his room is directly above X's");
writeln("Instructs X to select floor 5");
writeln("I says: it's OK - I'm on the top floor\n");
}
_car5=1;
if (commentary)
writeln("Z tires of waiting, lift ascends\n");
_liftfloor++;
locZ = 2;
_liftfloor++;
if (commentary)
writeln("Lift stops at floor 3\n");
_open3=1;
_button3 = 0;
if (commentary) {
writeln("X can't see a floor number");
writeln("I says: This must be floor 4");
writeln("X gets out at floor 3\n");
}
locZ=1;
locX = 3;
_open3=0;
_liftfloor++;
if (commentary) {
writeln("Door opens: button 4 in lift is not lit");
writeln("Y and I don't notice this\n");
}
_open4=1;
_car4 = 0;
locY=4;
if (commentary) {
writeln("Y gets out because his room is above X's");
writeln("I is confused: is this the top floor?");
writeln("I sees the top button in lift still lit");
writeln("I, still confused, stays in the lift\n");
}
locZ = 7;
_open4 = 0;
_liftfloor++;
if (commentary) {
writeln("I gets out at floor 5");
writeln("I can't find his room on floor 5\n");
}
_open5 = 1;
_car5 = 0;
locI=5;
_open5=0;
if (commentary) {
writeln("X, Y and I are all at the wrong floor");
writeln("I meets Y on the stairs");
writeln("I meets X on floor 4\n");
}
}
proc delay {
para delaytime;
auto ft0, ft;
ft0 = ftime()[1];
ft = ft0;
while ((ft - ft0) < delaytime) {ft = ftime()[1]; eager();}
}
keylist is [_liftfloor,locX, locY, locZ, locI, _button1, _button2, _button3, _button4, _button5, _open1, _open2, _open3, _open4, _open5, _car1, _car2, _car3, _car4, _car5];
secs is (commentary) ? 3 : 1;
proc delayupdate: keylist
{
/* writeln("called"); */
delay(secs);
/* writeln("hello"); */
}
%donald
openshape roomY
within roomY {
shape room
room = trans(scale(~/box, ~/ratio), ~/wall + 180, ~/ceiling-~/ratio*100)
}
openshape roomI
within roomI {
shape room
room = trans(scale(~/box, ~/ratio), ~/wall + 2*180, ~/ceiling-~/ratio*200)
}
openshape roomX
within roomX {
shape room
room = trans(scale(~/box, ~/ratio), ~/wall + 180, ~/ceiling-~/ratio*200)
}
%scout
p2 = {510,510};
window liftvis = {
type: DONALD
box: [p1, p2]
pict: "simulation"
xmin: 20
ymin: 0
xmax: 1020
ymax: 1000
border: 1
sensitive: ON
};
%donald
label roomlabX, roomlabY, roomlabI
roomlabX = label ("X's room", {wall + 270, ceiling - ratio * 150})
roomlabY = label ("Y's room", {wall + 270, ceiling - ratio * 50})
roomlabI = label ("I's room", {wall + 450, ceiling - ratio * 150})
label rooflabY, rooflabI
rooflabY = label ("ROOF", {wall + 270, ceiling + ratio * 10})
rooflabI = label ("ROOF", {wall + 450, ceiling - ratio * 90})
%eden