Thursday, November 12, 2015

Once a programmer...

The Gorse Fox was planning the agenda for the holiday. It goes something like this:

/* Program for vacation */
Call Init;
Call Travel("LHR","NiceHotel");
Command "Check-in"
Do day = 1 to duration
bedtime = "no"
Do until bedtime = "yes"
Select
When thirsty then Get_beer()
When hot then dive_into_pool()
When tired the doze()
When hungry then eat()
When fidgety then walk()
When inquisitive then goDiving()
When late then bedtime = "yes"
Otherwise do nothing
End
End
Call Travel("BKK'","Home")
End

Init: Procedure
Command "Pack Suitcases"
duration = 365
End /* Init */

Travel: Procedure
Parse arg airport myhotel
Command "Drive" airport
Command "Boardflight"
Command "Watch films"
Command "Eat_Drink"
Command "Disembark"
Command "Drive" myhotel
End /*Travel*/

Now this is just the first draft and needs to go through extensive testing.

1 comment:

The Gorse Fox said...

The Gorse Fox was disappointed that nobody picked up the logic error which would have caused the program to stop before we travelled home. Reality check has forced the Gorse Fox to update the program to correct this error.