English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

Thread Tools
Old 06 May 2019, 05:08   #1
Registered User
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 552
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  
Old 06 May 2019, 10:59   #2
Registered User

Daedalus's Avatar
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,115
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.
Daedalus is offline  

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 13:55
tic-tac-toe game written in amos parabola Looking for a game name ? 1 04 May 2014 09:35
Old Tic-tac-toe game with naked ladies Shoonay request.Old Rare Games 1 25 September 2011 23:37
WANTED TAC-2 Joysticks Vars191 MarketPlace 4 02 June 2008 14:56
tac 2 problem mtb support.Hardware 3 21 November 2003 13:46

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 09:26.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.07424 seconds with 13 queries