Friday, March 23, 2012

Cows and Bulls in Java

A basic implementation of Cows and Bulls game in Java. In this program I have used Absolute Positioning concept (No specific reason for using absolute positioning, just wanted to try it). JTable is used to display entered words and score (number of cows and bulls).

External links:
Source code [pastebin]
Source code with data file [.zip]

Saturday, March 10, 2012

Hangman in Java

    We all have played  Hangman at some point of time in our lives. This is a basic implementation of Hangman game in Java using Canvas. In this implementation, the word to guess is chosen randomly from a file. Hangman diagram is represented by a series of images. Each time player makes a false guess a new image is loaded containing one more element of the hangman than in the previous image. Images are loaded using Java Image I/O API. Rest of the logic can be understood by reading the code and comments. The entire code and required resources can be downloaded from here. Also, I have uploaded the source file on pastebin for quick reference.

Happy Coding!