12.07.2015 Views

flex Examples - LPIS

flex Examples - LPIS

flex Examples - LPIS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

18 Flex Example Listingsrule move_a_blockif block X can be moved from Y to Zthen move block X from Y to Zand display_move( X, Y, Z )and display_blocks ./**/The following action is the top-level program. It runs the forwardchaining engine, and then reports when the solution has been found.action find_blocks_solution ;do invoke ruleset blocks_worldand nland write( 'the final state has now been reached')and nl .action display_move( X, Y, Z )do nland write( 'move block ' ) and write( X )and write(' from ') and write( Y )and write(' to ' ) and write( Z )and nl.relation display_blocksif above_row( P1,Q1,R1,p,q,r )and above_row( P2,Q2,R2,P1,Q1,R1 )and above_row( P3,Q3,R3,P2,Q2,R2 )and display_line( P3, Q3, R3 )and display_line( P2, Q2, R2 )and display_line( P1, Q1, R1 )and display_baseand nl.relation above_row( AboveP, AboveQ, AboveR , P, Q, R )if if block AP is on top of Pthen AboveP = APelse AboveP = noblockend ifand if block AQ is on top of Qthen AboveQ = AQelse AboveQ = noblockend ifand if block AR is on top of Rthen AboveR = ARelse AboveR = noblockend if .relation display_line( Name1, Name2, Name3 )if tab(1)and display_block_top( Name1 )and tab(8)and display_block_top( Name2 )and tab(8)and display_block_top( Name3 )and nland tab(1)and display_block_name( Name1 )A Guide to the Flex Expert System Toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!