Rolling Cube

Here are eight cubes that are painted red and white as shown on the left. They are put so that its upper surface is white.
When the cube is clicked, it rolls over to the empty space.
Change all cubes upper surface into red.


SOURCE