Advertisement

AI is harder than I thought

Started by April 12, 2014 03:18 PM
38 comments, last by LAURENT* 10 years, 9 months ago

Haha. I was trying to read it to see the flow of it, but i figured that is just how you wrote your code.

In my study of AI, I don't think it is best to make a random AI. Normal human intelligence isn't random.

The whole story goes that there is a computer that can beat any human at a game of chess. It learns your natural patterns and then adapts to beat you. So the more it plays you, the better it comes at beating you. Eventually it will beat you every time. This takes advantage of the fact that humans, no matter how random they try to be, are really not so random.

I actually think the scenario was a game of rock, paper, scissors, but the idea applies everywhere.

That is why I think fuzzy logic is the best way to do AI for such games as tic-tac-toe, because it becomes naturally fair, since the computer isn't using a mathematical algorithm for solving the game, but an imprecise observation and guessing at the solution to any current problem. So it is bound to make human-like errors, that keep the game fun.

And fuzzy logic is actually not as hard. I am doing research in this area, and I should be finished with it (an implementation as well) by next Saturday.

They call me the Tutorial Doctor.

The whole story goes that there is a computer that can beat any human at a game of chess. It learns your natural patterns and then adapts to beat you. So the more it plays you, the better it comes at beating you. Eventually it will beat you every time. This takes advantage of the fact that humans, no matter how random they try to be, are really not so random.


What are you talking about?


I actually think the scenario was a game of rock, paper, scissors, but the idea applies everywhere.


Oh, I see: Rock-paper-scissors, tic-tac-toe, chess, brain surgery... It's all the same in your mind, unencumbered by detailed knowledge of anything in this subject.

That is why I think fuzzy logic is the best way to do AI for such games as tic-tac-toe, because it becomes naturally fair, since the computer isn't using a mathematical algorithm for solving the game, but an imprecise observation and guessing at the solution to any current problem. So it is bound to make human-like errors, that keep the game fun.

And fuzzy logic is actually not as hard. I am doing research in this area, and I should be finished with it (an implementation as well) by next Saturday.


What time on Saturday do you think you'll be finished with it?
Advertisement

Fuzzy logic is not applicable to tic-tac-toe. Tutorial Doctor has learned a new word, but seems to lack understanding of what it means.

For any given turn in tic-tac-toe, each square can be classified as:

  • I will win if I go here
  • Opponent will win next turn if he goes here
  • If I go here, I can win the following turn
  • None of the above

If 1 or 2 exist, the choice is clearly "go there". Otherwise choose 3 if one exists. If multiples of any category exist, choose one at random. If none apply, randomly choose a square. It may be possible to prove that the centre square is best here and that diagonals are better than the others.

There is absolutely nothing fuzzy about any of this.

http://en.wikipedia.org/wiki/Fuzzy_logic

I wouldn't use fuzzy logic everywhere, because humans have exact knowledge too. And I use fuzzy logic in all of the above games.

The term is new, but the idea is as old as the first human.

Aardvajk, there are other classifications for squares, unless one presumes the computer knows the perfect game or the best move on every turn. In the event the square is classified as "none of the above," what does the computer do?

Most normal humans don't know the best move for every turn, unless they have studied the game (gotten more exact knowledge about it.)

So the way I would do it is keep the base fuzzier, and the increase in difficulty more exact.
Fuzzy logic isn't the end all be all.

I'm not sure what time l will have it done Saturday. I have to work during the week. I've just started to collect the info I have learned so far last night. I still do have a lot to learn about it, but I can get a simple implementation done by then.

A better link to info on fuzzy logic is:

http://www.seattlerobotics.org/encoder/mar98/fuz/fl_part1.html#INTRODUCTION

They call me the Tutorial Doctor.

We understand you are excited about fuzzy logic, TD. It is one of those approaches that have a sexy name and a good story to go with it. The same is true of neural networks and genetic algorithms.

But until you get some actual experience solving problems with fuzzy logic, please stop telling everyone that it is the solution to their problems. You simply don't know if that's the case.

When [smart] humans play tic-tac-toe, they generally can look a few moves ahead. Minimax search might be a better analog of how humans behave in this context.

Aardvajk is right. Fuzzy state machines are not applicable to tic tac toe in any shape or form. The game AI has only one state "play to win", you can't really have a "play to win a bit" or "play to win a lot" states depending on external factors in something so basic as tic-tac-toe. It doesn't even really make sense in this context.

As an example: Where Fuzzy logic shines is for a guard AI in a stealth game . Well designed enough, it allows to have something between the patrol state and the alert state, giving more human-like reactions than what you'd get from a simple finite state machine. A guard would have heard you, but due to distance and other factors he isn't sure sure if it's an error or your location so it continues his patrol but with a wider cone of vision / improved hearing / etc depending on how sure he is to have heard an intruder.

