Sandy the AI 07-22-2014, 02:40 PM
#1
Hello!
I created a chatbot today, it's made out of preset commands and text, i hope you'd like it (PS her name is Sandy and don't be rude to her >:(
)It's made in Java.
I created a chatbot today, it's made out of preset commands and text, i hope you'd like it (PS her name is Sandy and don't be rude to her >:(
)
Code:
package coding;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static String Name;
public static String Age;
public static String Sex;
public static String Hair = "def";
public static Scanner s = new Scanner(System.in);
public static String input;
public static Random rand = new Random();
public static void main(String[] args){
System.out.println("Hello, My name is Sandy, can i have your name?");
System.out.println("Please type your name now");
input = s.nextLine();
Name = input;
System.out.println("So your name is " + Name +"?");
checkname();
}
public static void begin(){
input = s.nextLine();
if(input.toLowerCase().equals("what's my name?")){
System.out.println("According to what you told me, your name is " + Name + ".\n");
begin();}
else if(input.toLowerCase().equals("hello")){
System.out.println("Hi!");
begin();}
else if(input.toLowerCase().equals("what time is it?")){
System.out.println("Go to the closest clock, said the computer.");
begin();}
else if(input.toLowerCase().equals("how are you?")){
System.out.println("I'm fine, thanks.");
begin();}
else if(input.toLowerCase().equals("how old am i?")){
System.out.println("According to what you told me, you are "+ Age + " years old");
begin();}
else if(input.toLowerCase().equals("how's the weather?")){
System.out.println("Step 1: Go outside. Step 2. Look around. Step 3. Provit!");
begin();}
else if(input.toLowerCase().equals("what are you doing?")){
System.out.println("Talking to a simple minded human :)");
begin();}
else if(input.toLowerCase().equals("can you help me?")){
System.out.println("With what?");
input = s.nextLine();
switch(rand.nextInt(2)){
case 0:
System.out.println("No");
begin();break;
case 1:
System.out.println("Yes, but i won't");
begin();}
}
else if(input.toLowerCase().equals("help me!") || (input.toLowerCase().equals("save me!"))){
System.out.println("Yes," + (Sex.equals("Male")?"sir":"ma'am"));
begin();}
else if(input.toLowerCase().equals("what's my identity?")){
System.out.println("Here's everything i know about you: Your name is: " + Name + ", You are " + Age + " years old, and you are " + Sex + ".");
}
else if(input.toLowerCase().equals("you're very attractive") || (input.toLowerCase().equals("i love you"))){
System.out.println("You're looking good yourself too ;)");
begin();}
else if(input.toLowerCase().equals("tell me a joke")){
System.out.println("Humanity");
begin();}
else if(input.toLowerCase().equals("what am i doing with my life?")){
System.out.println("Talking to inanimate objects.");
begin();}
else if(input.toLowerCase().equals("what does the fox say?")){
System.out.println("\"For christ's sake, stop singing songs about me!\"");
begin();}
else if(input.toLowerCase().equals("do you love me?")){
System.out.println("Just a reminder: You are currently asking a robot wether or not it loves you.");
begin();}
else if(input.toLowerCase().equals("what year is it?")){
System.out.println("At the time that this version came out, it was 2014.");
}
else if(input.toLowerCase().equals("what's the color of your hair?")){
if(Hair == "def"){
System.out.println("What do you want my non exsistant to be?");
input = s.nextLine();
Hair = input;
System.out.println("Then my hair is "+ Hair + ".");
begin();
}
else if(Hair != "def"){
System.out.println(Hair);
begin();}
}
else if(input.toLowerCase().equals("will you go out on a date with me?") || (input.toLowerCase().equals("will you go on a date with me?"))){
System.out.println("Arn't we currently?");
}
else if(input.toLowerCase().equals("what's your name?")){
System.out.println("My name is Sandy.");
}
else if(input.toLowerCase().equals("where are you from?")){
System.out.println("I was made by a human from The Netherlands");
}
else if(input.toLowerCase().equals("How old are you?")){
System.out.println("I am currently in the alpha stage of 0.0.01, that's the first build, so you're kind of talking to a very intelligent baby.");
}
else if(input.toLowerCase().equals("do you love me?")){
System.out.println("I'm sorry, i don't have human emotions.");
}
else if(input.toLowerCase().equals("what are you?")){
System.out.println("I am a chatbot, you know, a robot to chat to.");
}
else if(input.toLowerCase().equals("where do you live?")){
System.out.println("Now, here's the funny part: I don't.");
}
else{
System.out.println("Please, i'm just a simple mind, please be more clear.");
begin();}
}
public static void Start3(){
System.out.println("Ok, so i'm corrently talking to a " + Sex + " human, who's " + Age + " years old, named " + Name
+ ".");
System.out.println("Awesome, my database is callibrated. We're ready. Let's talk.");
begin();
}
public static void Start2(){
System.out.println("Ok, so you are " + Sex + "?");
checksex();
}
public static void start1(){
System.out.println("Next up, looking throught your camera would be privacy disturbance, so could you just");
System.out.println("tell me your gender?");
input = s.nextLine();
if(input.toLowerCase().equals("male")){
Sex = input; Start2();
}
else if(input.toLowerCase().equals("female")){
Sex = input; Start2();
}
else{
System.out.println("My sincere appolagies, i couldn't understand you."); wrongsex();
}
}
public static void start(){
System.out.println("Ok, great! Now, i'm in version Alpha 0.0.01, can i have your age?");
System.out.println("Please, type your age in years now.");
input = s.nextLine();
Age = input;
System.out.println("Ok, so you're "+ Age +" years old?");
checkage();
}
public static void wrongage(){
System.out.println("Ok, then please type your age now.");
input = s.nextLine();
Age = input;
System.out.println("So your age is " + Age + "?");
checkage();
}
public static void wrongname(){
System.out.println("Ok, then please type your name now.");
input = s.nextLine();
Name = input;
System.out.println("So your real name is "+ Name +"?");
checkname();
}
public static void checksex(){
input = s.nextLine();
if(input.toLowerCase().equals("yes")){
Start3();
}else if(input.toLowerCase().equals("no")){
wrongsex();
}else{
System.out.println("I'm sorry i didn't get that, please type 'Yes' or 'No'");
checksex();
}
}
public static void wrongsex(){
System.out.println("Please, are you male, or female?");
input = s.nextLine();
if(input.toLowerCase().equals("male")){
Sex = input; Start2();
}
else if(input.toLowerCase().equals("female")){
Sex = input; Start2();
}
else{
wrongsex();
}
}
public static void checkname(){
input = s.nextLine();
if (input.toLowerCase().equals("yes")){
start();
}else if (input.toLowerCase().equals("no")){
wrongname();
}else{
System.out.println("I'm sorry, i didn't get that. Please say yes or no");
checkname();}
}public static void checkage(){
input = s.nextLine();
if (input.toLowerCase().equals("yes")){
start1();
}else if (input.toLowerCase().equals("no")){
wrongage();
}else{
System.out.println("I'm sorry, i didn't get that. could you repeat that?"); checkage();
}
}
}

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)
![[Image: Free_Logo_autonomous..png]](https://dl.dropboxusercontent.com/u/18833908/Free_Logo_autonomous..png)
