Created
August 28, 2016 16:50
-
-
Save gmalmquist/65b4e1461bf8eea9340cbbe7372a1340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Bullseye { | |
public static Food createBullseye() { | |
Kitchen kitchen = Kitchen.getInstance(); | |
Pantry pantry = kitchen.getPantry(); | |
Stove stove = kitchen.getStove(); | |
Pan pan = kitchen.getFryingPan(); | |
Butter butter = kitchen.getRefridgerator().find(Butter.class); | |
Carton<Egg> eggs = kitchen.getRefridgerator().findCartonOf(Egg.class); | |
Slice<Bread> bread = new Slice<>(pantry.find(Bread.class)); | |
pan.add(butter); | |
stove.add(pan); | |
stove.setHeat(Stove.HEAT_MEDIUM_HIGH); | |
butter.waitUntilInState(State.LIQUID); | |
Circle<Bread> circle = bread.cutOut(new Circle(bread.width/4)); // cut a circle of radius width/4 or so | |
pan.add(bread); | |
pan.add(circle); | |
// Crack open the egg into the hole in the middle of the bread in the pan. | |
// We only add the inside part of the egg to the pan; we let the shell get | |
// garbage-collected. | |
Egg egg = eggs.next().crackOpen().contents(); | |
bread.add(egg); | |
egg.waitUntilState(State.COOKED_ON_ONE_SIDE); | |
bread.flip(); | |
circle.flip(); | |
egg.waitUntilState(State.COOKED_ON_TWO_SIDES); | |
stove.turnOff(); | |
return (Food) pan.contents(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment