title: Finish with simulated annealing search
body: <p>I did my best to solve the task, but the code fails.
  My code is located here:<a href="https://github.com/nikolayresh/Simulated-Annealing-Search" rel="nofollow noreferrer">GitHub Repository</a>
  The sense of this task is that initially you have a sequence: <strong>[B1, B2, B3, B4, 0, W1, W2, W3]</strong> where B1, B2, B3, B4 - black balls on the board, 0 - gap on the board, W1, W2, W3 - white balls on the board. And the final state must be: <strong>[W1, W2, W3, 0, B1, B2, B3, B4]</strong>
  Rules for the gap - the closest ball to gap can swap places with it OR the second closest ball can swap places with gap by jumping over the first closest ball.
  For example, such states are valid: <strong>[B1, B2, B3, 0, B4, W1, W2, W3]</strong>,
  <strong>[B1, B2, 0, B4, B3, W1, W2, W3]</strong> or <strong>[B1, B2, B3, B4, W2, W1, 0, W3]</strong>.
  Black balls can only be moved to the right, white balls only to the left.
  What function to use with simulated annealing to get to solution?</p>
  <p><strong>What I have tried?</strong>
  Tried to build the optimizing function that calculates sum of squares of distances between goal state and each successive state, but the function is stuck.</p>