jonthysell / Mzinga

Open-source software to play the board game Hive.
MIT License
82 stars 9 forks source link

Fix Spider move generation #102

Closed edre closed 3 years ago

edre commented 3 years ago

From this game state: wA1;bG1 -wA1;wB1 wA1/;bA1 -bG1;wQ \wB1;bQ \bA1;wS1 \wQ;bS1 bQ/ Mzinga v0.9.21000.0 gives this list of valid moves: wS1 wB1-;wS1 \bS1;wS2 wQ/;wS2 wB1/;wS2 \wS1;wS2 wS1/;wS2 wB1-;wS2 wB1\;wS2 wA1\;wB2 wQ/;wB2 wB1/;wB2 \wS1;wB2 wS1/;wB2 wB1-;wB2 wB1\;wB2 wA1\;wG1 wQ/;wG1 wB1/;wG1 \wS1;wG1 wS1/;wG1 wB1-;wG1 wB1\;wG1 wA1\;wA2 wQ/;wA2 wB1/;wA2 \wS1;wA2 wS1/;wA2 wB1-;wA2 wB1\;wA2 wA1\

Mzinga only finds 2 spider moves (the two on the inside), when there should be 4. Here's my graphical representation of the board position (bottom spider to move):

   ...🐜🦗🐜..
    ..🪲..🐝..
   ...🐝.🕷..
    ...🕷...
jonthysell commented 3 years ago

You're right. It's because I remove all slides two away, which happens to coincide with spots three away.

image

jonthysell commented 3 years ago

This is part of the reason why I haven't released a 1.0 - I've never been 100% sure of my move generator.

jonthysell commented 3 years ago

The mising moves are wS1 bS1\ and wS1 /wQ

For future reference, you can go into Viewer Options and uncheck "Only allow valid moves" to let you try and play invalid moves, which also lets you quickly see the notation for the move is.