home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / pdprolog / rock.pro < prev    next >
Text File  |  1986-05-05  |  5KB  |  141 lines

  1. /* This is an unfinished expert system for rock blasting. It was orig-
  2. inally written in another dialect and I have not had time to convert it.
  3.  Go to work!. */
  4.  
  5.  
  6.  
  7. rock_blasting :- 
  8.   print( 'Pleas answer each of the following questions by entering
  9.      \na number in the form "1" or "2" or "3". etc., whichever appropriate.
  10.      \nFor further information enter "help." or "why".' ),
  11. (decision(X) ; X = error), !,
  12. print( 'Based on your answers to the questions,' ),
  13. meseg( X ).
  14.  
  15.  
  16. ask( NQ, NA ) :- question( NQ ),
  17.       answer( NA ),!,
  18.       (NA = help, help( NQ), retry( ask( NQ, NA) ) );
  19.       (NA = why, why( NQ ),  retry( ask(NQ,NA)   ) ).
  20.  
  21.  
  22. meseg(1) :- print( 'Presplitting is feasible and recommended' ).
  23. meseg(2) :- print( 'Presplitting is feasible but not recommended.' ).
  24. meseg(3) :- print( 'Smooth blasting is recommended.' ).
  25. meseg(4) :- print( 'Conventional blasting is recommended' ).
  26. meseg(5) :- print( 'Presplitting is feasible but some experimentation     
  27.     \nis necessary to obtain design parameters.' ).
  28.  
  29. meseg(error) :- print(
  30.     '\nThere is an error in the answer to one of the questions.
  31.     \nTo restart, type rock_blasting. Respond to each question with a 
  32.     \nnumber in the range mentioned.' ).
  33.  
  34. question(1) :- print(
  35.     '\nIs it critical to have a smooth rock surface and/or maintain the
  36.     \nintegrity of the boundary rock?
  37.     \n 1) Yes     2) No.' ).
  38. help(1) :- print( 'if you don\'t care, you can just blast away.').
  39. why(1)  :- print( 'If yes, more elaborate information is required before a 
  40.     \ndecision can be made.' ).
  41.  
  42. question(2) :- print( 'Where is the blast?
  43.     \n 1) On the surface    2) Underground' ).
  44.         
  45. help(2) :- print( 'Look up! Do you see sky?' ).
  46.  
  47. why(2) :- print( 'if on the surface, there are many options available.' ).
  48.  
  49. question(3) :-
  50.     print( 'is the rock
  51.       \n1) Hard( compressive strength > 100,000 MPa )?
  52.       \n2) Soft( compressive strength < 100,000 MPa )?' ).
  53.  
  54. help(3) :- print( 'Measure the rock strength in MegaPascals.' ).
  55. why(3) :- print( 'I don\'t know' ).
  56.  
  57.  
  58. question(4) :- print( 'Is the bench height( or blasthole length ) < 50 feet?
  59.     \n1) Yes   2) No.' ).
  60.  
  61. help(4) :- print( 'How deep did you make the hole?' ).
  62. why(4) :- print( 'I don\'t know.' ).
  63.  
  64. question(5) :- print('Is the borehole drill capable of drilling a 2" to 4"
  65.     \n blasthole?
  66.     \n1) Yes      2) No.' ).
  67.  
  68. help(5) :- print( 'Go check the drill.' ).
  69. why(5) :- print( 'I don\'t know' ).
  70.  
  71.  
  72.  
  73. question(6) :- print( 'Is the charge density of the explosive in the
  74.     \nblasthole\n 1)High(>1.1 g/cc)?     2)Low(< 1.1g/cc)?' ).
  75.  
  76. help(6) :- print( 'go check while I hide behind a rock.' ).
  77. why(6) :- print( 'I don\'t know.' ).
  78.  
  79. question(7) :- print( 'Is the rock mass
  80.     \n1) Stratified with the proposed face parallel to the plane of
  81.     \n the dominant fabric elements, or not
  82.     \nstratified but heavily jointed?' ),
  83.     print( 
  84.     '\n\n2) Stratified and/or heavily jointed with the proposed face not
  85.     \nparallel to the plane of the dominant fabric element?
  86.  
  87.     \n\n3)Jointed or fractured such that the blasting will create loose, 
  88.     \nblocky conditions on theface?' ).
  89.     
  90. help(7) :- print( 'That is indeed a tough question!' ).
  91. why(7) :- print( 'I don\'t know.' ).
  92.  
  93.  
  94. question(8) :- print('Are the static field stresses
  95.     \n1)Low( < 10 MPa ) with the principle stresses parallel,
  96.     \nto the proposed face?
  97.     \n\nLow( < 10MPa) but with the principle stresses parallel to
  98.     \nthe proposed face?
  99.     \n\n3)High( > 10 MPa )?' ).
  100. help(8) :- print( 'That\'s a tough question' ).
  101. why( 8) :- print( 'I don\'t know.' ).
  102.  
  103. decision(4) :- ask( 1,2 ).
  104. decision(3) :- ask(1,1),ask(3,2).
  105. decision(5) :- ask(1,1),ask(2,1),ask(3,2).
  106. decision(4) :- ask(1,1),ask(2,1),ask(3,2).
  107. decision(5) :- ask(1,1),ask(2,1),ask(3,1),ask(4,1),ask(5,2).
  108. at1 :- ask(1,1),ask(2,1),ask(3,1),ask(4,1),ask(5,1).
  109. decision(5) :- at1, ask(6,1).
  110. decision(1) :- at1,ask(6,2),ask(7,1),ask(8,1).
  111. decision(2) :- at1,ask(6,2),ask(7,1),ask(8,2).
  112. decision(3) :- at1,ask(6,2),ask(7,1),ask(8,3).
  113. decision(4)  :- at1,ask(6,2),ask(7,2).
  114. decision(3) :- at1,ask(6,2),ask(7,3).
  115.  
  116.  
  117. answer( A ) :- rnum( A ).
  118. /*
  119. answer(A) :- ratom( X ), conv( X, A ), !.
  120.  
  121. conv(X,I) :- atoi( X, I ), 0 < I, I < 4, !.
  122. conv(X,A) :- name( X, String ), valid_resp( String, A ), !.
  123.  
  124.  
  125. valid_resp( [H|T], A ) :- type_ans( H, A ).
  126.  
  127. type_ans( X, A ) :- ([X] = "h"; [X] = "H"), A = help.
  128. type_ans( X, A ) :- ([X] = "w"; [X] = "W"), A = why.
  129.  
  130. valid_resp( [], A ) :-
  131.     print('\nPlease try to give me a H,W, or number for an answer.'),
  132.     answer( A ), !.
  133.  
  134. valid_resp( [H|T], A ) :- valid_resp( T, A ).
  135. */
  136.  
  137.  
  138.  
  139.  
  140.  
  141.