% --------------------------------------------------------- % 1. Basic inventory command % --------------------------------------------------------- getCommand(inventory(model(_), name(_), brand(_), type(new))). getCommand(inventory(model(_), name(_), brand(_), type(open_box))). % --------------------------------------------------------- % 2. Delivery command % --------------------------------------------------------- % new items getCommand(delivery(item(model(1111), name(monitor), brand(sony)), count(5), price(200))). getCommand(delivery(item(model(2222), name(monitor), brand(philips)), count(10), price(180))). getCommand(delivery(item(model(3333), name(keyboard), brand(logitech)), count(30), price(15))). % item already in the warehouse, add quantity getCommand(delivery(item(model(1111), name(monitor), brand(sony)), count(10), price(200))). getCommand(inventory(model(_), name(_), brand(_), type(_))). % --------------------------------------------------------- % 3. Basic order command % --------------------------------------------------------- % those three orders work getCommand(order(customer(alice), item(model(1111), name(monitor), brand(sony)), count(1), max_price(250), type(_))). getCommand(order(customer(alice), item(model(1111), name(monitor), brand(sony)), count(1), max_price(250), type(_))). getCommand(order(customer(alice), item(model(1111), name(monitor), brand(sony)), count(1), max_price(250), type(_))). getCommand(inventory(model(_), name(_), brand(_), type(_))). % --------------------------------------------------------- % 4. More complex orders % --------------------------------------------------------- % customer offered too little money getCommand(order(customer(bob), item(model(1111), name(monitor), brand(sony)), count(1), max_price(100), type(new))). % customer orders more than there is in stock getCommand(order(customer(chris), item(model(2222), name(monitor), brand(philips)), count(11), max_price(190), type(_))). getCommand(inventory(model(_), name(_), brand(_), type(new))). % --------------------------------------------------------- % 5. More complex inventory % --------------------------------------------------------- getCommand(inventory(model(_), name(monitor), brand(_), type(new))). getCommand(inventory(model(1111), name(_), brand(_), type(new))). getCommand(inventory(model(2222), name(_), brand(_), type(new))). getCommand(inventory(model(3333), name(_), brand(_), type(new))). getCommand(inventory(model(3333), name(_), brand(_), type(open_box))). % --------------------------------------------------------- % 6. Return command % --------------------------------------------------------- getCommand(order(customer(bob), item(model(1111), name(monitor), brand(sony)), count(1), max_price(200), type(new))). % those two should work getCommand(return(customer(chris), item(model(2222), name(monitor), brand(philips)), count(5))). getCommand(return(customer(alice), item(model(1111), name(monitor), brand(sony)), count(1))). % this one should not getCommand(return(customer(bob), item(model(222), name(monitor), brand(philips)), count(1))). getCommand(inventory(model(_), name(_), brand(_), type(new))). getCommand(inventory(model(_), name(_), brand(_), type(open_box))). % --------------------------------------------------------- % 7. Ordering open_box items % --------------------------------------------------------- getCommand(delivery(item(model(2222), name(monitor), brand(philips)), count(3), price(180))). % should get 5 open_box and 2 new getCommand(order(customer(alice), item(model(2222), name(monitor), brand(philips)), count(7), max_price(180), type(_))). % should only be able to buy an open_box item for the money offered getCommand(order(customer(chris), item(model(1111), name(monitor), brand(sony)), count(1), max_price(190), type(_))). getCommand(inventory(model(_), name(_), brand(_), type(new))). getCommand(inventory(model(_), name(_), brand(_), type(open_box))). % --------------------------------------------------------- % 8. Sale command % --------------------------------------------------------- getCommand(sale(model(_), name(_), brand(_), percentage(10))). getCommand(sale(model(_), name(monitor), brand(_), percentage(10))). getCommand(inventory(model(_), name(_), brand(_), type(new))). getCommand(inventory(model(_), name(_), brand(_), type(open_box))).