initial draft after modifying 2048 code.