Questions tagged [minmax]

This tag apparently is used as a synonym for "minimax", which seems more appropriate and is better maintained; I would suggest introduction of a tag synonym.

225 questions
33
votes
6 answers

Is there a way to easily handle functions returning std::pairs?

C++11 has function std::minmax_element which returns a pair of values. This, however, is quite confusing to handle and read, and produces an extra, later useless variable to pollute the scope. auto lhsMinmax = std::minmax_element(lhs.begin(),…
Adam Hunyadi
  • 1,770
  • 11
  • 26
14
votes
1 answer

Alpha-beta prunning with transposition table, iterative deepening

I'm trying to implement alpha-beta min-max prunning enhanced with transposition tables. I use this pseudocode as reference: http://people.csail.mit.edu/plaat/mtdf.html#abmem function AlphaBetaWithMemory(n : node_type; alpha , beta , d : integer) :…
11
votes
3 answers

Comparing std::minmax against a pair

The standard algorithms min and max can be compared against a single value. However, the minmax algorithm return value cannot be compared against a pair of values: #include #include template constexpr auto…
TemplateRex
  • 65,583
  • 16
  • 147
  • 283
8
votes
3 answers

How to find minimum, maximum length strings generated given a regular expression?

How to find minimum and maximum length given a regular expression ? For example [1-9]?[0-9] This regular expression can generate a minimum 1 (0 or 1 0r 2.... or 9) and a maximum of string length 2 (10 or 11 or 12 or ......19 or 20 or…
7
votes
5 answers

Get the element in the array with the max value of a property using jQuery

I have an array of a custom JavaScript object which has a property named order. I have an array of this object, and I want to get the item with the highest "order". Since I'm relatively new to jQuery, and coming from a C# background this is one of…
Kassem
  • 7,574
  • 16
  • 69
  • 113
6
votes
1 answer

denormalize data

I normalized data with the minimum and maximum with this R code: normalize <- function(x) { return ((x - min(x)) / (max(x) - min(x))) } mydata <- as.data.frame(lapply(mydata , normalize)) How can I denormalize the data ?
myID33
  • 149
  • 2
  • 7
6
votes
2 answers

Finding the best move using MinMax with Alpha-Beta pruning

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…
StepTNT
  • 3,705
  • 5
  • 34
  • 77
6
votes
2 answers

How does cv::mask should look like for opencv minMaxLoc?

easy question but can't figure it out. normaly its void minMaxLoc(InputArray src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray()) But how does the mask looks like? This is what i want: Its an…
user1651460
  • 391
  • 1
  • 4
  • 15
6
votes
1 answer

SELECT min max and max min value from a part of a table in MySQL

I want to select min max and max min values for each value in table1 from another table2. sample input table2 name, value,y f1, .01,.04 f1,.02,.05 f1,.05,.06 f1,.45,.07 f2,.03,.09 f2,.05,.02 table1 name, value f1, .04 f2,.04 expected…
Karunakar
  • 1,899
  • 4
  • 13
  • 20
6
votes
1 answer

Python dictionary keys as set of numbers

I'd like to structure a dictionary in python whose keys are pairs of min/max values between 0 and 1. For instance: myDict = {(0, .5): 'red', (.5, 1): 'orange'} I'd like to be able to call entries in the dictionary with a number within the set [min,…
Hank
  • 339
  • 1
  • 3
  • 7
5
votes
3 answers

Negamax - player moves twice

How do you handle games where, if a condition is met, the same player moves ? I tried something like this but I don't think it's quite right: function negamax(node, depth, α, β, color) if node is a terminal node or depth = 0 return color…
John Retallack
  • 1,358
  • 2
  • 15
  • 31
5
votes
2 answers

Alphabeta pruning, alpha equals or greater than beta. Why equals?

While I understand the MiniMax tree and alpha-beta pruning concept, I don't understand why in many (for example wikipedia) resources about alpha-beta pruning there is condition like α >= β. Specifically, the equals is confusing. As I understand, the…
5
votes
2 answers

Othello evaluation function

I am currently developing a simple AI for othello using min-max and Alpha-beta pruning. My question is related to the evaluation function for the state of the board. I am currently looking to evaluate it by counting 1) Disc count 2) No of legal…
natchan
  • 138
  • 1
  • 1
  • 12
4
votes
2 answers

MinMax trees - when Min can win in two steps

So, I have been playing around with minmax trees to create a simple computer player in a two person board game. I understand the basics of the algorithm, but there is a case that eludes my turkey infused brain ... what happens when MIN can win in…
Christian
  • 471
  • 4
  • 6
4
votes
5 answers

Is my sorting question in ascending order a good solution?

#include using namespace std; int main() { // Problem #2 Ascending Order int num1, num2, num3, small, medium, large; cin >> num1 >> num2 >> num3; if(num1 <= num2 && num1 <= num3) { small = num1; if(num2 <= num3) { medium…
Woyal
  • 43
  • 2
1
2 3
14 15