New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Occasional Exception Thrown running 2 AIs #11
Comments
Thanks codefactor. This is a good report.
Is it always 91? I think that is a rook's corner, which possibly points to problems with the castle checks. If you want to remove the randomness, you could search for a problematic game a bit like this:
Then when you get the error, if you change the initial seed to the logged number, it should occur right away. I don't have time to look at it right away, but I will try to soon. |
Thank you for replying so quickly - The number 91 is not consistent from one run to the next. In the code example its hard to follow the game from just the logs - but on my real page you can see the game and the 2 AI players duke it out until there are no pieces left on one side except the black player's king. I can't remember all of the other pieces left on the white side. |
Using your way of setting the random seed will give the error on the 2nd time - so setting the seed to 2 will do the trick. Here is the fiddle: http://jsfiddle.net/MB9kk/1/ |
Aha. Does this version work better? That's from before commit 660dcac, which tries to recognise a draw from insufficient material. Edit: the raw JS is here: https://raw.github.com/douglasbagnall/p4wn/b99a9e0ca037f794f258bf2e85422a0c99a117b9/src/engine.js |
Seems still to give the same problem. I pasted the code from the link and ran it in jsFiddle, same error appears to happen. |
It looks like these are queening moves. Firefox and Chromium play different games (which is a bug in itself). With the random seed 2, as per http://jsfiddle.net/MB9kk/1/:
|
This is the problem:
I can see the attraction of symmetry between So the upshot is this works (http://jsfiddle.net/MB9kk/2/) :
and I won't change the signatures of the functions before the next big version, so I'll close this. |
I'm new to this library - but I found a possible issue - and it doesn't always happen due to randomness. I am basically running a game over and over again with AI on both sides until the user asks to join. I've noticed that there is an error during the state.move()
Here is some javascript - if you let it run for a little while (5 minutes or so) you will get the issue near the end of the game. I am guessing perhaps it was supposed to be a draw.
Here is the simple test code:
Live Example: http://jsfiddle.net/MB9kk/
The error output is like this:
And the line is at engine.js:389
Temporarily what I've done is to put a try { } catch around the call to .move() and if there is an exception, I make it so the current player has resigned.
Note - I am only using the engine part with my own entirely different display.
The text was updated successfully, but these errors were encountered: