3 ms·
The pseudocode for the flight + hotel saga is quite long and messy and I would not immediately recognize that this exhausts all the possibilities that might go
by patrakov 4y ago
The pseudocode for the flight + hotel saga is quite long and messy and I would not immediately recognize that this exhausts all the possibilities that might go wrong.
I am not sure here, but, instead of encoding the desired and actual states via "the current place in the program", maybe it would make sense to write this program as one big for-loop that looks at the desired state and the actual state (explicitly stored in the variables), then does exactly one step to move closer to the goal, and, based on the outcome, updates these variables? I.e. apply the transformation from https://en.wikipedia.org/wiki/Structured_program_theorem#Single-while-loop,_folk_version_of_the_theorem https://en.wikipedia.org/wiki/Structured_program_theorem#Sin...