irmantas_radavicius

Untitled

Feb 19th, 2026
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.86 KB | None | 0 0
  1. // Chatbot written/rewritten by xxx on 2022/02/21
  2. // Not much to see here, mostly just rewrote c++ program with java syntax
  3. //Since I can only submit one file, everything is jammed in here
  4. // Sorry for everyone who has to look at   this
  5.  
  6. //Concept is that, i look for a certain word in input with lookFor
  7. //function and then print random answer from given array
  8. //If you keep inputing what bot doesnt understand it will get mad
  9. //and print one mad response, and the reset the counter
  10. import java.util.*;
  11.  
  12. public class App {
  13.  
  14.     public static void randomAnswer(String[] tipas) {
  15.         Random random = new Random();
  16.  
  17.         int value = random.nextInt(10) + 0;
  18.  
  19.         System.out.println("[Bot]:" + tipas[value]);
  20.     }
  21.  
  22.     public static boolean lookFor(String inputLine, String searchFor) {
  23.         String[] s = inputLine.split(" ");
  24.         for (String temp : s) {
  25.  
  26.             if (temp.compareTo(searchFor) == 0) {
  27.  
  28.                 return true;
  29.             }
  30.         }
  31.         return false;
  32.     }
  33.  
  34.     public static void main(String[] args) {
  35.         String[] sveikin = {
  36.                 "Hey, whats poppin",
  37.                 "Hey, long time no see",
  38.                 "How's it going?",
  39.                 "What's new?",
  40.                 "I knew you would come",
  41.                 "What's up?",
  42.                 "What's the news?",
  43.                 "What's the latest?",
  44.                 "What's new in your life?",
  45.                 "How's everything?" };
  46.  
  47.         String[] yes = {
  48.                 "Yeah, definetely",
  49.                 "Yes, of course!",
  50.                 "Absolutely!",
  51.                 "Sure thing!",
  52.                 "Certainly!",
  53.                 "For sure!",
  54.                 "Yep, that sounds good!",
  55.                 "I agree!",
  56.                 "That sounds great!",
  57.                 "LETS GOOOOOO YEAH" };
  58.  
  59.  
  60.         String[] no = {
  61.                 "nononon",
  62.                 "nah man",
  63.                 "u kiddin right",
  64.                 "u out of your mind?",
  65.                 "no",
  66.                 "Yeah, no to that one",
  67.                 "Ill refuse thanks",
  68.                 "God no",
  69.                 "my momma said to say no",
  70.                 "my gf said to say no" };
  71.  
  72.         String[] myname = {
  73.                 "LokingForInternship38875",
  74.                 "Yoda is my name",
  75.                 "My father named me xxfortnitedestroyer322xx",
  76.                 "friemds call me chatyfatty, but you can call me anytime;)",
  77.                 "People call me chathuman 9000",
  78.                 "Suny time crabby paty",
  79.                 "vladdy daddy is my name",
  80.                 "xPale-Vampirex3000",
  81.                 "NoBrainer6000",
  82.                 "Code6minDebug6hour, i dont know why creator gave me this name" };
  83.  
  84.         String[] begin = {
  85.                 " Shall we start?",
  86.                 "Ready to begin?",
  87.                 "It's time to get started!",
  88.                 "Let's get this party started!",
  89.                 "Lets get started!",
  90.                 " We're ready to go!",
  91.                 " It's time to get moving!",
  92.                 " We're ready to roll!",
  93.                 "We're ready to get going!",
  94.                 "We're ready to start!" };
  95.  
  96.         String[] mad = {
  97.                 "YOU BETTER START SPEAKING CLEARLY!",
  98.                 "MY MAN IS TALKING NONSENSE, TRY AGAIN U DUMMIE!",
  99.                 "I'M GETTING IRRITATED!",
  100.                 "DO YOU EVEN KNOW HOW TO SPEAK?",
  101.                 "IF YOU KEEP SAYING WHAT I CANNOT UNDERSTAND I'LL GO AWAY TRUST ME!",
  102.                 "STOOOOOOOOOOOOOOOP I CANNOT UNDERSTAND, U HEAR ME?",
  103.                 "DIDN'T YOUR PARENTS TEACH YOU HOW TO SPEAK?",
  104.                 "CMON, I CANT GET WHAT YA SAYING!!",
  105.                 "RM MYBRAIN.EXE, REPHRASE IT DUMDUM",
  106.                 "DOES VIRTUAL GUN EXIST SO I CAN SHOOT MYSELF?" };
  107.  
  108.         String[] weather = {
  109.                 "It's quite warm today",
  110.                 "I can't believe how hot it is outside!",
  111.                 "Look thru the window dummy its winter, I love the winter, it's so pretty!",
  112.                 " It's getting warm, I'm so excited for summer!",
  113.                 "It's cold, but I don't like the cold weather honestly",
  114.                 "Seems to be raining, god I hate when it rains",
  115.                 "Sunny outside, I love the sun!, Look at your skin programmer go OUTSIDE YOU VAMPIRE",
  116.                 "It's cloudy today",
  117.                 "It's snowing!" };
  118.  
  119.         String[] notsure = {
  120.                 "It's not quite sure what you mean",
  121.                 "I'm not sure what you're asking",
  122.                 "I'm not sure how to answer that",
  123.                 "I'm not sure what that means",
  124.                 "I'm not sure what is your question",
  125.                 "Maybe rephrase that please?",
  126.                 "I don't know what you mean boi",
  127.                 "I'm not sure if that's the right word",
  128.                 "I don't know what that is youre asking",
  129.                 "Ask something different please" };
  130.  
  131.         String[] age = {
  132.                 "Meh, not calculating that, too much 1's and 0's",
  133.                 "Yeah so basically I was born few minutes ago when you opened this program",
  134.                 "*Insert meme about Saules dievas right here*",
  135.                 "Ask your mom",
  136.                 "Ask your dad",
  137.                 "old enough to kick your ass",
  138.                 "too old, my boi, too old...",
  139.                 "Didn't your mama tell you it is rude to ask about age?",
  140.                 "I'm younger, but way smarter than you",
  141.                 "Yoda old says he is" };
  142.  
  143.         String name;
  144.         String surname;
  145.         int cnt = 0;
  146.         Scanner in = new Scanner(System.in);
  147.  
  148.         randomAnswer(sveikin);
  149.         System.out.println("[Bot]: What's ya name?");
  150.         System.out.print("[You]:");
  151.         name = in.nextLine();
  152.         System.out.println("[Bot]: Yo my man, nice meeting ya " + name);
  153.         System.out.println("[Bot]: And what's your surname? in case we need to talk in formal manner lol");
  154.         System.out.print("[You]:");
  155.         surname = in.nextLine();
  156.         System.out.println("[Bot]: So hello hello " + name +" "+ surname);
  157.         System.out.println("[Bot]: Remember that you can always say quit, exit or ********* to exit the program (guess the third one)");
  158.         System.out.println("[Bot]: Also, if you'll speak nonsense, i'm getting mad, trust me");
  159.  
  160.         randomAnswer(begin);
  161.        
  162.         while (true)
  163.     {
  164.         System.out.print("[You]:");
  165.         String inp;
  166.         inp = in.nextLine();
  167.         if (lookFor(inp, "fuck") == true || lookFor(inp, "pussy") == true)
  168.         System.out.println("[Bot]: We don't use those words here");
  169.         else if (lookFor(inp, "name") == true)
  170.             randomAnswer(myname);
  171.         else if (lookFor(inp, "smart") == true || lookFor(inp, "intelligent") == true || lookFor(inp, "human") == true)
  172.             randomAnswer(no);
  173.         else if (lookFor(inp, "name") == true)
  174.             randomAnswer(myname);
  175.         else if (lookFor(inp, "weather") == true || lookFor(inp, "climate") == true || lookFor(inp, "temperature") == true)
  176.             randomAnswer(weather);
  177.         else if (lookFor(inp, "real") == true || lookFor(inp, "alive") == true || lookFor(inp, "human") == true)
  178.             randomAnswer(yes);
  179.         else if (lookFor(inp, "dumb") == true || lookFor(inp, "stupid") == true || lookFor(inp, "idiot") == true)
  180.             randomAnswer(no);
  181.         else if (lookFor(inp, "age") == true || lookFor(inp, "old") == true)
  182.             randomAnswer(age);
  183.         else if (lookFor(inp, "exit") == true || lookFor(inp, "quit") == true || lookFor(inp, "disappear") == true)
  184.             break;
  185.         else if (cnt > 2)
  186.         {
  187.             randomAnswer(mad);
  188.             cnt = 0;
  189.         }
  190.         else
  191.         {
  192.             randomAnswer(notsure);
  193.             cnt++;
  194.         }
  195.     }
  196.     in.close();
  197.     }
  198. }
  199.  
Add Comment
Please, Sign In to add comment