TheGeek Posted December 20, 2005 Posted December 20, 2005 hi, does anyone know where can i get a source code for a java AI bot? i am making a website and would like to build and host a bot on there. If i want to put something on a website does it need to be an applet or can i just put a java program on there? I need code for a bot so that i can just add the stuff that i want to add and don't need to do everything like "hi" and stuff. thanks
Mike Kovich Posted December 20, 2005 Posted December 20, 2005 http://www.pandorabots.com/botmaster/en/home It is not really a java thing, but you can register (Free) and then create a robot, you can build it, train it with responses, and soooo much more. Once you are done, you can put it on your website. You can even view the chat logs between people and your bot.
RyanJ Posted December 20, 2005 Posted December 20, 2005 how do i put it on my website? The site does not tell you that :S Try using an IFrame with its SRC attribute set too where the page is located, if that does not work search the site or contact the site managers Cheers, Ryan Jones
TheGeek Posted December 20, 2005 Author Posted December 20, 2005 Currently when you goto the robot page, there are google ads. If i use frames and put the robot on my site, do i need to put the ads on there?
RyanJ Posted December 20, 2005 Posted December 20, 2005 Currently when you goto the robot page, there are google ads. If i use frames and put the robot on my site, do i need to put the ads on there? Anything in the page would be included in the IFramle unless you resize it too show just the part of the page you want, it cna be done but it cna be trickey too work out too. Cheers, Ryan Jones
TheGeek Posted December 20, 2005 Author Posted December 20, 2005 i need help from someone that knows java. i am just starting to learn and have this code: [b]public[/b] [b]class[/b] New_bot { [b]public[/b] [color=#800000]static[/color] [color=#800000]void[/color] [color=#000080]main[/color]([color=#0095FF][b]String[/b][/color][] args) { EasyReader input=[b]new[/b] [color=#000080]EasyReader[/color](); [color=#0095FF][b]String[/b][/color] question; { [color=#0095FF][b]System[/b][/color].[color=#000080]out[/color].[color=#000080]println[/color]([color=#DD0000]"Hi, I am the P.A.I.B.(Plaine Artificial Intellegence Bot!)"[/color]); [color=#0095FF][b]System[/b][/color].[color=#000080]out[/color].[color=#000080]println[/color]([color=#DD0000]"What can I do for you today?"[/color]); question = input.[color=#000080]readLine[/color](); question=question.[color=#000080]toLowerCase[/color](); [color=#808080][i]//all lower case[/i][/color] [b]if[/b] (question.[color=#000080]indexOf[/color]([color=#DD0000]"hi"[/color])!=-[color=#0000FF]1[/color]) [color=#0095FF][b]System[/b][/color].[color=#000080]out[/color].[color=#000080]println[/color]([color=#DD0000]"Hello!"[/color]); [b]else[/b] [b]if[/b] (question.[color=#000080]indexOf[/color]([color=#DD0000]"hello"[/color])!=-[color=#0000FF]1[/color]) [color=#0095FF][b]System[/b][/color].[color=#000080]out[/color].[color=#000080]println[/color]([color=#DD0000]"Hi!"[/color]); [b]else[/b] [color=#0095FF][b]System[/b][/color].[color=#000080]out[/color].[color=#000080]println[/color]([color=#DD0000]"I don't know. I am still learning. Try some other question."[/color]); } } } this is the code for a program. How do i make an applet that will do the exact same thing? Also, how do i make it so that it doesn't just stop after one question and keeps looping? thanks i would really appreciate it if someone can help me with this:)
Freeman Posted December 21, 2005 Posted December 21, 2005 Also, how do i make it so that it doesn't just stop after one question and keeps looping? You mean so it will ask the question over and over again, right? import objectdraw.*; import java.awt.*; public class New_bot { public Bot(//String[] args maybe?) { EasyReader input=new EasyReader(); String question; int joey=1; System.out.println("Hi, I am the P.A.I.B.(Plaine Artificial Intellegence Bot!)"); while(joey>0) { } public void Entered_Text(String j) { j=j.toLowerCase(); //all lower case String reply; if (j.indexOf("hi")!=-1) reply="Hello!"; else if (j.indexOf("hello")!=-1) reply="Hi!"; else reply="I don't know. I am still learning. Try some other question."; return reply; joey++; } } } That's the lazy way of solving the problem I don't know about programming this online, but if you use a boolean for checking if the page has loaded for the first time for the user or not and have it say "Welcome back." or something of the sort, but this is overkill more likely and done with more ease with PHP. As far as making an applet (oh God!) I know how to do it, but it's been a while. If you use that class and then you need to put it in the folder you are go to be using. Then (uh...) you need to make a code somewhat like the following: import objectdraw.*; import java.awt.*; public class New_Bot extends WindowController { public void begin() { Bot joe; joe = new Bot(); } } Then you would probably want to include methods of some sort for some reason. You would probably want to double check all of this, since I haven't dealt with this in a great deal of time. I hate applets
TheGeek Posted December 21, 2005 Author Posted December 21, 2005 You mean so it will ask the question over and over again' date=' right? import objectdraw.*; import java.awt.*; public class New_bot { public Bot(//String[] args maybe?) { EasyReader input=new EasyReader(); String question; int joey=1; System.out.println("Hi, I am the P.A.I.B.(Plaine Artificial Intellegence Bot!)"); while(joey>0) { } public void Entered_Text(String j) { j=j.toLowerCase(); //all lower case String reply; if (j.indexOf("hi")!=-1) reply="Hello!"; else if (j.indexOf("hello")!=-1) reply="Hi!"; else reply="I don't know. I am still learning. Try some other question."; return reply; joey++; } } } That's the lazy way of solving the problem I don't know about programming this online, but if you use a boolean for checking if the page has loaded for the first time for the user or not and have it say "Welcome back." or something of the sort, but this is overkill more likely and done with more ease with PHP. As far as making an applet (oh God!) I know how to do it, but it's been a while. If you use that class and then you need to put it in the folder you are go to be using. Then (uh...) you need to make a code somewhat like the following: import objectdraw.*; import java.awt.*; public class New_Bot extends WindowController { public void begin() { Bot joe; joe = new Bot(); } } Then you would probably want to include methods of some sort for some reason. You would probably want to double check all of this, since I haven't dealt with this in a great deal of time. I hate applets [/quote'] i tried this it's not working well, let me ask you one question, why do you have import objectdraw.*; import java.awt.*; in the first code. Why is this even needed, the first code isn't even supposed to be an applet.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now