Delete ai.py
Browse files
ai.py
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
# ai.py
|
2 |
-
import random
|
3 |
-
from app import get_flips, apply_move
|
4 |
-
|
5 |
-
def choose_move(board, player):
|
6 |
-
"""
|
7 |
-
Simple AI: chooses a random valid move from all legal flips.
|
8 |
-
"""
|
9 |
-
valid_moves = []
|
10 |
-
for r in range(8):
|
11 |
-
for c in range(8):
|
12 |
-
if get_flips(board, r, c, player):
|
13 |
-
valid_moves.append((r, c))
|
14 |
-
if not valid_moves:
|
15 |
-
return None
|
16 |
-
return random.choice(valid_moves)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|