Computers / Programming / Projects / Hangman

Overview

This is a simple hangman program written in java. During my second year of school one of my courses introduced some applet concepts during the last few lectures. I tried to make a hangman program as an example applet but it only worked in the IDE and not on the web so I ended up scraping the idea. Sometime later I was trying to think of a java program to write. I wanted to do something not related to school and while trying to think up what to make I remembered my old java applet. I didn’t have the code anymore but I remembered the framework I was going for so I remade the program from scratch but using the console for output instead of an applet frame.

Interface

Code

hangman.java

java type icon
Type: Main
Language: Java
hangman.java

man.java

java type icon
Type: Class
Language: Java
man.java

letter.java

java type icon
Type: Class
Language: Java
letter.java

word.java

java type icon
Type: Class
Language: Java
word.java

wordList.java

java type icon
Type: Class
Language: Java
wordList.java

This class defines the list of possible words for the game. It has one constructor that populates the list and has one program that randomly picks a word from the list. The actual list was created by a C program parsing a file. I went online and got a bunch of words in a variety of categories and put them together in a file with category headers to separate the lists. The C program then reads this file and builds the word constructor and vector add statement to be copied into the java code.