Commit b38327e2 authored by Brahim Ghaouthi's avatar Brahim Ghaouthi
Browse files

Replace gameAi.py

parent 1afa00d9
......@@ -3,6 +3,7 @@ import sys
import pygame
import random
import numpy as np
import logging
#Constants
WIDTH = 600
......@@ -117,6 +118,7 @@ class AI:
return empty_sqrs[idx] # (row, col)
def minimax(self, board, maximizing):
# terminal case
......@@ -228,8 +230,17 @@ class View:
def next_turn(self):
self.player = self.player % 2 + 1
def return_gamemode(self):
return self.gamemode
def change_gamemode(self):
self.gamemode = 'ai' if self.gamemode == 'pvp' else 'pvp'
logging.basicConfig(level = logging.INFO)
if self.gamemode == 'ai':
logging.info('You are in AI mode')
else:
logging.info('You are in pear vs pear mode')
def isover(self):
return self.board.final_state(show=True) != 0 or self.board.is_full()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment