This page has been loaded: number of times.
Please be patient! This applet may take some time to load depending on network conditions. Please note that it you should limit the size of the playing board based on how much memory your machine has. I have set the limit at a 400-row by 400-column board. At this size, my Pentium Pro 200 MHz with 64 MB RAM starts to grind (starts using hard disk space as memory).
When I want to learn a new programming language, I usually try to write something simple so I can quickly finish it, but complicated enough for me to try out all or most of the new features. So, I decided to write a Java version of my famous Snake program. This is the third version of this program I have written. The first one was done back in 1990 in Microsoft QuickBasic. The second one was a 32-bit Windows MFC program in Visual C++, and finally this one is done in Java. This is probably the best version of Snake I have written because it is easily distributed over the Internet and is cross platform compatible. Enjoy!
Instructions on How to Play
The object of this game is to fill in as many squares as you can without crossing your own path. You may move in any of 8 directions by pressing the arrow buttons using the mouse or the keypad. Make sure Num Lock is on because the program looks for the numbers 1 through 9 to move. You may choose the direction to move, but the distance you move depends on the number that you are moving into. For example, if you move right and there is an 8 there, you will move 8 spaces to the right. Your current location is shown with a green *. The filled locations are shown with a yellow *. If moving in any direction causes you to cross your path, the game is over. A message will appear indicating your loss and the controls will be disabled. You must start a new game at this point.
You can scroll around using the vertical and horizontal scroll bars. You can also locate your position by pressing the Locate position button or by pressing the L key. If you wish to start a new game, you can press the S key or the start game button. A dialog box will show up telling you your options. Press the A key to display the about box. If you want to see a pie chart of your progress, press P or click to pie chart button. The pie chart will be continuously updated as you play.
I recommend Internet Explorer over Navigator because IE has a faster Java VM.
Future Features
Here are some of the items, issues, and bugs I will address in the future:
Source Code and other stuff for programmers:
Want to see the source code? Here it is! Have fun! You will need the DiagonalDirectionButton class for it to compile.
If you use Visual Café, you may find my DiagonalDirectionButton component useful. It is a slight variation of the DirectionButton that comes with Visual Café, but it allows you to point the arrows in 4 diagonal directions.
Do you have suggestions for improvements? I like to hear them!
Last Revised: May 22, 1997
Back to Leon's home page | Back to Leon's Java Page
Please send email to:leonfu@remus.rutgers.edu, or leonfu@eden.rutgers.edu