This would be a unique book - perhaps someone has done it : Put
  together a "Life Rules" book but written in a psuedo-programming
  language. There's no reason that all of psychology, philosophy
  and all the "how to be happy" stuff couldn't be written in this
  way. And perhaps on some future day, at some future time, a
  future programmer will put the instructions into an artificial
  intelligence situation and then the truth of it could be tested
  scientifically - and tweaked and modded until he or she finally
  discovers, once and for all, "The Secret of Happiness". "