Created
October 17, 2012 15:06
-
-
Save rummelonp/3906046 to your computer and use it in GitHub Desktop.
会話できる人工知能のプログラム (Java)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* $ javac -J-Dfile.encoding=utf-8 Intelligent.java | |
* $ java -Dfile.encoding=utf-8 Intelligent | |
*/ | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
import java.util.Random; | |
class Intelligent | |
{ | |
static String[] words = {"マジで", "ヤバい", "ウケルー"}; | |
public static void main(String args[]) | |
{ | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
Random random = new Random(); | |
try { | |
while (reader.readLine().length() > 0) { | |
System.out.println(words[random.nextInt(words.length)]); | |
} | |
} catch (IOException e) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment