Beispiel #1
0
from Game import MancalaGame
import Heuristics as H
from time import time
import Utils
import random

PL1 = 0
PL2 = 7

HP = H.RelativePointsHeuristic()
HB = H.PebblesHeuristic()
HR = H.RightCellHeuristic()


def man_vs_ai(game, heuristic, depth):
    # make you play against an heuristic
    # PL1 is human, PL2 is AI
    game.state.print()
    move = Utils.choose_move()
    game.make_move(move, PL1)
    player = PL2
    counter = 0
    while not game.no_moves():
        counter += 1
        # game loop
        game.state.print()
        if player is PL2:
            t = time()
            # ai player
            val, move = Utils.alpha_beta(game.state,
                                         player,