Hungry Snake

Zalecany poziompoziom
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!
Komentarze (84)
  • Popularne
  • Najnowsze
  • Najstarsze
Musisz się zalogować, aby dodać komentarz
Anonymous #10826558
Poziom 0 , Recklinghausen, Germany
16 września, 15:40
Ey Leute kann mir jemand sagen wie gut er jetzt schon ist ?
Justin Smith
Poziom 17 , Greenfield, USA, United States
24 lipca, 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."
Poziom 41 , Solar System
25 lipca, 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
Poziom 17 , Greenfield, USA, United States
25 lipca, 14:19
The help section doesn't allow you to include code from tasks marked as completed.
Poziom 41 , Solar System
30 lipca, 12:00
You can send your entire solution (all classes as separate txt files) to
Maxim Raitin
Poziom 20 , Tomsk, Russian Federation
20 lipca, 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
23 lipca, 04:43
It should work. Could be because of your IntelliJ IDEA and/or javaFX settings. Please contact support at
Nevaeh Mizell
Poziom 0
14 lipca, 21:45
Poziom 0
5 lipca, 17:49
Poziom 0
28 czerwca, 17:53
Calis-Rita Moses
Poziom 0 , Ridgewood
11 czerwca, 11:16
not work
Poziom 41 , Solar System
11 czerwca, 19:48
Please submit a question in the Help section, if your code does not pass verification.
Poziom 24 , Wittenberg, Germany
9 czerwca, 14:53
part 16 validator strangeness: the validator failed my submission because I didn't perform the GOAL test if the snake was dead. Decoupling the two conditions worked (even though it doesn't make much sense to have the snake win after the game is already over because the snake died). Based on that experienced I shelved all plans to review the logic with regard to isGameOver ...
Siddhant Singh
Poziom 0
27 maja, 15:53
The way codegym has put up the coding walthrough and coding execution requirements and stuff and really amazing and helpful to learn. But still i need to bridge a little gap between everything i learned in java and the way things are designed and coded. I mean, i cannot think this way on my own. I am literally forgetting the implementations after i move on further. not much concepts are needed here but still, the way it is designed, i cannot code most of this without getting repetititive errors. What should i do else to feel more comfortable with this?? Kindly help!!
Maxim Raitin
Poziom 20 , Tomsk, Russian Federation
31 maja, 03:38
more practise?
Karas Java Developer
14 kwietnia, 22:41
@CodeGym There seems to be a small bug somewhere in the setScreenSize method it creates the screen but it is funky it has black squares. I checked a small bunch of completed ones and seem mlike all of them have this bug. Sorry if this is not the correct way to submit a ticket.
Poziom 41 , Solar System
17 kwietnia, 14:57
Please send a screenshot or, even better, a video, to