STATIC DISCLAIMER: All the stuff in here is purely my opinions, and they tend to change depending on what mood I'm in. If you're going to get bitter if I say something about you that you don't like, then maybe don't read. I avoid using names as much as possible, and would request that people who know me do the same in their comments. Basically, I often vent my frustrations on here, so if you happen to be someone who frustrates me, expect to read a description of someone very much like you in here!

Wednesday, March 22, 2006

A Stateful Thunderbox

It's funny how in life there are things that everyone is aware of, but people generally don't talk about. Often the reason no one talks about it because they feel like they're a little unusual for thinking a particular way, when really everyone else is thinking the exact same thing. One of these things is the staff toilet at my new workplace, and by complete chance I found out that all of my workmates share the same dilemma that I do. Let me explain:

The picture above is a map of the Staff (unisex) toilet at my work. Mark A is a normal entry door with a door handle that has a push-button lock on the inside, and a keyhole on the outside. Mark B is a normal toilet stall door with a Vacant/Engaged lock on it, and a rather significant gap between it and the doorjam. Mark C is the toilet, which is substantially visible through the aforementioned gap, and D is a basin, with a paper towel dispenser and a bin next to it.

Now, the first thing to note is that all of my workmates have agreed that the room with the basin in it is straight away far too close for someone on the loo to feel comfortable if someone was in there. Not only that, but the gap in door B means that if you were on the loo, having someone standing in that room would just be horrific. So really, if the loo is occupied, it's not really appropriate for you to come through door A at all. However, if door A is closed, there's no way to know if someone is in there or not. And this is where things get tricky.

The problem can be defined as a number of states and results. The states for each item can be defined as follows (D was only really relevant for the diagram):
Door A: can be open or closed, and locked or unlocked.
Door B: can be locked or unlocked
Toilet C: can be occupied or unoccupied.

Now, the optimal state for you to find the loo in is with door A unlocked and open, and door B unlocked with C vacant. If you were to find A and B as above, with C in the occupied state, then you'd have to question the sanity of the user. So, the real problem is which A&B states imply which C states. Most preferable is being able to predict C from A, as if you can assess the state of B, and C is occupied, you're already in the occupant's personal space at a time I know I wouldn't want you in mine. The other day, I'd locked door A (which is always the best option) and someone UNLOCKED it to put something in the bin at point D. This is downright rude, quite disconcerting, and it made me feel violated for the remainder of the day.

So looking at this logically, there's a finite number of states, and it may well be worth listing them. For the exercise, we'll call A being locked/unlocked A1, and A being open/closed A2. When A1 or B is locked, we'll call that true and unlocked false. With A2, closed is true, open is false. C is true if occupied, or false if unoccupied. So it follows that:

A1 and A2 and B --> !C :someone has done the right thing, and locked A.
A1 and A2 and !B --> C :loo hasn't been unlocked this morning.

Straight away though, there's an issue. You can see that the state of B directly affects the state of C if A1 and A2 are both true. However, when A1 and A2 are both true, you can't ascertain the state of B without already going too far. If !C and you change the state of A1 and/or A2, then you've done precisely what we want to avoid. Anyway, let's continue.

A1 and !A2 and B --> !C :occupant hasn't closed A properly after locking.
A1 and !A2 and !B --> C :someone has pushed button accidentally on their way out the door.
!A1 and A2 and B --> !C :see below

This previous case presents another factor. By observing the state of B when C is occupied, you're effectively looking straight at the occupant on the loo through the gap. This is the most horrible of cases for the observer as you assume that someone would lock door A if they were using the loo, but some people just aren't that cluey. So you glance in at B, realise suddenly that you've just glanced at someone sitting on the loo, and get out of there as quickly as you can. Anyway - let me continue:

!A1 and A2 and !B --> C :Not optimal, as you can't assume B before opening A.
!A1 and !A2 and B --> !C :Occupant must have no inhibitions. Steer clear.
!A1 and !A2 and !B --> C :Best case scenario.

So we can see that there's a direct correlation between B and C: !B --> C and B --> !C. However, being able to assume B based on A1 and A2 is really key to avoid awkwardness in general.

Thankyou for allowing me to waste your life. Consider me however, as I'd been contemplating all of this for HOURS before finally spending the 30 mins it's taken me to post it. I must be crazy, I swear. Anyway - at least you've practiced some logic skills.

4 comments:

m said...

I think I'd have issues with the fact that it is unisex most of all. I could handle the fact of another male catching a glimpse, but the thought of a female...EGAD!

Now I don't know if your work place is mostly female, but I think what would be even worse is if a VIP visitor to your work place had to visit the aforementioned room, not knowing the conundrum, finds the throne room occupied, decides to freshen up anyway...well you can guess the rest. The only thing worse would be if she had come to visit you...not knowing waht you look like, then discovering that the person she had come to visit was the same person she had caught operating the chocolate factory....

Monkeytree said...

Nice logic conundrum. To simplify, just reduce b and c to the same variable since you can assume the toilet door is always locked when the toilet is in use, and always open when the toilet is not in use. If door A is open then it's not an issue at all - you can see what's going on, and by the sounds of it the toilet will be empty. If door A is closed (either locked or unlocked) then you've got the tricky case.

I suggest two solutions:
1. Communicate to EVERYONE who uses the toilet that if the first door is closed then you need to knock. Of course visitors won't know this.
2. Get a sign that you hang on door A to indicate whether the loo is occupied. This could easily be left in the wrong state though.

Actually you could suggest to people to agree to this: you put a sign on door a that reads "If this door is locked, please knock before entering (someone is probably on the loo!)"

To make the puzzle even more interesting you should include monks with red eyes. They rock. And are mysteriously suicidal.

m said...

Why not throw a conveyor belt into the mix as well?

Anonymous said...

Hey Justin, I am a student at the school you USED to work at. I got a bit sussed out when I realised you and your email were no longer on the system... hmmm... a quick google search for "Justin Warner" fixed that one pretty quick. Anyways I have some IT questions for you, would you mind dropping an email at xlcrmax@gmail.com so that I can communicate via email? Its a shame you arent working for the school anymore, what happened? BTW I noticed your little message on the "sign in late box"... "ph33r t3h l33tn3s" Or sumthing like that.. haha good job..