%export "transition_nets"
        "Markov"
        "net_MC"
        specialBulbQuestlimit
        generateBulbQueststatistics showBulbQueststatistics
%include "transition_nets"
%include "Markov"
%include "net_MC"






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






generateBulbQueststatistics :: real -> [statistics node]
|| 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
    = doMonteCarlo (<=) (specialBulbQuestlimit . random_walk theBulbQuestNet 0)






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