Return to puzzles

In some places there are 7 holes. There are 6 pebbles in them, as depicted on a picture (three of black and three white)

H H H     B B B
For each move, one of the following operations can be performed:
1. Move the pebble to the adjacent free hole
2. Move the pebble into a free hole which is located behind its immediate neighbor (overlapping the adjacent pebble)
What is the least number of moves that can be exchanged for black and white pebbles? Produce the appropriate sequence of moves.

Answer: In 15 moves:

  0) ЧЧЧ [] БББ
 4) BCP [] BCH
 8) BCHB [] BW
 12) B [] BCHBH
 1) HH [] BHBB
 5) Ч [] БЧБЧБ
 9) BCHBCH []
 13) WB [] CHBCH
 2) WBH [] BB
 6) [] BSHCHBB
 10) BCHCHB [] H
 14) BHB [] HH
 3) HBHCHB [] B
 7) BC [] BSHB
 11) BCHB [] BCH
 15) BBB [] CHCHC