View Single Post
Old 06 May 2019, 04:08   #1
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
Idea and help for tic tac toe AI

AI Method

A) Check to see which spaces are empty

B) Check to see which spaces filled belong to the opposing enemy

C) Check to see which spaces filled belong to AI itself

D) Calculate the opposing enemy how many lines formed in adjacent motion that could result in winning. It checks the vertical, it checks the horizontal and it checks the adjacent.

E) If the enemy can win regardless of which of those you blocked because it can win the other lines formed in the board then it checks to see if it should use the move to win first. If the AI have no winning move..it will randomly pick any of the types formed and block it.

F) If there are only one formed line whether it is horizontal, vertical, or adjacent as a winning move then it blocks that line and uses it's turn to prevent the enemy from winning.

G) If there are only 3 lines formed from the opposing enemy then it rolls a dice and it decide 50/50 if it should bother block it or do a different move.

H) If it does not block that player then it checks the space filled for the AI and see which is line that is formed either horizontal, vertical or adjacent that could trigger a winning move and place the piece to win the game.

I) It rolls a dice and there are 50% chance of randomly placing in the available space or 50% chance it checks and see if the horizontal or vertical or ascending row total to five (that belongs to you or is empty), if it total five and there are more than one possibility then it calculate the row indexes into an array and store total count of number of rows that are adjacent to each other and it is more than one. Then it randomly pick the index array that store the row and column information and based on that it adds the piece either to the right/left/up/down or adjacent to the row/column/adjacent.


Guys this is the AI I am working for my game. What do you guys think? Does anyone have any awesome brainstorming for improving the AI more and more for my game? Did I miss anything else?

Thanks in advance.
xboxown is offline  
 
Page generated in 0.07255 seconds with 11 queries