/** * Interactions driver for the Eliza game. * * @since 21 March 2008 */ import java.io.*; //import java.text.*; public class Interactions{ /** * Run the program - starting with the eliza * method. * * @param args unused */ public static void main(String[] args) { Interactions i = new Interactions(); i.eliza(); } /** * Run the Eliza game */ public void eliza(){ BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); // define data you need to play the game // ... System.out.println("Ask me a question. \n:>"); try{ String s = input.readLine(); while (!(s == null) && s.length() > 0){ // find out the reply to the question s // and print the reply System.out.println(":>"); s = input.readLine(); if (s == null || s.length() == 0){ System.out.println("Goodbye"); } } } catch(IOException e){ System.out.println("Goodbye"); } } }