My recent job application

I recently applied for a position similar to the one I currently have. It’s a technical position, working from home.

One of the questions, I shit you not, was:

The space for the answer was a textbox, not a textarea, so there wasn’t any room for line breaks. My provided answer is below:

I’ve turned your instructions into code so I am able to understand it better.
You have an infinite while loop, please fix :smiley:

if (!me.hasItem('bread', 2)) {
    if (freezer.contains('bread')) {
        Bread bread = freezer.takeOut('bread', 2);
        while (!bread.isThawed())
            Thread.sleep(500);
    } else {
        // blocks thread until returned to home
        me.goto(Maps.getClosest('store'), new TravelSuccessHandler() {
            public void onTravelledTo(Place home, Place store) {
                me.interactWith(store).buyItem('bread');
                while (me.at(store)) {
                    me.pickupItem(store.nearest('peanutButter'));
                    me.pickupItem(store.nearest('jelly'));
                }
               me.gotoAndUnblock(home); // unblocks thread
            }
        });
    }
}
Bread[] bread = me.pickupItem('bread');
PeanutButter pbutter = me.pickupItem('peanutButter');
Jelly jelly = me.pickupItem('jelly');

knife = getKnife(); // utility method
SpreadInteraction si = me.interactionManager.create(bread[0], pbutter, Actions.spreading);
si.setTool(knife).doInteraction();
knife.wipeOnto(pbutter.getJar());

si = me.interactionManager.create(bread[1], jelly, Actions.spreading);
si.setTool(knife).doInteraction();
knife.wipeOnto(jelly.getJar());

me.joinItems(bread[0], bread[1]);
me.enjoy();
7 Likes

Eww, arrays to keep the bread? Why not List<Bread>?

3 Likes

beeboobeepboopboppityboop

??? Who puts bread in the freezer???

Anyone who buys a lot of bread, so they don’t have to go to the store later?

When I buy bread, I normally get 5 loafs. Leave one out, the rest go in.

Haha, what you guys from America call “bread” is a white, flabby piece of sponge xD

Let’s not turn this topic into that conversation, please. :smile:

1 Like

I live in the US and white bread is a piece of shit.

Certain kinds of it yes, I can agree. but when you eat the stuff they import, into the US, White bread becomes better than wheat.

I love wheat bread. :frowning:

1 Like