Ok so the idea is to have live chess matches using Ustream and my chess robot on the front page of LMR. So i understand i need a IRC client and stuff. I have already made a bot and have it linked up to my Ustream. I need serial data from the commands that are typed into ustream from LMR members, like b8->b9, to go to my Arduino so the chess robot can move the piece. I have never written a computer program in my life and i dont know where to start or what to use. Please help so frits will stop bugging me. :)
I can only show you the code I used to interface an IRC channel with … erhm … I forgot. I think Darwinbot used several different programs to get code loaded up. The IRC “receiver” simply placed little files on disk.
My code was written in Perl.It does not use any fancy libraries, so the actual interpreting of IRC sentences lies bare in the main code. That could be very educational.
You say you never wrote a computer program. That also can be a good thing. Now you get to choose a language. This is the same kind of choice as the choice for a micro controller or language. Whatever suits you. Ask around for options. Who is willing to support you in your programming and your lessons.
I for one could only help you with Perl and maybe some Processing.org. And be willing to.
I found this http://blog.datasingularity.com/?p=148, which exactly what i want to do. He is using Python. I am trying to figure out what programming language would be best for something like this so i can start learning it. Yes any advice on a programming language would be very helpful.
The link you posted has the code you will need I believe. I didn’t read to far into it, but from what I can see you can define functions that the python bot will read in IRC and will run Arduino functions based on it.
In IRC, a user can say “arduino: funcution” which causes a function in the Arduino code to run. In your case you would let players send a message like “arduino: rook to A8.”, which would run a function that reads the current location of the players rook and moves it to A8. (I don’t play chess much, if A8 doesn’t exist, don’t make fun of me!)
Tinker with that code, it’ll work just as you need.
Well looks like i will be going with Perl. Ran this fine http://oreilly.com/pub/h/1964. Getting all the messages from what is being typed into ustream, i just have to break them apart and stuff.
Ok attached the script. Cant get the last if statement working. For some reason move is the last 6 characters of the message, maybe there is a \n in there?
Patrick, I discovered how to overcome the problem that guests need to log in before they are allowed to write anything in the channel. You must remove the mode-flag “moderated” from the channel. Only the “broadcaster” (or in IRC lingo “channel operator”) can do that. That means you.
Here’s how to do that. From the ustream show page: write "/mode #patrickmccb -m" From Mirc: write "/mode #patrickmccb -m" From your perl script: send a string to server "MODE #patrickmccb -m" using the perl command: print $sock “string”;
Just a little update. I hope to get it up and running this weekend, but no promises.
I have been working on getting the Perl script to do more of the work that the chess bot code would have to do instead. So now the perl script sends the chess bot the exacte numbers that will be inputed into the gantry crane moving functions to move the crane to the correct position, move the piece, and return to the start position (a8). I wrote this today and will be testing and debugging tomorrow. Once it can move pieces fine, and i get the “killing” function in the perl script too, then it will go live. After that it would be a matter of adding to the perl script so i can control who is playing chess, remove players, add players, etc.
Oh and i will have to write a short post on the operation of the internet bot.