(Ln(x))3

The everyday blog of Richard Bartle.

RSS feeds: v0.91; v1.0 (RDF); v2.0; Atom.

Previous entry. Next entry.


3:11pm on Friday, 29th September, 2017:

Door Instructions

Anecdote

I was thinking of putting the folowing on my door at work. It's in pseudocode, so as to offend all fans of particular programming languages equally. However, that means I can't test it before I put it up.

Do you see any bugs in it?

if OK_to_enter(door_of(4B.529), YOU) then
    enter(4B.529)

Boolean function OK_to_enter(door, you)
{
    mins_to_wait = 0

    if appears(PROF_BARTLE) then return true

    switch openness(door) into
    {
        case WIDE:
            if contains(4B.529, NULL) then
                //I'll be back shortly in a state of panic.
                mins_to_wait += 1
            else
            if contains(4B.529, PROF_BARTLE) then
                if makes_eye_contact(PROF_BARTLE, you) then
                    //I'll indicate what you should do.
                    return true
                else
                    //Now is not a good time...
                    mins_to_wait += 10
            else
            {
                error("Professor Bartle expected.")
                return false
            }
            break
        case AJAR:
            if expects(PROF_BARTLE, you) or
                urgent(you) or
                hear(you, door) != SPEAKING and
                (    quick_question(you) or
                    weather() == VERY_HOT
                )
            then
                if knock(you, door) == ANSWERED then
                    return true
            //I'm out or expecting someone else
            mins_to_wait += 30
            break
        case TOUCHING_FRAME:
            if hear(you, door) == SPEAKING then
            {
                mins_to_wait += 10
                break
            } else
                if knock(you, door) == ANSWERED then
                    return true
            //I'll be available real soon.
            mins_to_wait += 1
            break
        case CLOSED:
            if hear(you, door) == SPEAKING then
            {
                if expects(PROF_BARTLE, you) or
                    urgent(you) or
                    needs_rescuing(PROF_BARTLE)
                then
                    if knock(you, door) == ANSWERED then
                        return true
                //I'm busy with someone else.
                mins_to_wait += 30
            } else
            {
                if knock(you, door) == ANSWERED then
                    return true
                //I'm not in.
                mins_to_wait += 120
            }
            break
        default:
            error("Door has been stolen.")
            return false
    }

    wait(mins_to_wait)
    return OK_to_enter(door, you)
}





Latest entries.

Archived entries.

About this blog.

Copyright © 2017 Richard Bartle (richard@mud.co.uk).