/**************************************************************************
(define (problem A6-prob) (:domain A6-dom)
  (:init (holding-coin)
	 (oneof (and (not (fated-heads-up))
		     (not (fated-tails-up))
		     (fated-on-edge) (fated-tips-tails))
		(and (not (fated-heads-up))
		     (not (fated-tails-up))
		     (fated-on-edge) (fated-tips-heads))
		(and (fated-heads-up) 
		     (not (fated-tails-up))
		     (not (fated-on-edge))
		     (not (fated-tips-tails)) (not (fated-tips-heads)))
		(and (fated-tails-up) 
		     (not (fated-heads-up))
		     (not (fated-on-edge))
		     (not (fated-tips-tails)) (not (fated-tips-heads))))
	 (not (error))
	 (not (heads-up)) (not (tails-up)) (not (on-edge)) (not (flat-coin)))
  (:goal (and (flat-coin) (heads-up))))

**************************************************************************/

fluent(w(1)).
fluent(w(2)).
fluent(w(3)).
fluent(w(4)).

fluent(holding_coin).
fluent(fated_on_edge).
fluent(on_edge).
fluent(fated_heads_up).
fluent(heads_up).
fluent(fated_tails_up).
fluent(tails_up).
fluent(error).
fluent(fated_flat).
fluent(flat_coin).
fluent(fated_tips_heads).
fluent(fated_tips_tails).

action(toss_coin).
executable(toss_coin, [holding_coin]).
causes(toss_coin, neg(holding_coin), [holding_coin]).
causes(toss_coin, on_edge, [fated_on_edge]).
causes(toss_coin, heads_up, [fated_heads_up]).
causes(toss_coin, flat_coin, [fated_heads_up]).
causes(toss_coin, flat_coin, [fated_tails_up]).
causes(toss_coin, tails_up, [fated_tails_up]).

action(examine_flatness).
executable(examine_flatness, []).
determines(examine_flatness, flat_coin).
determines(examine_flatness, on_edge).

action(examine_side_up).
executable(examine_side_up, []).
determines(examine_side_up, heads_up).
determines(examine_side_up, tails_up).

action(tip_coin).
executable(tip_coin, [on_edge]).
causes(tip_coin, flat_coin, [on_edge, fated_tips_heads]).
causes(tip_coin, neg(on_edge), [on_edge, fated_tips_heads]).
causes(tip_coin, heads_up, [on_edge, fated_tips_heads]).

causes(tip_coin, flat_coin, [on_edge, fated_tips_tails]).
causes(tip_coin, neg(on_edge), [on_edge, fated_tips_tails]).
causes(tip_coin, tails_up, [on_edge, fated_tips_tails]).
causes(tip_coin, error, [neg(on_edge)]).

action(turn_over).
executable(turn_over, []).
causes(turn_over, tails_up, [heads_up]).
causes(turn_over, neg(heads_up), [heads_up]).
causes(turn_over, heads_up, [tails_up]).
causes(turn_over, neg(tails_up), [tails_up]).
causes(turn_over, error, [neg(tails_up), neg(heads_up)]).

action(init).
executable(init, []).
determines(init, w(I)):- member(I, [1,2,3,4]).

caused([w(1)], neg(fated_heads_up)).
caused([w(1)], neg(fated_tails_up)).
caused([w(1)], fated_on_edge).
caused([w(1)], fated_tips_tails).

caused([w(2)], neg(fated_heads_up)).
caused([w(2)], neg(fated_tails_up)).
caused([w(2)], fated_on_edge).
caused([w(2)], fated_tips_heads).

caused([w(3)], fated_heads_up).
caused([w(3)], neg(fated_tails_up)).
caused([w(3)], neg(fated_on_edge)).
caused([w(3)], neg(fated_tips_tails)).
caused([w(3)], neg(fated_tips_heads)).

caused([w(4)], fated_tails_up).
caused([w(4)], neg(fated_heads_up)).
caused([w(4)], neg(fated_on_edge)).
caused([w(4)], neg(fated_tips_tails)).
caused([w(4)], neg(fated_tips_heads)).

initially(holding_coin).
initially(neg(error)).
initially(neg(on_edge)).
initially(neg(flat_coin)).
initially(neg(tails_up)).
initially(neg(heads_up)).

sgoal(flat_coin).
sgoal(heads_up).
sgoal(neg(error)).


