Questions tagged [negamax]

Variant form of minimax search that relies on the zero-sum property of a two-player game. The objective is to find the best move for the player that's playing at the root node.

62 questions
0
votes
0 answers

How to improve search speed by adding multithreading to negamax algorithm (chess)

I need to improve the search speed for negamax algorithm, and I see that stockfish has used multithreading to do this. However when I tried spawning a thread for every child of a current node, that slowed down search time because of constant…
code_vader
  • 256
  • 1
  • 8
0
votes
2 answers

Stop a recursive function in Python

I am creating a chess engine and have some trouble getting it to stop calculating from its recursive negamax (minimax) framework. I want it to return best move so far when a given time limit is up. Here is how my code is structured: # Initial…
Eli
  • 156
  • 8
0
votes
0 answers

Negamax Algorithm with Alpha-Beta and Quiesce Search with Teams (4 Players)

Hey I am trying to implement negamax with alpha-beta and quiesce search with 4 players but it is a little different. For example, lets say 0 = Red, 1 = Blue, 2 = Yellow, and 3 = Green, and Red and Green are on the same team meaning 2 turns will be…
0
votes
0 answers

Negamax algorithm not giving constant behavior

I tried to create a chess engine in C using the Negamax with alpha-beta pruning, but I couldn't get it working. It works as expected in the first few moves of the game, and starts to sacrifice pieces without an aim. But as it nears the endgame, it…
Dhakshith
  • 66
  • 6
0
votes
1 answer

Alpha-beta pruning with transposition tables

I don't get why flags for table entries are used as they are. Consider e.g. the pseudocode for Negamax with alpha-beta pruning and transposition tables and concentrate on the TT parts. (* Transposition Table Lookup; node is the lookup key for…
0
votes
0 answers

Implement simple quiescence search algorithm

I'm trying to implement a simple quiescence search for my negamax AI (not chess - 10-10-5 mnk or gomoku style game called Take 5). It already has a transposition table. The main negamax algorithm looks like this: def negamax(board, depth, alpha,…
micsthepick
  • 562
  • 7
  • 23
0
votes
1 answer

(Python NegaMax Algorithm for Game of Nim) What is wrong with my code?

I am a new learner of AI. My assignment requires me to write a program in Python that plays the Game of Nim optimally (using the NegaMax algorithm). If you're not familiar with the game, here is a brief description: Nim is a simple two-player game.…
0
votes
1 answer

Multithreaded evaluation using Negamax + alpha-beta pruning with transposition tables

I just implemented a nice-working evaluation function for checkers. Current implementation uses threads and separate transposition tables for each. I spawn a thread for every move that is available in the root node (initial board position) and then…
user1880342
  • 128
  • 10
0
votes
0 answers

Negamax Implementation for Checkers/Draughts

I have been trying to implement a good AI for a checkers game made in Unity3D, by searching online I've found the best choice to be MiniMax/Negamax, so I have created this class: public static class NegaMax { public static IMiniMaxNode…
0
votes
1 answer

Negamax: what to do with "partial" results after canceling a search?

I'm implementing negamax with alpha/beta transposition table based on the pseudo code here, with roughly this algorithm: NegaMax(): 1. Transposition Table lookup 2. Loop through moves 2a. **Bail if I'm out of time** 2b. Make move, call -NegaMax,…
Jon Thysell
  • 377
  • 1
  • 10
0
votes
0 answers

Passing the return value from my negmax method

I've been working on this for a few days, at least. Testing seems to show the correct value is being returned. My problem is being able to grab the best_move value and have it print out. I set up the suggested_move method and try to use return…
stuartambient
  • 127
  • 1
  • 1
  • 10
0
votes
2 answers

Negamax for simple addition game

I'm trying to implement negamax for a simple game where the players alternate adding one or two to a running sum. The player that increases the total to 21 wins. I'm using the pseudocode here:…
David Bandel
  • 252
  • 3
  • 19
0
votes
1 answer

Negamax-search implementation not working when player can move twice in a row

I'm trying to implement Negamax search for a game called Nine Men's Morris in Java. If a player has three pieces in a row (here called a mill), he removes a opponent's piece (the 'additional' move) before switching turns. Additionally, there is a…
Jamest
  • 1
0
votes
3 answers

Python: ValueError: need more than 0 values to unpack - Negamax Algorithm for Chess

I'm trying to build a chess AI, and I'm running into a strange error. As a foreword, I did go through stackoverflow and try to find similar issues, but it didn't help me as I thought I was implementing tuple unpacking correctly and I can't seem to…
0
votes
1 answer

Negamax freezes

In a game I've created Negamax works well for low depth searches but larger depth increases causes it to freeze. I thought about changing depth to type 'long' instead of 'integer' but not sure what else I can do. I know computation will take longer…