Discuss Scratch
- Discussion Forums
- » Show and Tell
- » 【AI】One of the most intelligent scratch version of Gomoku AI in the world
- bluestar1106
-
Scratcher
7 posts
【AI】One of the most intelligent scratch version of Gomoku AI in the world
Game link https://scratch.mit.edu/projects/372339044/
Ways to make very smart Gomoku AI
1. Draw the chessboard. If the AI score is high, the player will start first, otherwise the AI will start first.
2. AI first move: The first step is to place the pawn in the middle of the board, and then it is the player's turn (if the player's score is ahead, the player first moves)
3. Players play chess: first assist the mouse in positioning, if the pieces are not out of bounds or stacked, then determine the position of black chess, then turn AI
4. Othello traversal: traverse how many black / white pawns are in all four directions of black / white, determine which direction has the most black / white, judge dead, checkers, and rush, and find a row with black / white End point coordinates (checkers need to find holes)
5. Two-player mode: Determine whether to enter the two-player mode. The two-player AI and black games are almost the same.
6. Chess priority: White Live 4 or White Rush 4 > Black Live 4 or Black Rush 4> White live 3> Black live 3> White charge 3> Black charge 3> White live 2> Black live 2> Other, select With the highest priority, White will attack as the priority, and Black will defend as the priority.
7. Defense strategy: Put white chess at one of the endpoint coordinates. If there is no checkers at the other endpoint (such as jump 3) and the coordinates of this endpoint are not out of bounds or stacked, then put it at this endpoint and vice versa. An endpoint
8. Offensive strategy: Same as above, the defensive strategy is to block black, and the offensive strategy is to even white.
9. Judging the victory and defeat: After Black is finished, If one party wins, clear the screen and add points, and the corresponding sound and background screen appear.
制作非常智能的五子棋AI的方法
1.绘制棋盘,如果AI分数高就玩家先手,否则AI先手
2.AI先手:第一步把棋子放到棋盘中间,然后轮到玩家(如果玩家分数领先就玩家先手)
3.玩家下棋:先对鼠标进行定位辅助,如果棋子没有出界也没有叠棋那么就判定黑棋的位置,然后轮AI
4.黑白棋遍历:遍历所有黑/白棋四个方向有多少黑/白棋子,判断哪个方向的黑棋/白最多,判断死棋、跳棋和冲棋,并找到黑/白棋最多一列的端点坐标(跳棋需要找到穴)
5.双人模式:判断是否进入双人模式,双人模式AI和黑棋程序几乎相同
6.下棋优先级:白活4或白冲4>黑活4或黑冲4>白活3>黑活3>白冲3>黑冲3>白活2>黑活2>其他,选择最高的优先级,白棋作为优先级就进攻,黑棋作为优先级就防御(跳活优先级等于连活)
7.防御策略:把白棋放到其中一个端点坐标,如果另一个端点不存在跳棋(例如跳活3)且这个端点坐标没有出界也没有叠棋,那么就放在这个端点,反之放在另一个端点
8.进攻策略:同上,防御策略是堵黑棋,进攻策略是连白棋
9.判断胜负:黑棋下完后,如果某一方获胜就清除屏幕后加分,并且出现对应的声音和背景画面
Ways to make very smart Gomoku AI
1. Draw the chessboard. If the AI score is high, the player will start first, otherwise the AI will start first.
2. AI first move: The first step is to place the pawn in the middle of the board, and then it is the player's turn (if the player's score is ahead, the player first moves)
3. Players play chess: first assist the mouse in positioning, if the pieces are not out of bounds or stacked, then determine the position of black chess, then turn AI
4. Othello traversal: traverse how many black / white pawns are in all four directions of black / white, determine which direction has the most black / white, judge dead, checkers, and rush, and find a row with black / white End point coordinates (checkers need to find holes)
5. Two-player mode: Determine whether to enter the two-player mode. The two-player AI and black games are almost the same.
6. Chess priority: White Live 4 or White Rush 4 > Black Live 4 or Black Rush 4> White live 3> Black live 3> White charge 3> Black charge 3> White live 2> Black live 2> Other, select With the highest priority, White will attack as the priority, and Black will defend as the priority.
7. Defense strategy: Put white chess at one of the endpoint coordinates. If there is no checkers at the other endpoint (such as jump 3) and the coordinates of this endpoint are not out of bounds or stacked, then put it at this endpoint and vice versa. An endpoint
8. Offensive strategy: Same as above, the defensive strategy is to block black, and the offensive strategy is to even white.
9. Judging the victory and defeat: After Black is finished, If one party wins, clear the screen and add points, and the corresponding sound and background screen appear.
制作非常智能的五子棋AI的方法
1.绘制棋盘,如果AI分数高就玩家先手,否则AI先手
2.AI先手:第一步把棋子放到棋盘中间,然后轮到玩家(如果玩家分数领先就玩家先手)
3.玩家下棋:先对鼠标进行定位辅助,如果棋子没有出界也没有叠棋那么就判定黑棋的位置,然后轮AI
4.黑白棋遍历:遍历所有黑/白棋四个方向有多少黑/白棋子,判断哪个方向的黑棋/白最多,判断死棋、跳棋和冲棋,并找到黑/白棋最多一列的端点坐标(跳棋需要找到穴)
5.双人模式:判断是否进入双人模式,双人模式AI和黑棋程序几乎相同
6.下棋优先级:白活4或白冲4>黑活4或黑冲4>白活3>黑活3>白冲3>黑冲3>白活2>黑活2>其他,选择最高的优先级,白棋作为优先级就进攻,黑棋作为优先级就防御(跳活优先级等于连活)
7.防御策略:把白棋放到其中一个端点坐标,如果另一个端点不存在跳棋(例如跳活3)且这个端点坐标没有出界也没有叠棋,那么就放在这个端点,反之放在另一个端点
8.进攻策略:同上,防御策略是堵黑棋,进攻策略是连白棋
9.判断胜负:黑棋下完后,如果某一方获胜就清除屏幕后加分,并且出现对应的声音和背景画面
Last edited by bluestar1106 (March 1, 2020 10:37:37)
- bluestar1106
-
Scratcher
7 posts
【AI】One of the most intelligent scratch version of Gomoku AI in the world
I come from china,I want to make friends from foreign country
- bluestar1106
-
Scratcher
7 posts
【AI】One of the most intelligent scratch version of Gomoku AI in the world
I come from china,I want to make friends from foreign country
- bluestar1106
-
Scratcher
7 posts
【AI】One of the most intelligent scratch version of Gomoku AI in the world
I come from china,I want to make friends from foreign country
- bluestar1106
-
Scratcher
7 posts
【AI】One of the most intelligent scratch version of Gomoku AI in the world
I come from china,I want to make friends from foreign country
- Discussion Forums
- » Show and Tell
-
» 【AI】One of the most intelligent scratch version of Gomoku AI in the world