Beispiel #1
0
 private static bool isUsefulMove(Coin[,] state, Cell source, Cell dest)
 {
     Offset delta = dest.Minus(source);
     var right = delta.RotateCW();
     var left = delta.RotateCCW();
     var color = state.get(source);
     if(color == Coin.None)
         return false;
     if (state.getSafe(dest.Plus(delta)) == color && state.getSafe(dest.Plus(delta).Plus(delta)) == color)
         return true;
     if (state.getSafe(dest.Plus(right)) == color && state.getSafe(dest.Plus(right).Plus(right)) == color)
         return true;
     if (state.getSafe(dest.Plus(left)) == color && state.getSafe(dest.Plus(left).Plus(left)) == color)
         return true;
     if (state.getSafe(dest.Plus(left)) == color && state.getSafe(dest.Plus(right)) == color)
         return true;
     return false;
 }