/** * beerStrips.java * Strips on the beer problem * * Created: Jan 2005 * STRIPS for the beer problem * @author pdg * @version 2 */ import sheffield.*; import java.io.*; import java.util.*; import pmatch.*; public class blockStrips { public static void main(String[] args) { EasyWriter scr=new EasyWriter(); //create the operators Strips_op move_floorToStack = new Strips_op("move ?b1 off ?f onto ?b2", "?b1 on ?b2|?b1 at ?t", "?b1 on ?f|?b2 at ?t", "?b1 on ?f|?b2 at ?t"); Strips_op move_stackToStack = new Strips_op("move ?b1 off ?b2 onto ?b3", "?b1 on ?b3|b1 at ?t|b2 at ?t", "?b1 on ?b2|b1 at ?t|b3 at ?t", "?b1 on ?b2|b1 at ?t|b3 at ?t"); Strips_op move_stackToFloor = new Strips_op("move ?b1 off ?b2 onto ?f", "?b1 on ?f|b2 at ?t", "?b1 on ?b2|b1 at ?t", "?b1 on ?b2|b1 at ?t"); //form them into a vector Vector blockops = new Vector(); blockops.add(move_floorToStack); blockops.add(move_stackToStack); blockops.add(move_stackToFloor); //create instance of Strips1, give it the operators, init state & goal state Strips1 str=new Strips1(blockops, new MStringVector("c on b|b on floor|a on floor|c at top|a at top"), new MStringVector("c on b|b on a|a on floor|c at top")); //run Strips boolean res=str.run(); scr.println("Result is "+res); //result scr.println("Plan is "+str.getPlan()); //plan } }