2048 game action algorithm on JAVA (task for google JAM)