Aardvajk, there are other classifications for squares, unless one presumes the computer knows the perfect game or the best move on every turn. In the event the square is classified as "none of the above," what does the computer do?

In that case any choices that would lead to have a 2 X (if you're X) in a row/column/diag is to be picked, otherwise, none offer an advantage over the others.

If i recall correctly you need to pick center as a first move in all cases (no matter if you play first or second).

Most normal humans don't know the best move for every turn, unless they have studied the game (gotten more exact knowledge about it.)

Are we talking about the same game here ? Because yes they do. Play tic tac toe with a child for 10 games or so and none of you two will ever loose a game after that.

Advertisement

If fuzzy logic wasn't already an established term, and used in many fields of engineering and programming systems, then I might sound more like a fangirl, but it is established, and used in more applications than I can yet expound upon. Again, the term is new, but the idea is old.

In short, it allows computers to mimic human decision making. And why wouldn't it be a good suggestion in the case of tic-tac-toe, chess, or any other game? Tic-tac-toe is all about decision making.

And yes, people can look a few moves ahead, but not a novice, in which case such an ability would represent an more skilled player.

The OP doesn't have to take it from me, perhaps they would be better taking it from you, since you are more experienced. Or perhaps they might look into it?

And I intend to solve a problem with fuzzy logic by Saturday.

They call me the Tutorial Doctor.

Aardvajk is right. Fuzzy state machines are not applicable to tic tac toe in any shape or form. The game AI has only one state "play to win", you can't really have a "play to win a bit" or "play to win a lot" states depending on external factors in something so basic as tic-tac-toe. It doesn't even really make sense in this context.

As an example: Where Fuzzy logic shines is for a guard AI in a stealth game . Well designed enough, it allows to have something between the patrol state and the alert state, giving more human-like reactions than what you'd get from a simple finite state machine. A guard would have heard you, but due to distance and other factors he isn't sure sure if it's an error or your location so it continues his patrol but with a wider cone of vision / improved hearing / etc depending on how sure he is to have heard an intruder.

Aardvajk, there are other classifications for squares, unless one presumes the computer knows the perfect game or the best move on every turn. In the event the square is classified as "none of the above," what does the computer do?

In that case any choices that would lead to have a 2 X (if you're X) in a row/column/diag is to be picked, otherwise, none offer an advantage over the others.

If i recall correctly you need to pick center as a first move in all cases (no matter if you play first or second).

Most normal humans don't know the best move for every turn, unless they have studied the game (gotten more exact knowledge about it.)

Are we talking about the same game here ? Because yes they do. Play tic tac toe with a child for 10 games or so and none of you two will ever loose a game after that.

These things assume that the opponent/computer always plays the optimal move on every turn. Not all 2 year olds know how to do this.

Here is a case and point. I once played the highest difficulty on the chessmaster PC game. I knew the computer would play optimally, and that it was taught the best move in every case. But in some cases, it would play the best move provided I play the best move. So I played an off-the-wall move. The next move, the computer made a blunder.

Then I captured the computer's queen, and then the game froze indefinitely, because it could not compute a win. Not fair.

So, not only does such logic make a game more fair (I don't want to have fun, and not loose every time) but it actually can be fine tuned where you can increase difficulty based on a skill level. Also, the computer won't be so predictable (it would be predicable if a human counterpart also knew how to exploit the fact that at the end of the day, a computer is a computer, and it might have a few bugs somewhere).

I'd love to play a game of chess against a computer that uses human reasoning. It makes the game more unpredictable, yet not random, because usually, every move is with some measure of intent, for better or worse.

They call me the Tutorial Doctor.

This is the point in a thread that Nathan222 mentions JARVIS normally.

Derailed = true. Sorry if I was any part of that. Just like newcomers to be given decent advice on here.

Here is a case and point. I once played the highest difficulty on the chessmaster PC game. I knew the computer would play optimally, and that it was taught the best move in every case. But in some cases, it would play the best move provided I play the best move. So I played an off-the-wall move. The next move, the computer made a blunder.

Then the computer did not play optimally. You might have discovered a bug in the AI code for the chess program, or it might have been completely unrelated to what you were doing, and just triggered a different bug.

This is actually a concept you hear quite often if you follow chess a bit -- "well, just play something completely random/unexpected and you'll circumvent the logic behind the other person's moves, and you'll beat a grand champion even if you're a noob".

A good chess player will crush you instantly if you make any "silly" moves like that -- they are silly for a reason. If using them was a good tactic, then the good chess players would use that sort of thinking.

That said, I don't necessarily agree with every Tic-Tac-Toe player being able to play it flawlessly, but I don't see Tic-Tac-Toe AI as being a fuzzy logic shaped problem.

Hello to all my stalkers.

This topic is closed to new replies.

Advertisement