For each press of spacebar, pass keystroke to app and increment input counter
Not with AppleScript, but with Whatpulse. You can see exactly how many times you hit spacebar. When you denote what the amount before you play the game, and check what it is afterward, you have the amount of spacebar hits. And its fun to keep track of your statistics!