You have 4 total turns
On your fourth turn, you have to go for the hat, collecting coins if you want.
Controls - to move - arrow keys