package org.drools.examples.wumpus

import org.drools.examples.wumpus.Move
import org.drools.examples.wumpus.Cell

import org.drools.examples.wumpus.Wumpus
import org.drools.examples.wumpus.Pitt
import org.drools.examples.wumpus.Gold
import org.drools.examples.wumpus.SeeGlitter
import org.drools.examples.wumpus.SmellStench
import org.drools.examples.wumpus.FeelBreeze
import org.drools.examples.wumpus.HearScream

dialect "mvel"

rule "Smell Stench"  when 
    $h  : Hero()
          Wumpus(row == ($h.row + 1), col == $h.col ) or
          Wumpus(row == ($h.row - 1), col == $h.col ) or          
          Wumpus(row == $h.row, col == ($h.col + 1) ) or
          Wumpus(row == $h.row, col == ($h.col - 1) )
then
    insertLogical( new SmellStench() );
end 

rule "Feel Breeze"  when 
    $h  : Hero()
          Pitt(row == ($h.row + 1), col == $h.col ) or
          Pitt(row == ($h.row - 1), col == $h.col ) or          
          Pitt(row == $h.row, col == ($h.col + 1) ) or
          Pitt(row == $h.row, col == ($h.col - 1) )
then
    insertLogical( new FeelBreeze() );
end

rule "See Glitter"  when 
    $h  : Hero()
          Gold(row == ($h.row + 1), col == $h.col ) or
          Gold(row == ($h.row - 1), col == $h.col ) or          
          Gold(row == $h.row, col == ($h.col + 1) ) or
          Gold(row == $h.row, col == ($h.col - 1) )
then
    insertLogical( new SeeGlitter() );
end

rule "Hear Scream"  when 
    $h  : Hero()
          Wumpus( alive == false )
then
    insertLogical( new HearScream() );
end