|
Post by napstablook on Jul 3, 2016 13:54:04 GMT -8
I've implemented a simple planner that I'm certain should work, but doesn't. I don't understand the problem, but when I debug it seems like it's not searching enough of the tree. How it should work is this: Simply perform a depth-first search through all states until it finds a 100 point terminal state. However, what it seems to be doing is searching some of the tree, then stopping for some reason. I'd like to know if anyone here can see a problem with my code. I'm using GGP-base, and my player can be found here. I apologize that everything is in portuguese. This section of the code: if(!fechada.contains(proximo)) { fechada.add(proximo); Was meant to avoid searching through previously searched states, because I thought maybe it was running out of time. That is not the case, but I left the code there because why not. The game I'm trying to play with it is the buttons puzzle, (there's 3 buttons, at the end of 7 steps all 3 must be on) but I tried other games and it didn't work either. Even when I try to print the evaluations for each state generated, it seems like no state is ever being generated where a goal of 100 would be reached. this game has a branching factor of 3, so it should be small enough. Can anyone look over my code and help me find my error?
|
|
|
Post by Andrew Rose on Jul 3, 2016 23:46:06 GMT -8
The core of your algorithm appears to be encontraMelhorPlano. Perhaps you could translate just that 1 routine into English?
|
|
|
Post by napstablook on Jul 4, 2016 7:52:54 GMT -8
The core of your algorithm appears to be encontraMelhorPlano. Perhaps you could translate just that 1 routine into English? Sure, I'll do that later today and will push to git. I'll post here when I do. Thanks a lot for trying to help me with this!
|
|
|
Post by napstablook on Jul 4, 2016 14:48:31 GMT -8
I translated the method and some other stuff around the code, I hope it's readable now.
|
|
rxe
Junior Member
Posts: 61
|
Post by rxe on Jul 4, 2016 15:48:33 GMT -8
The findBestPlan() looks reasonable enough and works for simple puzzles as far as I can tell (I also tested it findBestPlan() will append the deepest move to the plan first and recursively back out. The upshot is that the moves will need to be reversed in the plan... in other words: add "Collections.reverse(plan);" after calling findBestPlan(). Also note: be careful not to delete the plan before actually using it. Good luck!
|
|
|
Post by napstablook on Jul 4, 2016 15:59:32 GMT -8
The findBestPlan() looks reasonable enough and works for simple puzzles as far as I can tell (I also tested it findBestPlan() will append the deepest move to the plan first and recursively back out. The upshot is that the moves will need to be reversed in the plan... in other words: add "Collections.reverse(plan);" after calling findBestPlan(). Also note: be careful not to delete the plan before actually using it. Good luck! Oh my god I can't believe I didn't realize this! edit: rxe, which puzzles did you test it with?
|
|
rxe
Junior Member
Posts: 61
|
Post by rxe on Jul 4, 2016 16:10:03 GMT -8
buttons maze lights out
|
|