packet(p1).
packet(p2).
location(rug).
location(toilet).

fluent(at(P,L)):- packet(P), location(L).
fluent(hasBomb(P)):- packet(P).
fluent(disarmed).
fluent(error).
fluent(wet(P)):- packet(P).

action(xray(P)):- packet(P).
executable(xray(P), []):- packet(P).
determines(xray(P), hasBomb(P)):- packet(P).
determines(xray(P), neg(hasBomb(P))):- packet(P).

action(moveRT(P)):- packet(P).
executable(moveRT(P), []):- packet(P).
causes(moveRT(P), at(P, toilet), [at(P, rug)]):- 
  packet(P).
causes(moveRT(P), neg(at(P, rug)), [at(P, rug)]):- 
  packet(P).
causes(moveRT(P), error, [neg(at(P, rug))]):- 
  packet(P).

action(dunk(P)):- packet(P).
executable(dunk(P), [at(P, toilet)]):- packet(P).
causes(dunk(P), wet(P), []):- packet(P).
causes(dunk(P), disarmed, [hasBomb(P)]):- packet(P).
causes(dunk(P), error, [neg(hasBomb(P))]):- packet(P).

initially(at(p1, rug)).
initially(at(p2, rug)).
initially(neg(disarmed)).
initially(neg(error)).

sgoal(disarmed).
sgoal(neg(error)).

