Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Chatbot written/rewritten by xxx on 2022/02/21
- // Not much to see here, mostly just rewrote c++ program with java syntax
- //Since I can only submit one file, everything is jammed in here
- // Sorry for everyone who has to look at this
- //Concept is that, i look for a certain word in input with lookFor
- //function and then print random answer from given array
- //If you keep inputing what bot doesnt understand it will get mad
- //and print one mad response, and the reset the counter
- import java.util.*;
- public class App {
- public static void randomAnswer(String[] tipas) {
- Random random = new Random();
- int value = random.nextInt(10) + 0;
- System.out.println("[Bot]:" + tipas[value]);
- }
- public static boolean lookFor(String inputLine, String searchFor) {
- String[] s = inputLine.split(" ");
- for (String temp : s) {
- if (temp.compareTo(searchFor) == 0) {
- return true;
- }
- }
- return false;
- }
- public static void main(String[] args) {
- String[] sveikin = {
- "Hey, whats poppin",
- "Hey, long time no see",
- "How's it going?",
- "What's new?",
- "I knew you would come",
- "What's up?",
- "What's the news?",
- "What's the latest?",
- "What's new in your life?",
- "How's everything?" };
- String[] yes = {
- "Yeah, definetely",
- "Yes, of course!",
- "Absolutely!",
- "Sure thing!",
- "Certainly!",
- "For sure!",
- "Yep, that sounds good!",
- "I agree!",
- "That sounds great!",
- "LETS GOOOOOO YEAH" };
- String[] no = {
- "nononon",
- "nah man",
- "u kiddin right",
- "u out of your mind?",
- "no",
- "Yeah, no to that one",
- "Ill refuse thanks",
- "God no",
- "my momma said to say no",
- "my gf said to say no" };
- String[] myname = {
- "LokingForInternship38875",
- "Yoda is my name",
- "My father named me xxfortnitedestroyer322xx",
- "friemds call me chatyfatty, but you can call me anytime;)",
- "People call me chathuman 9000",
- "Suny time crabby paty",
- "vladdy daddy is my name",
- "xPale-Vampirex3000",
- "NoBrainer6000",
- "Code6minDebug6hour, i dont know why creator gave me this name" };
- String[] begin = {
- " Shall we start?",
- "Ready to begin?",
- "It's time to get started!",
- "Let's get this party started!",
- "Lets get started!",
- " We're ready to go!",
- " It's time to get moving!",
- " We're ready to roll!",
- "We're ready to get going!",
- "We're ready to start!" };
- String[] mad = {
- "YOU BETTER START SPEAKING CLEARLY!",
- "MY MAN IS TALKING NONSENSE, TRY AGAIN U DUMMIE!",
- "I'M GETTING IRRITATED!",
- "DO YOU EVEN KNOW HOW TO SPEAK?",
- "IF YOU KEEP SAYING WHAT I CANNOT UNDERSTAND I'LL GO AWAY TRUST ME!",
- "STOOOOOOOOOOOOOOOP I CANNOT UNDERSTAND, U HEAR ME?",
- "DIDN'T YOUR PARENTS TEACH YOU HOW TO SPEAK?",
- "CMON, I CANT GET WHAT YA SAYING!!",
- "RM MYBRAIN.EXE, REPHRASE IT DUMDUM",
- "DOES VIRTUAL GUN EXIST SO I CAN SHOOT MYSELF?" };
- String[] weather = {
- "It's quite warm today",
- "I can't believe how hot it is outside!",
- "Look thru the window dummy its winter, I love the winter, it's so pretty!",
- " It's getting warm, I'm so excited for summer!",
- "It's cold, but I don't like the cold weather honestly",
- "Seems to be raining, god I hate when it rains",
- "Sunny outside, I love the sun!, Look at your skin programmer go OUTSIDE YOU VAMPIRE",
- "It's cloudy today",
- "It's snowing!" };
- String[] notsure = {
- "It's not quite sure what you mean",
- "I'm not sure what you're asking",
- "I'm not sure how to answer that",
- "I'm not sure what that means",
- "I'm not sure what is your question",
- "Maybe rephrase that please?",
- "I don't know what you mean boi",
- "I'm not sure if that's the right word",
- "I don't know what that is youre asking",
- "Ask something different please" };
- String[] age = {
- "Meh, not calculating that, too much 1's and 0's",
- "Yeah so basically I was born few minutes ago when you opened this program",
- "*Insert meme about Saules dievas right here*",
- "Ask your mom",
- "Ask your dad",
- "old enough to kick your ass",
- "too old, my boi, too old...",
- "Didn't your mama tell you it is rude to ask about age?",
- "I'm younger, but way smarter than you",
- "Yoda old says he is" };
- String name;
- String surname;
- int cnt = 0;
- Scanner in = new Scanner(System.in);
- randomAnswer(sveikin);
- System.out.println("[Bot]: What's ya name?");
- System.out.print("[You]:");
- name = in.nextLine();
- System.out.println("[Bot]: Yo my man, nice meeting ya " + name);
- System.out.println("[Bot]: And what's your surname? in case we need to talk in formal manner lol");
- System.out.print("[You]:");
- surname = in.nextLine();
- System.out.println("[Bot]: So hello hello " + name +" "+ surname);
- System.out.println("[Bot]: Remember that you can always say quit, exit or ********* to exit the program (guess the third one)");
- System.out.println("[Bot]: Also, if you'll speak nonsense, i'm getting mad, trust me");
- randomAnswer(begin);
- while (true)
- {
- System.out.print("[You]:");
- String inp;
- inp = in.nextLine();
- if (lookFor(inp, "fuck") == true || lookFor(inp, "pussy") == true)
- System.out.println("[Bot]: We don't use those words here");
- else if (lookFor(inp, "name") == true)
- randomAnswer(myname);
- else if (lookFor(inp, "smart") == true || lookFor(inp, "intelligent") == true || lookFor(inp, "human") == true)
- randomAnswer(no);
- else if (lookFor(inp, "name") == true)
- randomAnswer(myname);
- else if (lookFor(inp, "weather") == true || lookFor(inp, "climate") == true || lookFor(inp, "temperature") == true)
- randomAnswer(weather);
- else if (lookFor(inp, "real") == true || lookFor(inp, "alive") == true || lookFor(inp, "human") == true)
- randomAnswer(yes);
- else if (lookFor(inp, "dumb") == true || lookFor(inp, "stupid") == true || lookFor(inp, "idiot") == true)
- randomAnswer(no);
- else if (lookFor(inp, "age") == true || lookFor(inp, "old") == true)
- randomAnswer(age);
- else if (lookFor(inp, "exit") == true || lookFor(inp, "quit") == true || lookFor(inp, "disappear") == true)
- break;
- else if (cnt > 2)
- {
- randomAnswer(mad);
- cnt = 0;
- }
- else
- {
- randomAnswer(notsure);
- cnt++;
- }
- }
- in.close();
- }
- }
Add Comment
Please, Sign In to add comment