Closed arr28 closed 8 years ago
Need to re-enable the regression test (in PuzzleBase
) when done.
This wasn't fixed by the unguided Queens work - and it isn't clear why I ever thought it would be. Futoshiki is already legal-guided. There's nothing extra to be gained from latch analysis in this game.
What we really need is for the PartitionedChoiceAnalyser
to run with this game. That should cause us to win nearly instantaneously.
The problem, once again, is the "novel" way in which I phrased the GDL for my puzzles. In this case, it's the "quit" move, which is always valid and immediately terminates the game in a loss. If the player has messed up the puzzle somewhere along the way then, eventually, "quit" will be the only legal play and the player will be forced to concede.
PartitionedChoiceAnalyser.generatePartitionedChoiceFilter
can't cope with that. The "quit" move doesn't affect any of the required base props, so the whole game is considered not to match the necessary pattern.
if (!foundSet)
{
// Input that is not in any partition - doesn't match the analysis pattern we are looking for
return null;
}
As a temporary gross hack, I modified that to...
if (!foundSet && !inputProp.toString().contains("quit"))
{
// Input that is not in any partition - doesn't match the analysis pattern we are looking for
return null;
}
...to see if the rest of the code could cope. Sadly, it can't.
When the PartitionedChoiceStateMachineFilter
tries to call public ForwardDeadReckonLegalMoveSet(ForwardDeadReckonLegalMoveSet master)
, it bombs out with an ArrayIndexOutOfBoundsException
whilst trying to do something with the "quit" move. That code is currently proving completely impenetrable for me.
Steve - have you got any hints?
I'll take a look when I have a little free time. Next weekend at the latest.
Thanks. I'm not expecting you to change any code here - I'm just after some pointers to how the partition code works. Things like...
linkage
all about? (Effectively forming a doubly-linked list of all the moves that are legal in a particular state? What state? I don't see a reference to one.)
ForwardDeadReckonLegalMoveSet(ForwardDeadReckonLegalMoveSet master)
constructor?Answers slightly out-of-order, but:
Steve - the good news is that your fix allows Futoshiki to be solved (with a bit more work). The bad news is that it breaks the Sudoku puzzles (e.g. base.sudokuGrade1). Partitioning still kicks in, but we subsequently die with...
[GamePlayer] java.lang.ArrayIndexOutOfBoundsException: -1
at org.ggp.base.util.propnet.polymorphic.forwardDeadReckon.ForwardDeadReckonLegalMoveSet.clear(ForwardDeadReckonLegalMoveSet.java:420)
at org.ggp.base.util.propnet.polymorphic.forwardDeadReckon.ForwardDeadReckonLegalMoveSet.copy(ForwardDeadReckonLegalMoveSet.java:441)
at org.ggp.base.util.statemachine.implementation.propnet.forwardDeadReckon.PartitionedChoiceStateMachineFilter.determineActiveMoveSet(PartitionedChoiceStateMachineFilter.java:89)
at org.ggp.base.util.statemachine.implementation.propnet.forwardDeadReckon.PartitionedChoiceStateMachineFilter.getFilteredMovesSize(PartitionedChoiceStateMachineFilter.java:147)
at org.ggp.base.player.gamer.statemachine.sancho.TreeNode.expandInternal(TreeNode.java:3008)
at org.ggp.base.player.gamer.statemachine.sancho.TreeNode.expand(TreeNode.java:2624)
at org.ggp.base.player.gamer.statemachine.sancho.MCTSTree.setRootState(MCTSTree.java:891)
at org.ggp.base.player.gamer.statemachine.sancho.GameSearcher.startSearch(GameSearcher.java:1048)
at org.ggp.base.player.gamer.statemachine.sancho.Sancho.stateMachineMetaGame(Sancho.java:1176)
at org.ggp.base.player.gamer.statemachine.StateMachineGamer.metaGame(StateMachineGamer.java:208)
at org.ggp.base.player.request.grammar.StartRequest.process(StartRequest.java:70)
at org.ggp.base.player.GamePlayer.run(GamePlayer.java:111)
On the Futoshiki front, I've done something that's sufficiently unhacky to be reasonable for committing. The PartitionChoiceAnalyser
now allows a very small number (2 or fewer) of inputs that don't match the pattern - i.e. they do something other than affect one of the "important" propositions. Any such inputs are added to all partitions.
With this enhancement, on my lowliest hardware, we solve 6x6 in 0.8s, 5x5 in 0.1s and 4x4 in 0.02s. I've checked a moderate range of other puzzles to ensure that partitioning doesn't accidentally misfire in other puzzles.
(This still doesn't fix Sudoku, so leaving this issue open for now.)
Ok, I'll sort out Sudoku sometime in the next week ;-) Want to have our call this coming weekend?
Steve
On Tue, Jan 19, 2016 at 3:19 AM, Andrew Rose notifications@github.com wrote:
On the Futoshiki front, I've done something that's sufficiently unhacky to be reasonable for committing. The PartitionChoiceAnalyser now allows a very small number (2 or fewer) of inputs that don't match the pattern - i.e. they do something other than affect one of the "important" propositions. Any such inputs are added to all partitions.
With this enhancement, on my lowliest hardware, we solve 6x6 in 0.8s, 5x5 in 0.1s and 4x4 in 0.02s. I've checked a moderate range of other puzzles to ensure that partitioning doesn't accidentally misfire in other puzzles.
(This still doesn't fix Sudoku, so leaving this issue open for now.)
— Reply to this email directly or view it on GitHub https://github.com/SanchoGGP/ggp-base/issues/372#issuecomment-172786363.
I've sorted out Sudoku. (Your fix to clear()
didn't deal with the case where there were no always-legals.)
I've also re-enabled the regression test for Futoshiki 6x6 because we ought to be able to solve it, even on snap-ci.
Closing.
Hopefully will be fixed by #369 (Queens), but need to check.