06 May 2019, 04:08 | #1 |
Registered User
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 675
|
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. |
06 May 2019, 09:59 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
That sounds reasonable, but for AI in games like this, I prefer to use the "look ahead" method: make a copy of the board and do a look ahead calculation to see what the board might look like in a number of moves, starting from the first empty space. Then, from that board, calculate a score for how well that move has worked. It can then repeat the process for each possible move, and the empty space with the highest score at the end is the one to go for. By adding extra scoring criteria and look ahead moves, you can adjust the difficulty.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Tac 2 versions? | astraldimension | Retrogaming General Discussion | 0 | 13 March 2015 12:55 |
tic-tac-toe game written in amos | parabola | Looking for a game name ? | 1 | 04 May 2014 08:35 |
Old Tic-tac-toe game with naked ladies | Shoonay | request.Old Rare Games | 1 | 25 September 2011 22:37 |
WANTED TAC-2 Joysticks | Vars191 | MarketPlace | 4 | 02 June 2008 13:56 |
tac 2 problem | mtb | support.Hardware | 3 | 21 November 2003 12:46 |
|
|