Skip to content

Commit 1c3bff8

Browse files
Prateek KhandelwalPrateek Khandelwal
Prateek Khandelwal
authored and
Prateek Khandelwal
committed
Fixing tests
1 parent 52e91a8 commit 1c3bff8

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

machine_learning/minimax.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
import math
22
from typing import List
33

4-
5-
def minimax(
6-
depth: int,
7-
node_index: int,
8-
is_maximizing_player: bool,
9-
scores: List[int],
10-
height: int,
11-
) -> int:
4+
def minimax(depth: int, node_index: int, is_maximizing_player: bool,
5+
scores: list, height: int) -> int:
126
"""
137
Minimax algorithm to determine the optimal move for a player in a two-player
148
zero-sum game.
@@ -55,7 +49,7 @@ def minimax(
5549
return best_score
5650

5751

58-
def main():
52+
def main() -> None:
5953
# Scores array representing the leaf nodes of a binary tree (depth = 3)
6054
scores = [3, 5, 2, 9, 12, 5, 23, 23]
6155
# Calculate the height of the binary tree based on the number of leaf nodes

machine_learning/minimax_alpha_beta_pruning.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import math
2-
from typing import List
32

4-
5-
def minimax_with_pruning(
6-
depth: int,
7-
node_index: int,
8-
is_maximizing_player: bool,
9-
scores: List[int],
10-
height: int,
11-
alpha: int,
12-
beta: int,
13-
) -> int:
3+
def minimax_with_pruning(depth: int, node_index: int, is_maximizing_player: bool,
4+
scores: list, height: int, alpha: int, beta: int) -> int:
145
"""
156
Minimax algorithm with alpha-beta pruning to determine the optimal
167
move with improved efficiency.
@@ -64,7 +55,7 @@ def minimax_with_pruning(
6455
return best_score
6556

6657

67-
def main():
58+
def main() -> None:
6859
# Scores array representing the leaf nodes of a binary tree (depth = 3)
6960
scores = [3, 5, 2, 9, 12, 5, 23, 23]
7061
# Calculate the height of the binary tree based on the number of leaf nodes

0 commit comments

Comments
 (0)