Instructions in game. If the baddie eats so many that there aren't enough left for a win to be possible, a game over appears automatically. If you're not sure why you lost, that'll be it. Also, you need 11, not 10 to win.
I did this as a mandatory project in computing class, but I added as much as I could to make it a better project. I've had this sitting around not doing anything for nearly two years now, when I decided to play it, revisit it and now it's decluttered because I'd discovered the clone tool. It can be annoyingly laggy at times.