Search This Blog

Tuesday, July 30, 2013

Snakes and Ladders Game in Java


Snakes and Ladders game is an interesting and a fun game to play with friends. I have built a basic snakes and ladders game using the SWT (Standard Widget Toolkit) when I learned it long back, using just the SWT labels and MS Paint to create a board game.
You can download the source code by clicking the link Download Source Code


Instructions:
The following are the instructions to set up the source code in Eclipse IDE.
i)                    Import the project into Eclipse’s Workspace by clicking on File -> Import
ii)                   Select the root directory and check on the “Copy Projects into workspace” and click Finish.
iii)                 Once the project is loaded , it shows that it loaded with Errors
iv)                 Right Click on the project and click on Properties and select Build Path. The libraries are missing that is the cause for the error.  We  need to provide the correct path for the libraries

v)                  All the jar files will be present in the Eclipse folder, we just need to find it and give the name For e.g. we will take the first one “org.eclipse.osgi_3.8.2.v20130124-134944.jar
vi)                 Click on the Add External jar button

vii)               Navigate to the file “org.eclipse.osgi_3.8.2.v20130124-134944.jar” and add it, also remove the entry that previously showed error.
a.       Add the correct external jar
b.      Remove the jar that already showed error
viii)              Repeat the steps 4 to 7 for the remaining 11 build path errors.
ix)                 Once the build paths are set correct, we can run the Java Application. Right Click on the Dice.java  and select run as “Java Application”

x)                  Now we can select players to Play, it supports maximum of 3 players. Click on include to include the players and give a name
xi)                 Click on Roll, to roll your dice. Each ones turn will be displayed in the Roll box. Have Fun :)

You can download the source code by clicking the link DownloadSource Code

No comments:

Post a Comment

Labels