Search Algorithm for Cube game