converted the script example game to c++