Hello everyone. @Tjstretch: The latest version you uploaded here, seems to have multiple errors in it. Are these errors occuring at your side too?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hello everyone. @Tjstretch: The latest version you uploaded here, seems to have multiple errors in it. Are these errors occuring at your side too?
For AI Script, i will first check the grid size. Then algorithm will start working, let's say it's my turn, so i will mark at the place whose probability of winning is more than any other box. Opponent will mark, algorithm will now check the possibility of winning of the remaining grid. There will be a method which will be called after every turn opponent makes, which will check and return the highest winning probability cell (box).
Now, how this method will work.
If the grid is empty, most probably the center one has the highest probability to win (as far as i know ) so mark center, opponent will make his/her turn and this method will be called, initially there will be 3 main logic to implement on this.
1. Check if there is any place if opponent can win, if there is, mark the place or if it can win.
2. If 1 fails, (means no place to win for opponent), see the diagonals and parallel places for empty box to place a mark.
3. If 2 fails too, Count for the number of empty boxes, evaluate if there can be a win for either player, if yes, see the (well.... ummm... it's confusing, i guess i can't explain it here but implement )
@ 2cd Post Well that is certainly very impressive. , can't wait to see it implemented! The play method will always be called on your turn, and (when another bug is fixed) there will always be a spot open.
Yes, there are multiple bugs/missing functionality (Especially in the TTTBot) in the one I have, it is most certainly not complete! However it should compile without any errors (It does), if you are having issues compiling it may be because I am on java 1.7, which has some slightly different syntax.
Yeah i figured it out on my ownif you are having issues compiling it may be because I am on java 1.7, which has some slightly different syntax.
And sure, i will implement it as soon as i could coz i am going to have up-coming project this January first week so i will finish with this, early January.
Well, after googling i found many of already developed AI algorithms for Tic Tac Toe. Why don't you use those instead of developing new? That's just a question from you, may be you have some reasons. But i want to make them clear.
Yeah, I assumed they were out there, but I didn't want to remove anyone the fun of developing an algorithm themselves. If you don't feel a need to develop a new algorithm or attempt to implement a new one, that's certainly fine. (I'm sure the ones released are pretty amazing )
I don't feel bad attempting to implement a new algorithm but what i thought was to use Alpha-Beta Pruning and after search i found there are already several algorithms implemented for this then why need to write our own? As said, Write Once Use Everytime you need to. So, why bothering implementing the same thing twice with just wasting time of implementing the same scenarios, conditions etc stuff
Why bother doing anything if it has already been done? Why bother going back to the moon or taking a second look at those fuzzy patches in the telescope? It is not the end result I am interested in here; tic-tac-toe is hardly exciting. All I am interested in is if I can do it and if not then what do I need to learn.
Anyway, I have started work on my own AI and had a flash of inspiration. I am going to create an abstract bot class and implement it in several 'personality' classes. Game will use polymorphism to ask the given personality which move to make given the board as a parameter.
- Bot 1 never makes a mistake
- Bot 2 randomly makes a mistake every n turns
- Bot 3 randomly picks a square without any thought
- Bot 4 randomly picks a square but remembers options that did not work
et cetera. My idea is to have a choice of bots to play against, better yet; play bots against each other. Could even swap bots in and out of play while a round is in progress.
Fine. Going to the moon, nice, what if you can't afford going to moon? What you do is a look of previous visits or the history.Why bother doing anything if it has already been done? Why bother going back to the moon or taking a second look at those fuzzy patches in the telescope? It is not the end result I am interested in here; tic-tac-toe is hardly exciting. All I am interested in is if I can do it and if not then what do I need to learn.
Same, if you got enough time to develop your own AI script, go on but what if you are making this for a client and it's deadline after two days and you need to complete this in the day end? Will you still write your own? Don't be such a pessimist, i just said, why bothering writing and wasting a huge time, waiting for AI scripts to implement, instead use already developed AI algorithms.
As i don't have enough time to do all this or to waste my time on already developed algorithms, one of the many things i was taught is to use already developed thing to let your work get completed.
Why do you use API's? Why don't you create your own?
I guess, this thread will get too personal. So, let these comments come to PM. Christopher if you got any comments, against this, PM me.
Thanks
@Mr. 777 - pm sent with an apology.
I have been too lazy to do much, but I have implemented the random bot and the perfect bot. Unfortunately, there is a problem with my algorithm for the perfect bot and it falls back to random behavior. It is not calculating the weights correctly. I will take a look at it next year.
I have also decided to put in a 'thinking time' for the bots to give them human reactions. There is an object diagram in the zip file.
Happy new year all!