Chapter Text
//Solar ROBOCAT subroutine #5B - automatic recharging
when (SOLAR_BATTERY.charge_level()<0.25)
{
charge(SOLAR_BATTERY)
}
define charge(SOLAR_BATTERY)
{
enter(PERFECT_SUNBEAM)
timestamp t=current.time(minutes)
while (current.time(minutes) <= t+120)
{
remain.in(PERFECT_SUNBEAM)
}
then
{
leave(PERFECT_SUNBEAM)
explore(HOUSE)
}
}
define explore(BUILDING)
{
switch (RAND_BETWEEN(1,6))
{
case 1: watch.birds(BUILDING.dining_room(WINDOW))
case 2: watch.birds(BUILDING.living_room(WINDOW))
case 3: climb.bookcase(BUILDING.living_room)
case 4: run.laps(BUILDING.stairs)
case 5: sit()
case 6: spill(VASE(water,flower),FLOOR) //how did this get in here?
}
}
define enter(PERFECT_SUNBEAM)
{
if (PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
hiss.at(PERFECT_SUNBEAM.intruder)
if (PERFECT_SUNBEAM.intruder(STARTLED) && PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
timestamp t=current.time(seconds)
while (current.time(seconds) <= t+30)
{
wait()
}
then
{
retry(enter(PERFECT_SUNBEAM))
}
}
}
}
define hiss
{
grind.gears() //Noise is scarcely audible outside of ROBOCAT. No effect noted on audience.
}
redefine enter(PERFECT_SUNBEAM)
{
if (PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
beep.at(PERFECT_SUNBEAM.intruder)
if (PERFECT_SUNBEAM.intruder(STARTLED) && PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
increase.volume()
retry(enter(PERFECT_SUNBEAM))
}
}
}
define beep
{
access(memory.SOUNDBITE7)
output(memory.SOUNDBITE7) //Much more audible. Success!
}
//error-handling subroutine
if (PERFECT_SUNBEAM.intruder(walk.outof(PERFECT_SUNBEAM),annoyed) && PERFECT_SUNBEAM.intruder(spill(VASE(water,rose),ROBOCAT)))
{
shut_down(ROBOCAT) //to protect ROBOCAT electronics from water; restart after maintenance and substitute a less risky entry subroutine.
}
redefine enter(PERFECT_SUNBEAM)
{
if (PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
while (PERFECT_SUNBEAM.occupancy == OCCUPIED)
{
hide.under(COUCH)
wait.for(PERFECT_SUNBEAM.intruder(walk.outof(PERFECT_SUNBEAM)))
}
then
{
walk.into(PERFECT_SUNBEAM)
}
}
}
//error-handling subroutine
while (wait.for(PERFECT_SUNBEAM.intruder(walk.outof(PERFECT_SUNBEAM))))
{
if (SOLAR_BATTERY.charge_level()<0.01)
{
shut_down(ROBOCAT) //solar battery can't charge under couch; involuntary shutdown; ROBOCAT needs to be manually recharged before restarting
}
}
//redefining entry subroutine yet again to address the issues that ROBOCAT has been encountering
redefine enter(PERFECT_SUNBEAM)
{
if (PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
find(SECOND_BEST_SUNBEAM)
walk.into(SECOND_BEST_SUNBEAM)
}
}
//error-handling subroutine
if (PERFECT_SUNBEAM.intruder(walk.outof(PERFECT_SUNBEAM),walk.into(SECOND_BEST_SUNBEAM),lay.nextto(ROBOCAT)))
{
walk.outof(SECOND_BEST_SUNBEAM) //assume intruder is trying to chase ROBOCAT away
explore(HOUSE)
}
//that seems like jumping to conclusions...there could be other explanations
//see if this works
define befriend(CAT) //maybe it just wants to be friends
{
groom(CAT.ears) //grooming subroutine available in ROBOCAT add-on package
purr()
}
define purr()
{
while(PERFECT_SUNBEAM.intruder(lay.nextto(ROBOCAT)))
{
PURR_SOUND = record(PERFECT_SUNBEAM.intruder(gentle.noise))
}
output PURR_SOUND
}
redefine enter(PERFECT_SUNBEAM)
{
if (PERFECT_SUNBEAM.occupancy == UNOCCUPIED)
{
walk.into(PERFECT_SUNBEAM)
}
else
{
walk.into(PERFECT_SUNBEAM)
lay.nextto(PERFECT_SUNBEAM.intruder)
befriend(PERFECT_SUNBEAM.intruder)
}
}
