Princess and the Pea
Example 173
★The main point here is that we need to figure out where the stack meets the floor:
"Princess and the Pea"
The Topmost Turret is a room. A mattress is a kind of supporter. A mattress is always enterable. A mattress is portable.
A large mattress is a mattress in the Turret. A medium mattress is a mattress in the Turret. A small mattress is a mattress in the Turret.
Instead of sleeping when the player is on a mattress (called the bed):
let the item be the bed;
while the holder of the item is not a room:
let the item be the holder of the item;
say "You can still feel something very uncomfortable under [the item]."
Instead of sleeping:
say "You can't sleep standing up!"
Instead of looking under a mattress, say "You scout around, but are unable to determine what's causing you this discomfort. If only your maid Winnie were here. She's very good at this."
Test me with "sleep / enter small / sleep / get up / get small / put small on medium / get on small / sleep / get up / g / get medium / put medium on large / get on small / look / sleep".
Test me with "sleep / enter small / sleep / get up / get small / put small on medium / get on small / sleep / get up / g / get medium / put medium on large / get on small / look / sleep".
Topmost Turret
You can see a large mattress, a medium mattress and a small mattress here.
>(Testing.)
>[1] sleep
You can't sleep standing up!
>[2] enter small
You get onto the small mattress.
>[3] sleep
You can still feel something very uncomfortable under the small mattress.
>[4] get up
You get off the small mattress.
Topmost Turret
You can see a large mattress, a medium mattress and a small mattress here.
>[5] get small
Taken.
>[6] put small on medium
You put the small mattress on the medium mattress.
>[7] get on small
(getting onto the medium mattress)
You get onto the small mattress.
>[8] sleep
You can still feel something very uncomfortable under the medium mattress.
>[9] get up
You get off the small mattress.
Topmost Turret (on the medium mattress)
You can see a large mattress here.
On the medium mattress you can see a small mattress.
>[10] g
You get off the medium mattress.
Topmost Turret
You can see a large mattress and a medium mattress (on which is a small mattress) here.
>[11] get medium
Taken.
>[12] put medium on large
You put the medium mattress on the large mattress.
>[13] get on small
(getting onto the large mattress)
(getting onto the medium mattress)
You get onto the small mattress.
>[14] look
Topmost Turret (on the small mattress) (on the medium mattress) (on the large mattress)
>[15] sleep
You can still feel something very uncomfortable under the large mattress.
You can see a large mattress, a medium mattress and a small mattress here.
>(Testing.)
>[1] sleep
You can't sleep standing up!
>[2] enter small
You get onto the small mattress.
>[3] sleep
You can still feel something very uncomfortable under the small mattress.
>[4] get up
You get off the small mattress.
Topmost Turret
You can see a large mattress, a medium mattress and a small mattress here.
>[5] get small
Taken.
>[6] put small on medium
You put the small mattress on the medium mattress.
>[7] get on small
(getting onto the medium mattress)
You get onto the small mattress.
>[8] sleep
You can still feel something very uncomfortable under the medium mattress.
>[9] get up
You get off the small mattress.
Topmost Turret (on the medium mattress)
You can see a large mattress here.
On the medium mattress you can see a small mattress.
>[10] g
You get off the medium mattress.
Topmost Turret
You can see a large mattress and a medium mattress (on which is a small mattress) here.
>[11] get medium
Taken.
>[12] put medium on large
You put the medium mattress on the large mattress.
>[13] get on small
(getting onto the large mattress)
(getting onto the medium mattress)
You get onto the small mattress.
>[14] look
Topmost Turret (on the small mattress) (on the medium mattress) (on the large mattress)
>[15] sleep
You can still feel something very uncomfortable under the large mattress.