/* This is an unfinished expert system for rock blasting. It was orig- inally written in another dialect and I have not had time to convert it. Go to work!. */ rock_blasting :- print( 'Pleas answer each of the following questions by entering \na number in the form "1" or "2" or "3". etc., whichever appropriate. \nFor further information enter "help." or "why".' ), (decision(X) ; X = error), !, print( 'Based on your answers to the questions,' ), meseg( X ). ask( NQ, NA ) :- question( NQ ), answer( NA ),!, (NA = help, help( NQ), retry( ask( NQ, NA) ) ); (NA = why, why( NQ ), retry( ask(NQ,NA) ) ). meseg(1) :- print( 'Presplitting is feasible and recommended' ). meseg(2) :- print( 'Presplitting is feasible but not recommended.' ). meseg(3) :- print( 'Smooth blasting is recommended.' ). meseg(4) :- print( 'Conventional blasting is recommended' ). meseg(5) :- print( 'Presplitting is feasible but some experimentation \nis necessary to obtain design parameters.' ). meseg(error) :- print( '\nThere is an error in the answer to one of the questions. \nTo restart, type rock_blasting. Respond to each question with a \nnumber in the range mentioned.' ). question(1) :- print( '\nIs it critical to have a smooth rock surface and/or maintain the \nintegrity of the boundary rock? \n 1) Yes 2) No.' ). help(1) :- print( 'if you don\'t care, you can just blast away.'). why(1) :- print( 'If yes, more elaborate information is required before a \ndecision can be made.' ). question(2) :- print( 'Where is the blast? \n 1) On the surface 2) Underground' ). help(2) :- print( 'Look up! Do you see sky?' ). why(2) :- print( 'if on the surface, there are many options available.' ). question(3) :- print( 'is the rock \n1) Hard( compressive strength > 100,000 MPa )? \n2) Soft( compressive strength < 100,000 MPa )?' ). help(3) :- print( 'Measure the rock strength in MegaPascals.' ). why(3) :- print( 'I don\'t know' ). question(4) :- print( 'Is the bench height( or blasthole length ) < 50 feet? \n1) Yes 2) No.' ). help(4) :- print( 'How deep did you make the hole?' ). why(4) :- print( 'I don\'t know.' ). question(5) :- print('Is the borehole drill capable of drilling a 2" to 4" \n blasthole? \n1) Yes 2) No.' ). help(5) :- print( 'Go check the drill.' ). why(5) :- print( 'I don\'t know' ). question(6) :- print( 'Is the charge density of the explosive in the \nblasthole\n 1)High(>1.1 g/cc)? 2)Low(< 1.1g/cc)?' ). help(6) :- print( 'go check while I hide behind a rock.' ). why(6) :- print( 'I don\'t know.' ). question(7) :- print( 'Is the rock mass \n1) Stratified with the proposed face parallel to the plane of \n the dominant fabric elements, or not \nstratified but heavily jointed?' ), print( '\n\n2) Stratified and/or heavily jointed with the proposed face not \nparallel to the plane of the dominant fabric element? \n\n3)Jointed or fractured such that the blasting will create loose, \nblocky conditions on theface?' ). help(7) :- print( 'That is indeed a tough question!' ). why(7) :- print( 'I don\'t know.' ). question(8) :- print('Are the static field stresses \n1)Low( < 10 MPa ) with the principle stresses parallel, \nto the proposed face? \n\nLow( < 10MPa) but with the principle stresses parallel to \nthe proposed face? \n\n3)High( > 10 MPa )?' ). help(8) :- print( 'That\'s a tough question' ). why( 8) :- print( 'I don\'t know.' ). decision(4) :- ask( 1,2 ). decision(3) :- ask(1,1),ask(3,2). decision(5) :- ask(1,1),ask(2,1),ask(3,2). decision(4) :- ask(1,1),ask(2,1),ask(3,2). decision(5) :- ask(1,1),ask(2,1),ask(3,1),ask(4,1),ask(5,2). at1 :- ask(1,1),ask(2,1),ask(3,1),ask(4,1),ask(5,1). decision(5) :- at1, ask(6,1). decision(1) :- at1,ask(6,2),ask(7,1),ask(8,1). decision(2) :- at1,ask(6,2),ask(7,1),ask(8,2). decision(3) :- at1,ask(6,2),ask(7,1),ask(8,3). decision(4) :- at1,ask(6,2),ask(7,2). decision(3) :- at1,ask(6,2),ask(7,3). answer( A ) :- rnum( A ). /* answer(A) :- ratom( X ), conv( X, A ), !. conv(X,I) :- atoi( X, I ), 0 < I, I < 4, !. conv(X,A) :- name( X, String ), valid_resp( String, A ), !. valid_resp( [H|T], A ) :- type_ans( H, A ). type_ans( X, A ) :- ([X] = "h"; [X] = "H"), A = help. type_ans( X, A ) :- ([X] = "w"; [X] = "W"), A = why. valid_resp( [], A ) :- print('\nPlease try to give me a H,W, or number for an answer.'), answer( A ), !. valid_resp( [H|T], A ) :- valid_resp( T, A ). */