%export "net_consts" "Markov" "MonteCarlo"
        specialBulbQuestlimit generateBulbQuestendings
        generateBulbQueststatistics showBulbQueststatistics
%include "net_consts"
%include "Markov"
%include "MonteCarlo"

specialBulbQuestlimit :: [node] -> node
|| special version of limit to deal with the Caterpillar Cafe
  || specialBulbQuestlimit [] 
  ||   = error "infinite improbability drive in operation"
  || specialBulbQuestlimit [here] = error ("node "++shownum here
  ||                                              ++" is a black hole")
  specialBulbQuestlimit (a:b:rest) = a, a=b
                                   = 47, a=40 & b=47
                                   = specialBulbQuestlimit (b:rest), otherwise

generateBulbQuestendings :: real -> [node]
|| generates a battery of BulbQuest endings
|| from a real input which defines the battery of test sequences to
|| be used.
|| IMPORTANT: since "battery_of_test_sequences" is used here, the input
|| should be "irrational" as explained in comment to 
|| "battery_of_test_sequences".
  generateBulbQuestendings
    = map (specialBulbQuestlimit . random_walk theBulbQuestNet 0)
      . battery_of_test_sequences





generateBulbQueststatistics :: real -> [statistics]
|| generates a battery of accumulating statistics on BulbQuest endings
|| from a real input which defines the battery of test sequences to
|| be used.
|| IMPORTANT: since "battery_of_test_sequences" is used here, the input
|| should be "irrational" as explained in comment to 
|| "battery_of_test_sequences".
  generateBulbQueststatistics = accumulate_statistics
                                . generateBulbQuestendings






showBulbQueststatistics :: real -> [char]
  showBulbQueststatistics = concat 
                            . map showstatistics 
                            . generateBulbQueststatistics
