Skip to content

Commit 286dec6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d5a54f4 commit 286dec6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

game_theory/fictitious_play.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def fictitious_play(payoff_matrix_A, payoff_matrix_B, iterations=100):
2525

2626
return strategy_A, strategy_B
2727

28+
2829
# Example usage
2930
payoff_A = np.array([[3, 0], [5, 1]])
3031
payoff_B = np.array([[2, 4], [0, 2]])

game_theory/minimax_algorithm.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def minimax(depth, node_index, is_maximizing_player, values, alpha, beta):
33
return values[node_index]
44

55
if is_maximizing_player:
6-
best_value = float('-inf')
6+
best_value = float("-inf")
77
for i in range(2): # Two children (0 and 1)
88
value = minimax(depth - 1, node_index * 2 + i, False, values, alpha, beta)
99
best_value = max(best_value, value)
@@ -12,7 +12,7 @@ def minimax(depth, node_index, is_maximizing_player, values, alpha, beta):
1212
break # Beta cut-off
1313
return best_value
1414
else:
15-
best_value = float('inf')
15+
best_value = float("inf")
1616
for i in range(2): # Two children (0 and 1)
1717
value = minimax(depth - 1, node_index * 2 + i, True, values, alpha, beta)
1818
best_value = min(best_value, value)
@@ -21,8 +21,9 @@ def minimax(depth, node_index, is_maximizing_player, values, alpha, beta):
2121
break # Alpha cut-off
2222
return best_value
2323

24+
2425
# Example usage
2526
values = [3, 5, 2, 9, 0, 1, 8, 6] # Leaf node values
2627
depth = 3 # Depth of the game tree
27-
result = minimax(depth, 0, True, values, float('-inf'), float('inf'))
28+
result = minimax(depth, 0, True, values, float("-inf"), float("inf"))
2829
print("The optimal value is:", result)

0 commit comments

Comments
 (0)