This game is known as the problem of Chinese chests or the China box problem. Several boxes of two colors stand in a line. There is an additional empty space for two boxes either at the left or at the right side of the boxes or somewhere between the boxes.
The aim of the game is to get the boxes in the right order, that means to move the red boxes to the left side and the blue boxes to the right side. You should do this with a minimum number of moves. You can always move two neighbouring boxes to the empty space, the order of that two boxes will be kept. The position of the empty space at the end of the game doesn't matter.
The game is more difficult with boxes of a third color. Now you have to arrange the red boxes to the left side, the blue boxes to the right side and the violet boxes to the middle.
You can use the mouse or the arrow keys and the space bar for this game.

This game can be solved in 4 moves, the first two moves are already done. Now you have to move the two boxes at the right side to the empty space. After that move the two blue boxes, which will be between the red boxes, to the right side and the game is solved.