/* HANGMAN FOR JAVA (c)1998/99 by Markus Birth This is the first program I wrote in Java. Thanks to Mr. Fröbel for making me learning Java so quick (We had to finish our projects for the computer science lessons.) Things used for the making of this: -Xemacs with its Revision Control System -hangman.java from Carlos von Hoyningen-Huene -some bottles of PEPSI Coke -hints & tips from Carlos von Hoyningen-Huene */ import java.applet.*; import java.awt.*; import java.awt.event.*; import java.lang.Character.*; import java.math.*; // eigentlich nur für die eine Zufallszahl import java.io.*; // für Dateioperationen ("Tupfer, Schere ...") public class hangman extends Frame { // Globale Variablen final static int WND_B=400, WND_H=400; RandomAccessFile file; int maxdat=0; String words[]; String myword=null; char xyword[]; char probed[]; char alphab[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N', 'O','P','Q','R','S','T','U','V','W','X','Y','Z', 'Ä','Ö','Ü'}; int mistakes=0; KL CONTROL; char c; public hangman() { String stmp=new String(); try { RandomAccessFile f=new RandomAccessFile("hangman.dat","r"); words=new String[50]; while ((stmp=f.readLine())!=null && maxdat<50) { if (stmp.charAt(0) != '#') { maxdat++; words[maxdat]=stmp; } } f.close(); while (myword==null) { myword=words[(int)(Math.random()*maxdat)+1]; } } catch(IOException ioe) { System.out.println("IOException: "+ioe.toString()); } CONTROL=new KL(); addKeyListener(CONTROL); xyword=new char[myword.length()]; for (int i=1;i