minimax

Minimax algorithm

I have a simple question regarding the Minimax algorithm: for example for the tic-tac-toe game, how do I determine the utility function's for each player plays? It doesn't do that automatically, does it? I must hard-code the values in the game, it can't learn them by itself, does it? ...

How does minimax work?

Here's the case. I'm trying to make a Chess engine. Not that I believe that I can make anything better than what's already out there, but I want to see how it works. I've made some of the important parts, such as board representation and the evaluation function. The evaluation function seems to produce decent results, so now I need to im...

Determining time and space complexity

I am having some trouble determining space and time complexities. For example, if I have a tree that has a branching factor b and will have at most a depth d, how can I calculate the time and space complexities? I know they are O(b^d) and O(bd) , but my problem is how to get to those values. Thanks! ...

Minimax use already evaluated tree. Where is my flaw?

Hi, I just started trying to use the minimax/negamax algorithm and I came up with an idea that sounds good for me, but as nobody is using it it might be a flawed logic. Why don't we do this: Create a three with depth=x, figure out which move to make, and wait for our opponent. After he did his move we can just take the subtree of the m...

minimax depth first search game tree

Hi I want to build a game tree for nine men's morris game. I want to apply minimax algorithm on the tree for doing node evaluations. Minimax uses DFS to evaluate nodes. So should I build the tree first upto a given depth and then apply minimax or can the process of building the tree and evaluation occur together in recursive minimax DFS...

Minimax algorithm: Cost/evaluation function?

Hi guys, A school project has me writing a Date game in C++ (example at http://www.cut-the-knot.org/Curriculum/Games/Date.shtml) where the computer player must implement a Minimax algorithm with alpha-beta pruning. Thus far, I understand what the goal is behind the algorithm in terms of maximizing potential gains while assuming the oppo...

Implementing custom comparison with CustomComparison and CustomEquality in F# tuple

Hello folks! I'm here to ask a specific topic - I really found few info about this on the web. I'm implementing a F# version of Minimax algorithm. The problem I'm having now is that I want to compare Leaf of my tree (data structure below). Searching the erros the VS gave to me I arrived to something like this: The tree type I used to h...

How to return the best first level in this F# minimax?

Hello folks, This question is more a semantic-algorithmic-data-structure question than a F# syntactically question. I have a Minimax algorithm. The minimax algorithm should return the best next move, from a start position. To do this, it calculus all next moves, then the next-next-moves until a determined depth or until there is no more...

Checkers/draughts using minimax in C#

Hello, I have homework in **c#**. I have to make a game (such as checkers, chess or something else, but not tic tac toe - and I choose checkers/draughts) with using **minimax** and **alphabeta**, but I don't even know how to start :( **And I have a tight deadline**. I worked with c# a little bit at school, but I'm not a programmer. Now ...

C++ minimax function

I have searched Google and Stackoverflow for this question, but I still don't understand how a minimax function works. I found the wikipedia entry has a pseudocode version of the function: function integer minimax(node, depth) if node is a terminal node or depth <= 0: return the heuristic value of node α = -∞ for ch...

Did I implement this minimax function correctly?

It's for a game of checkers. See revision history for older versions of code. private static Move GetBestMove(Color color, Board board, int depth) { var bestMoves = new List<Move>(); var validMoves = board.GetValidMoves(color); int highestScore = int.MinValue; Board boardAfterMove; int tmp...

Minimax: how can I implement it in Python?

As long as I've been a programmer I still have a very elementary level education in algorithms (because I'm self-taught). Perhaps there is a good beginner book on them that you could suggest in your answer. ...

How to implement minimax in Tictactoe

I read this answer, and it just confused me: http://stackoverflow.com/questions/1869096/tictactoe-ai-making-incorrect-decisions#answer-1869226 Could somebody help me understand how I could apply this to Tictactoe? 1) How would I "work my way up through the tree? 2) How do I even create a tree of moves? Note: I currently have a Board c...

Minimax explained for an idiot.

I've wasted my entire day trying to use the minimax algorithm to make an unbeatable tictactoe AI. I missed something along the way (brain fried). I'm not looking for code here, just a better explanation of where I went wrong. Here is my current code (the minimax method always returns 0 for some reason): from copy import deepcopy cla...

game search tree, Do I have to build the tree first?

hi all, in game search tree there are many algorithms to get the optimal solution, like minimax algorithm. I start learn how to solve this problem with minimax algorithm, the algorithm clear. but I'm confused about the tree itself, in games like tic tac toe number of node not very huge, but on others like chess there are many nodes. i th...