mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-24 18:43:17 +08:00
formatting source-code for d7af6fdc8c
This commit is contained in:
@@ -9,7 +9,8 @@ using std::min;
|
||||
using std::vector;
|
||||
|
||||
int minimax(int depth, int node_index, bool is_max, vector<int> scores,
|
||||
int height) {
|
||||
int height)
|
||||
{
|
||||
if (depth == height)
|
||||
return scores[node_index];
|
||||
|
||||
@@ -19,8 +20,9 @@ int minimax(int depth, int node_index, bool is_max, vector<int> scores,
|
||||
return is_max ? max(v1, v2) : min(v1, v2);
|
||||
}
|
||||
|
||||
int main() {
|
||||
vector<int> scores = { 90, 23, 6, 33, 21, 65, 123, 34423 };
|
||||
int main()
|
||||
{
|
||||
vector<int> scores = {90, 23, 6, 33, 21, 65, 123, 34423};
|
||||
int height = log2(scores.size());
|
||||
|
||||
cout << "Optimal value: " << minimax(0, 0, true, scores, height) << endl;
|
||||
|
||||
Reference in New Issue
Block a user