IT Projects‎ > ‎Java Projects List‎ > ‎

Snake Game

Description: It's a Snakes game where you play vs the computer.

The objective of the game is to make the other player crash.

This project is aimed at developing a Multiplayer Snakes and Ladders Game, which can be played over LAN. This game has been built using Java which is platform independent and applet based hence lightweight.
The snake game is simple game.In this game the snake is eating some foods and get its size larger in step by step and getting some score.

Problem Definition

This is small game .In this if the player has to change the direction of the snake for getting food for snake.


• Snakes and ladders, or chutes and ladders, is a classic children's board game.
• It is played between 2 or more players on a playing board with numbered grid squares.
• On certain squares on the grid are drawn a number of "ladders" connecting two squares together, and a number of "snakes" or "chutes" also connecting squares together.
• The size of the grid (most commonly 8×8, 10×10 or 12×12) varies from board to board, as does the exact arrangement of the chutes and the ladders: both of these may affect the duration of game play.

Main Learning Objective

• The main thing behind by doing this project was playing the snakes and ladders game online .


• The game was sold as Snakes and ladders in England before Milton Bradley introduced the basic concept in the United States as Chutes and ladders, an "improved new version of ... England's famous indoor sport.”
• Its simplicity and the see-sawing nature of the contest make it popular with younger children, but the lack of any skill component in the game makes it less appealing for older players.


1) The game starts on a first come first serve basis.
2) If the die rolled is six, the player will get another chance to roll the die.
3)There could be only one winner. Once a player wins (reaches the 100th mark), the game is over.
4) The first player creates the game and pass phrase.
5) Others joining the game should know the pass phrase to join the game.

What is JAVA?
Java is an entire programming language resembling C or C++. It takes a sophisticated programmer to create Java code. And it requires a sophisticated programmer to maintain it. With Java, you can create complete applications. Or you can attach a small group of instructions, a Java "applet" that improves your basic HTML. A Java Applet can also cause text to change color when you roll over it. A game, a calendar, a scrolling text banner can all be created with Java Applets. There are sometimes compatibility problems between Java and various browsers, operating systems or computers, and if not written correctly, it can be slow to load. Java is a powerful programming language with excellent security, but you need to be aware of the tradeoffs.

What is JSP?
Short for Java Server Page. A server-side technology, Java Server Pages are an extension to the Java servlet technology that was developed by Sun. JSPs have dynamic scripting capability that works in tandem with HTML code, separating the page logic from the static elements -- the actual design and display of the page -- to help make the HTML more functional(i.e. dynamic database queries). A JSP is translated into Java servlet before being run, and it processes HTTP requests and generates responses like any servlet. However, JSP technology provides a more convenient way to code a servlet. Translation occurs the first time the application is run. A JSP translator is triggered by the .jsp file name extension in a URL. JSPs are fully interoperable with servlets. You can include output from a servlet or forward the output to a servlet, and a servlet can include output from a JSP or forward output to a JSP. JSPs are not restricted to any specific platform or server. It was orignially created as an alternative to Microsoft's ASPs (Active Server Pages). Recently, however, Microsoft has countered JSP technology with its own ASP.NET, part of the .NET initiative.

What is JavaScript?
When new technologies start, they sometimes acquire names that will be confusing in the future. That's the case with JavaScript. JavaScript is not 'Java'. JavaScript is a simple programming language that was developed by Netscape that writes commands to your browser when the HTML page is loaded. Note: you can have compatibility issues with Java Script, especially in newer versions of Browsers.

What is Java
Java is a simple, distributed object oriented programming language which provides the security, High performance, robustness.
Java is a portable and Architectural neutral language which can be Interpreted.
Java is multithreaded and Dynamic language.

About Java
Java is a Programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java Platform. The language derives much of its Syntax from c and C++ but has a simpler object Model and fewer low-level facilities. Java applications are typically compiled to bytecode(class file) that can run on any Java Virtual machine (JVM) regardless of computer architecture.

Why Software Developers Choose Java
Java with its versatilty, efficiency, and portability, Java has become invaluable to developers by enabling them to:

• Write software on one platform and run it on virtually any other platform
• Create programs to run within a Web browser and Web services
• Develop server-side applications for online forums, stores, polls, HTML forms processing, and more
• Combine applications or services using the Java language to create highly customized applications or services
• Write powerful and efficient applications for mobile phones, remote processors, low-cost consumer products, and practically any other device with a digital heartbeat.

Goals in creation of Java
There were five primary goals in the creation of the Java language

1. It should be "simple, object oriented".
2. It should be "robust and secure".
3. It should be "architecture neutral and portable".
4. It should execute with "high performance".
5. It should be "interpreted, threaded, and dynamic".

Architecture of Java
Java's architecture arises out of four distinct but interrelated technologies: 

• The Java programming language 
• The Java class file format 
• The Java Application Programming Interface 
• The Java virtual machine 

When you write and run a Java program, you are tapping the power of these four technologies. You express the program in source files written in the Java programming language, compile the source to Java class files, and run the class files on a Java virtual machine. When you write your program, you access system resources (such as I/O, for example) by calling methods in the classes that implement the Java Application Programming Interface, or Java API. As your program runs, it fulfills your program's Java API calls by invoking methods in class files that implement the Java API. 

The Java Virtual Machine
At the heart of Java's network-orientation is the Java virtual machine, which supports all three prongs of Java's network-oriented architecture: platform independence, security, and network-mobility. 

A Java virtual machine's main job is to load class files and execute the bytecodes they contain. As you can see in Figure 1-3, the Java virtual machine contains a class loader, which loads class files from both the program and the Java API. Only those class files from the Java API that are actually needed by a running program are loaded into the virtual machine. The bytecodes are executed in an execution engine. 

Coding standard
Java suggests set of coding standard to follow while writing java program. Coding standard helps author as well as others to better understand program. It reduce amount of debugging time considerably. Basically coding standard suggests how to name class, methods variables of different scope, package etc.

Writing a Java program
In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine1 (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine.