Coder Social home page Coder Social logo

Comments (2)

Mortimerp9 avatar Mortimerp9 commented on July 23, 2024

ok, I haven't done prolog in a very long while, but I think that you want something like:

distance(From, To, 300).

can(move(Rocket,From,To, FuelAmount),[at(Rocket,From), has_fuel(Rocket, FuelAmount)], rocket) :- 
	rocket(Rocket),
	place(From),
	place(To),
        distance(From, To, X),
        FuelAmount > X,
	From \= To.

adds(move(Rocket,_From,To, OldFA),[at(Rocket, To), has_fuel(Rocket, NewFuelAmount)], at(Rocket,To), rocket):-
	rocket(Rocket),
        distance(From, To, X),
        NewFuelAmount is OldFA - X,
	place(To).

deletes(move(Rocket,From,_To, OldFA),[at(Rocket,From), has_fuel(Rocket, OldFA)], rocket):-
	rocket(Rocket),
	place(From).

I haven't tested it, but it's probably the way to start looking at this.

from prolog-graphplan.

illbexyz avatar illbexyz commented on July 23, 2024

Thank you!

This solution doesn't seem to work unless I define a fuelAmountpredicate as a world fact listing all the possible values for the fuel.

But this is not what i'm trying to accomplish because i'd like move to be called only with the values of fuel inside the state.

from prolog-graphplan.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.