alpha-beta-pruning

MiniMax with Alpha Beta Pruning for Othello not working

穿精又带淫゛_ 提交于 2019-12-13 02:37:16
问题 I have the following implementation of a alpha beta minimax for an othello (reversi) game. Somehow, this never really returns the proper action to take. It seems to return the default action I put in the function (0, 0) and the secondary value of -32768, which means it got pruned at the MAX subroutine. Any tips on what I can improve with this and how I can fix this problem? Note: I've identified the successors being returned properly for the most part. The max depth for now is 8. Computer

How to get actual move rather than move value from mini max algorithm

纵饮孤独 提交于 2019-12-10 10:39:52
问题 I am currently writing a minimax algorithm with alpha beta pruning for Chess. From all the examples I have seen, minimax algorithm will return an int value that represents that best score or board state that will result from the best move. My question is how can we return the best move that is associated with the score return value? For example, my alphabeta() in pseudo below ... public int alphabeta(int depth, Board b, int alpha, int beta, boolean maxPlayer) { if(depth == 0) return

TicTacToe minimax algorithm returns unexpected results in 4x4 games

a 夏天 提交于 2019-12-08 21:17:30
问题 In my method newminimax499 I have a minimax algorithm that utilizes memoization and alpha beta pruning. The method works normally for 3x3 games, however when I play 4x4 games I get strange, unexpected position choices for the computer. He still never loses, but he doesn't seem to be playing to win. To illustrate the problem here is a scenario from 2 games in 3x3 and 4x4. First here is a scenario from a 3x3 game where the player is X and makes the first move: This isn't bad, in fact it's what

How to get actual move rather than move value from mini max algorithm

最后都变了- 提交于 2019-12-06 07:14:45
I am currently writing a minimax algorithm with alpha beta pruning for Chess. From all the examples I have seen, minimax algorithm will return an int value that represents that best score or board state that will result from the best move. My question is how can we return the best move that is associated with the score return value? For example, my alphabeta() in pseudo below ... public int alphabeta(int depth, Board b, int alpha, int beta, boolean maxPlayer) { if(depth == 0) return evaluateBoard(b); if(maxPlayer) { for(each of max player's moves) { // make move on a tempBoard int eval =

How to implement efficient Alpha-Beta pruning Game Search Tree?

空扰寡人 提交于 2019-12-05 10:39:37
问题 I'm trying to learn about artificial intelligence and how to implement it in a program. The easiest place to start is probably with simple games (in this case Tic-Tac-Toe) and Game Search Trees (recursive calls; not an actual data structure). I found this very useful video on a lecture about the topic. The problem I'm having is that the first call to the algorithm is taking an extremely long amount of time (about 15 seconds) to execute. I've placed debugging log outputs throughout the code

Alpha beta search time complexity

主宰稳场 提交于 2019-12-04 12:17:43
问题 I understand the basics of minimax and alpha-beta pruning. In all the literature, they talk about the time complexity for the best case is O(b^(d/2)) where b = branching factor and d = depth of the tree, and the base case is when all the preferred nodes are expanded first. In my example of the "best case", I have a binary tree of 4 levels, so out of the 16 terminal nodes, I need to expand at most 7 nodes. How does this relate to O(b^(d/2))? I don't understand how they come to O(b^(d/2)).

How to implement efficient Alpha-Beta pruning Game Search Tree?

白昼怎懂夜的黑 提交于 2019-12-03 21:51:35
I'm trying to learn about artificial intelligence and how to implement it in a program. The easiest place to start is probably with simple games (in this case Tic-Tac-Toe) and Game Search Trees (recursive calls; not an actual data structure). I found this very useful video on a lecture about the topic. The problem I'm having is that the first call to the algorithm is taking an extremely long amount of time (about 15 seconds) to execute. I've placed debugging log outputs throughout the code and it seems like it is calling parts of the algorithm an excessive amount of times. Here's the method

Alpha beta search time complexity

只愿长相守 提交于 2019-12-03 07:53:17
I understand the basics of minimax and alpha-beta pruning. In all the literature, they talk about the time complexity for the best case is O(b^(d/2)) where b = branching factor and d = depth of the tree, and the base case is when all the preferred nodes are expanded first. In my example of the "best case", I have a binary tree of 4 levels, so out of the 16 terminal nodes, I need to expand at most 7 nodes. How does this relate to O(b^(d/2))? I don't understand how they come to O(b^(d/2)). Please, can someone explain it to me? Thans a lot! O(b^(d/2)) correspond to the best case time complexity

Finding the best move using MinMax with Alpha-Beta pruning

若如初见. 提交于 2019-12-03 07:47:12
I'm working on an AI for a game and I want to use the MinMax algorithm with the Alpha-Beta pruning . I have a rough idea on how it works but I'm still not able to write the code from scratch, so I've spend the last two days looking for some kind of pseudocode online. My problem is that every pseudocode I've found online seems to be based on finding the value for the best move while I need to return the best move itself and not a number. My current code is based on this pseudocode ( source ) minimax(level, player, alpha, beta){ // player may be "computer" or "opponent" if (gameover || level ==

Chess: high branching factor

旧时模样 提交于 2019-12-03 02:29:30
问题 I'm trying to develop a simple chess engine, but I'm struggling with its performance. I've implemented Negamax with alpha-beta pruning and iterative deepening (without any additional heuristics), but I'm unable to get reasonable search time beyond 3-4th ply. Here is an excerpt from my program's log from the beginning of the game: 2013-05-11 18:22:06,835 [9] INFO CoevolutionaryChess.Engine.MoveSearchers.NegamaxMoveSearcher [(null)] - Searching at depth 1 2013-05-11 18:22:06,835 [9] DEBUG