Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Created October 17, 2012 15:06
Show Gist options
  • Save rummelonp/3906046 to your computer and use it in GitHub Desktop.
Save rummelonp/3906046 to your computer and use it in GitHub Desktop.
会話できる人工知能のプログラム (Java)
/**
* $ 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