Hungry Snake

Recommended levellevel
A long serpentine creature slithers across a limited field, obeying the player's orders (moving right, left, down, and up). And there's no way to stop it from moving. Just don't touch the boundaries or you'll die! And don't bite yourself or... well, you get the idea. Along the way, the creature encounters food that makes it even longer. As it grows, it gets more and more cramped... Stop the madness! You probably recognize this comedic storyline from the famous game "Snake". This game originated in the 1970s. That's when it first appeared on arcade machines. In the 21st century, it was popularized by Nokia, which pre-installed Snake on almost all their mobile phones. Between these two milestones, there were versions for the Commodore VIC-20, MS-DOS, ZX Spectrum, Windows, Mac OS… If you go to Google Play or the App Store, you'll probably find a couple dozen different versions of Snake. It's hard to imagine a platform that doesn't have its own version of Snake. Why? On the one hand, it's an interesting game that is perfect for passing the time. On the other hand, Snake is simple enough to create on your own. See for yourself! Use Java to write your own version of this game about the adventures of a growing reptile. On CodeGym, we've already described every step, which will help a novice player handle this task without problems. Carry on!
Comments (89)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Cadence Steilkie
Level 1 , United States
15 October, 13:12
hi, I'm new here how do you play?
Level 1 , United States
13 October, 23:33
how do u play this game plz tell me and Shushi ty
Level 1 , Canada
13 October, 17:21
Someone, please help. I don't know what to do.
Regina Support Team at CodeGym
14 October, 09:50
It is recommended to write the game after completing the first 5 levels of the main Java course.
Level 1 , United States
2 October, 20:13
hi i am new here
Anonymous #10826558
Level 0 , Recklinghausen, Germany
16 September, 15:40
Ey Leute kann mir jemand sagen wie gut er jetzt schon ist ?
Justin Smith
Level 19 , Greenfield, USA, United States
24 July, 15:30
I can't publish this one for some reason. From IDEA, it says I can't publish until I have completed all the parts (but it says I have completed 20/20, both in IDEA and here on this page). When I try to publish from this page, it gets an "Error while publishing. An unknown error has occurred. No additional information is available."
Level 41 , Solar System
25 July, 08:29
Please submit a question in the Help section, with your entire code included, then send the link to your question to
Justin Smith
Level 19 , Greenfield, USA, United States
25 July, 14:19
The help section doesn't allow you to include code from tasks marked as completed.
Level 41 , Solar System
30 July, 12:00
You can send your entire solution (all classes as separate txt files) to
Maxim Raitin
Level 20 , Tomsk, Russian Federation
20 July, 03:58
import com.codegym.engine.cell.*;
I can't import in intellij idea this, so I can't create games in my IDE. ☹️
John Squirrels Website Admin at CodeGym
23 July, 04:43
It should work. Could be because of your IntelliJ IDEA and/or javaFX settings. Please contact support at
Nevaeh Mizell
Level 0
14 July, 21:45
Level 0
5 July, 17:49
Level 0
28 June, 17:53