![]() |
Kangaroo problem, np complete :) - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: Kangaroo problem, np complete :) (/thread-1655.html) |
Kangaroo problem, np complete :) - Agamemnus - 08-02-2003 This was originally a 10th grade maths extra credit problem. I made a computer program to solve it and display the kangaroo steps recently. Can you solve it and/or make a program that shows each step? ![]() Here it is, the Kangaroo Problem (I rewrote it from memory) Code: 'The point of this program is to solve Kangaroo problem, np complete :) - xhantt - 08-03-2003 I can't understand JUMP. kangaroo problem - SCM - 08-04-2003 Agamemnus, The solution is fairly straight foreward. Your comment about starting with simple cases is a good general strategy, and worked well for me here. The code took me longer to write than I would like to admit. It would be nice to see some others try this problem, so I am PMing my solution and code to you. Feel free to post them. Xhantt, The kangaroos can only move straight forward one space(hop) or two spaces (jump). This all you need to worry about. By moving them one or two spaces, you will either solve the problem or create a road block. Kangaroo problem, np complete :) - na_th_an - 08-04-2003 I think this is solved using backtracking and cutting recursive branches which are detected to be inviable, just like the priest, the wolf and the goose problem. Maybe I try a simple approach later. kangaroo challenge - SCM - 08-05-2003 It's not the way a programmer is likely to think, but some times a pencil and a piece of paper is a good start. Re: kangaroo challenge - Phydaux - 08-05-2003 Quote:It's not the way a programmer is likely to think, but some times a pencil and a piece of paper is a good start.Thats the way I always start a serious project, or when I try to figure out a problem... pencil and paper gives so much freedom. ![]() I have a desk full of notlets, mostly parts of envelopes and scraps of messed up print jobs with little equations and drawings on them ![]() Just the way I work. Kangaroo problem, np complete :) - Agamemnus - 08-05-2003 arrr Kangaroo problem, np complete :) - Lanzaa - 08-06-2003 so hop is __>___ to ___>__ and jump is __>___ to ____>_ or __><__ to ___<>_ Btw how long is the bridge? im just coming out of algebra one AKA 8th grade math Kangaroo problem - SCM - 08-06-2003 Lanzaa asked Code: Btw how long is the bridge? Code: 'At first the kangaroos line up like this: >>>_<<< (n = 3) Code: >>_<< (n=2) Code: >_><< Kangaroo problem, np complete :) - Agamemnus - 08-09-2003 arr arr |