AI is harder than I thought

Started by
38 comments, last by LAURENT* 9 years, 12 months ago
Snap crackle and pop! I was so thinking of checkers this whole time. I guess I'll still keep at the checkers AI I started on. Haha.

I've started on a tic tac toe AI too. It looks less fuzzy, although for opponent strategy, the offensiveness and defensiveness of the opponent can be fuzzy. However, the fuzziness is overwritten by the exact values. So it is layered.

If a player has two in a row, there is no fuzziness about it, you must block. And if you have two in a row, there is no doubt you must play 3 in a row to win. It is best move to take center on your first move, but one could take a corner.

These are my notes so far before I try to implement it. I am missing a few strategies I know. I still don't think a random move is necessary.


Offense:
-if you have two in a row play 3 in a row. This checks if adjacent squares are not taken first.
-if  not center taken then play center.
Else if not diagonal from center taken then play diagonally from center(check to see if they are taken and play the free one.
-Play adjacent to your pieces.

Defense:
-if opponent  has two in a row, play to block.
-in other words, check which squares they have occupied, and play the unoccupied square adjacent to them.

note to self: play to block could be a dominant strategy.

Victory condition:
If you have three in a row, you win
If they have three in a row, they win

Ai Notes:
What does you win, versus they win mean?
They is opponent (no matter how many)

The logic changes when attitude is a factor.

Defensive player plays to block more often.
Offensive player plays two in a row more often.
Balanced player a balance of defense and offense.
 
 Fuzzy values:
Offensiveness 
Defensiveness

Conditions override fuzzy tendencies. 

They call me the Tutorial Doctor.

Advertisement

Speaking of randomness and AI, like Lactose said in his first post in this thread, don't make a truly random AI, because it's cheating the players. In most games, players tend to learn their enemies as they play, and take actions according to what they've learned. For example, one learns a monster's behaviors in Monster Hunter and tries to take advantage from them, like by using traps the monster is weak against. Another example is how people learn attack patterns in action games and use that knowledge to defeat the enemy effectively. Players will feel better because they know they've learned something and get better. They won't feel cheated because a monster who appears weak to fire in the beginning turns to be fire-immune on the next stage.

Other than that, it also makes it easier to make, because it's easier to make a pre-determined AI than a random one. There's no need to make your AI much more complicated than it needs to be. wink.png

There's a lot of ways to actually implement AI but just keep in mind even without all the guides and tutorials and such the basic rule of AI in(well most games, not every case of course) games is usually, attempt to seem like a human.

So what does that really mean? Well think about tic-tac-toe, think about if you were playing with a friend and the decisions they might make while playing you, they probably will look at your moves and attempt to block you from winning, most of the time they would succeed at that unless perhaps you used an unusual shape that they might miss easily at one point. Another thing you could do that might be a nice quality of life point is to simulate fatigue of a sort on the computer, i.e. if they keep winning it might slightly increase their chance for a mistake or something.

Basically look at how a competitor or even you might come to decisions and try and emulate that in code, perhaps with some randomization and tweaking. One of the first times I made a rudimentary AI was for a Pong game, I tried a few different things and one of the best ways to make the AI seem more realistic was to make it act like a player. For instance a pong player will generally hover their paddle around the middle when the ball is traveling away from them as they watch for where it is going to bounce to, they also might be slow to respond or overshoot when the ball comes towards them quickly, that sort of thing.

Just some basic AI advice, think what you would do and how you could make the same thing appear with an AI player, sometimes subtle touches a player might not even ever see can make a big difference.


Bobby Fischer once played a move that was not the "best move" by the book, but because he understood the condition by another reasoning, he actually was playing the game against his opponent (using his pride) and not against the book.

Garry Kasparov made a 'finger fumble' in the opening of one of his games against Deep Blue and found the game lost before it ever left the opening stage.

Counting on your opponent's lack of knowledge is seldom a good strategy.

"The multitudes see death as tragic. If this were true, so then would be birth"

- Pisha, Vampire the Maquerade: Bloodlines

Well, it seems someone beat me to it. But in this presentation was the exact thing I was talking about. It is a powerpoint on AI (which you might find useful) and later on in the paper it talks about a tic tac toe AI it also mentions fuzzy logic, but I think it is for another example. The steps looks very identical to my steps I listed earlier.

You can use layers, but for tic tac toe, it might not be as necessary, although it would add a nice layer for realism.

http://www.cs.kent.edu/%7Emscherge/AI/Notes/chapter01.ppt

They call me the Tutorial Doctor.

Min-max is what everyone else was talking about. And that was just an intro to AI lecture. There are thousands of them online.


it talks about a tic tac toe AI it also mentions fuzzy logic

It doesn't, however, mention fuzzy logic in the context of tic tac toe. Its just on the following slide. Give this up.

Yeah, I know. A few posts ago I acknowledged that I was thinking of checkers and adjusted my reasoning. The adjustment I posted also, and then I found this document, and the adjustment I made for tic tac toe was the same here.

The link was given as a reference to AI, and also to how Fuzzy sets can be used, as well as how Tic tac toe can be done (independent in this case of fuzzy sets).

And I am not going to give up fuzzy logic altogether however, but in the case of tic tac toe, I already noted that it would not be necessary.

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.

What are you talking about?

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32

--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy

Listen there is no need to continue. This thread just needs to go now. 89% of this stuff wasn't really helpful. I'm still a beginner, I've been fighting just to make the computer take a turn because I had no idea how to make the computer press a button in SDL 1.5. You guys are sharp but thread is now pointless.

This topic is closed to new replies.

Advertisement