Hungry Snake

Recommended levellevel
5+
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 (62)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
null Level 0
21 February, 14:42
what
Raja Kumar Level 0, Bangalore
18 February, 16:27
does any body know how to see what are the different methods inside the game class or key class. so that to see the contents of the predefine function which we are using in this game development for getting the idea how the things work in this game. in this game they have just told to inherit the game class and use the access of those method. I want to see what is inside that Game class or Key class.
Raja Kumar Level 0, Bangalore
16 February, 05:30
whenever i compile and run there is app publish error .what is this error I'm not able to get
rabia Level 0
13 February, 19:13
hi everyone .i am beginner programmer.i cant, please help me
Andrei Level 20
16 February, 10:02
hello, did you even try?
Andrei Level 20
12 February, 09:58
I found the games to be quite poorly worded. First I tried making the Minesweeper game; I was already I believe level 12-15 something like that. I got stuck around level 6. Now I am trying to do Snake. Again, because of the way the conditions are worded (very lackluster and poorly worded) I find it very difficult to do it on my own. I don't understand how a level 5-6 would be able to complete these. It's quite disappointing and discouraging to work on these games. Is anyone else having troubles like me or is it just me?
Andrei Level 20
16 February, 09:55
I finally did it, it's a buggy version, but nonetheless I have finished it. Yay me!
cyntia Level 0
31 January, 17:26
Hi everyone. Could anybody explain me why I should use this in snake.draw(this) statement? I completely don't understand it.
Derya A. Level 4, York, United Kingdom
31 January, 18:16
Hi cyntia. Because public void draw(Game game) is a method of Snake class, you need to call it in order to print snake to the screen. Here method accepts the Game object as a parameter because the method wants to know where to draw the Snake. In this case, because we are calling this method in the Snake Game class, this keyword refers to the Snake Game object itself.
cyntia Level 0
31 January, 19:53
thank you Derya
Ushalinie Selvi Prakasan Level 0, Bintulu
28 December 2020, 09:04
Hi everyone!
17 December 2020, 15:37
Wanna do Minecraft later
17 December 2020, 15:36
What’s sup
17 December 2020, 15:36
Hi guys