Questions tagged [minimax]

A concept used in artificial intelligence/game theory for two-player games. The idea is to minimize the opponent's gain and maximize yours. Questions using this tag cover problems understanding/implementing the algorithm.

Minimax involves generating a game-tree to consider all the possible outcomes of a game, given its present configuration. The minimax agent then chooses the branch which leads to the agent's maximum gain and, consequentially, to the minimum gain of the opponent (a zero-sum game).

While generating a whole game tree may seem a computationally expensive task, several techniques have been developed to reduce the computation time. One of the most famous techniques is Alpha-Beta Pruning: given a branch in the game tree, stop evaluating that branch ("prune") as soon as you find an outcome in that branch that is worse than a previously-examined branch. Some variations (such as those used in Chess programs) only consider up to a certain number of turns and not always up to end-game.

Another variation of minimax, termed as expectiminimax, introduces "chance" elements in the game such as dice throws.

Finally, note that while minimax is originally intended for two-player games, the technique has been extended to games with more complex set-ups.

Further reading:

910 questions
0
votes
1 answer

Alpha-beta pruning

I've implemented the following MiniMax algorithm for my Android Reversi game: @Override public Field findBestMove(GameBoard gb, int depth, boolean player) { /** maximum depth of search reached, we stop */ if(depth >= max_depth) return…
Michał Szydłowski
  • 3,261
  • 5
  • 33
  • 55
0
votes
2 answers

Minimax algorithm for connect 4

I've been trying to implement minimax algorithm in connect 4 but I encountered a problem that there are only two values to evaluate moves : infinity for winning game and -infinity for the opposite , and I need a huge deep to reach these values on…
user3129544
0
votes
1 answer

Difference between SVM and MPM (example)

I know the theorical difference between theses methods, but someone could give an example that make SVM != MPM? I think it's the same thing. An image would be awesome. SVM: Maximize margin between 2 samples classes MPM: Minimize the probability of…
0
votes
1 answer

MiniMax reversi implementation

I'm trying to implement a MiniMax algorithm in a Reversi/Othello game, and I'm pretty stuck, since the function I wrote looks perfectly normal, and yet I get some strange moves, and a crash after a few. Here's the function finding an optimum…
Michał Szydłowski
  • 3,261
  • 5
  • 33
  • 55
0
votes
3 answers

Optimize the locations of 2 additional restrooms on a trail (python)

This image shows a made-up trail with a restroom (cyan point). I would like to add 2 more restrooms where the maximum distance along trail from anywhere on the trail to the closest of the 3 restrooms is minimized. # Data # trail is a list of…
0
votes
1 answer

Minimax algorithm for Othello not working correctly

public class OthelloJPlayer extends OthelloPlayer { @Override public OthelloMove getMove(OthelloState state) { int bestchoice = 0; int bestscore = Integer.MIN_VALUE; boolean maximizingPlayer = true; // generate the list of…
0
votes
2 answers

Representation of a state in Ataxx game

I have already asked a question about the subject in here: https://stackoverflow.com/questions/19916951/generating-a-tree-form-array-for-ataxx-game-in-java But let me go step by step: What is the best way (or the best data structure) to represent a…
zallexy
  • 131
  • 1
  • 2
  • 7
0
votes
1 answer

Minimax implementation not working with recursion and C++

I basically have a game board, and the player can not move to the same spot more than once, or you lose. The player can move by -1, +1, -16, or +16 only. I want to use minimax to solve this problem, and receive the inputs used by minimax so I can…
Jason
  • 1,297
  • 12
  • 24
0
votes
1 answer

Implementing Alpha Beta into Minimax

I'm trying to add Alpha Beta pruning into my minimax, but I can't understand where I'm going wrong. At the moment I'm going through 5,000 iterations, where I should be going through approximately 16,000 according to a friend. When choosing the first…
Matt
  • 175
  • 2
  • 12
0
votes
1 answer

Artificial player evaluation

I have a problem concerning a board game I'm creating. I plan on making an artificial player for the game using MiniMax with AlphaBeta prunning, but I'm not sure how to evaluate ir the player is good at the game. Since it's a new game I can't get a…
0
votes
2 answers

MinMax AI for Checkers

I have created simple Checkers game in Java with minmax AI, but I doesn't work. I use recursive version of minmax, but there must be something wrong with it, because it returns moves, that aren't best, but maybe first generated. public int…
user2275785
  • 199
  • 1
  • 19
0
votes
2 answers

Track best move from Minimax

I know this kind of question has been asked before, but i was unable to solve my doubts. I have a simple Othello Engine (it plays very well actually), that uses the class below to get the best move: import java.util.*; import…
Fernando
  • 7,785
  • 6
  • 49
  • 81
0
votes
1 answer

Issue with MiniMax to Alpha-Beta Search Conversion

OK, my issue should sound pretty familiar to anyone who has played with board game programming, so here it is : I've implemented a variation of the MiniMax algorithm (returning moves instead of min/max values). I've also tried setting it up as an…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
0
votes
1 answer

minimax code returns always 0

I wrote an Alpha-Beta pruning from Wikipedia. I am trying to write a connect-four AI. The function should return column number, then my main function makes a move.
0
votes
1 answer

Alpha-beta pruning consecutive moves for same player

I have implemented alpha-beta pruning for Checkers and thought I had it working, but found out that the computer does not take multiple jumps in a row (when it has to). For example: AI does: O _ _ _ _ _ _ _ _ _ _ X _ X _ -> _ _ _ X _ …