Exemplo n.º 1
0
def computer_next_step(A,B,d,Clever_Stupid,who_s_turn):

    
    input_n = len(A)
    game =Alpha_Beta(input_n,d)
    game.re_construct_pebble(A,B)
    action_a = game.Search(Clever_Stupid,who_s_turn);

    game.change(action_a);
    return {'list':game.RotateList, 'index':action_a}
Exemplo n.º 2
0
def computer_next_step(A, B, d, Clever_Stupid, who_s_turn):

    input_n = len(A)
    game = Alpha_Beta(input_n, d)
    game.re_construct_pebble(A, B)
    action_a = game.Search(Clever_Stupid, who_s_turn)

    game.change(action_a)
    return {'list': game.RotateList, 'index': action_a}
Exemplo n.º 3
0
import pdb
import sys
from utils import Move, JustifyOver, printPebble
from techniques import Alpha_Beta
#!/usr/bin/python


if __name__ == '__main__':
    input_n = 3
    d = 5
    game =Alpha_Beta(input_n,d)

    while input_n >= 2:

        action_a = game.Search('A');
        if(action_a <0): print 'it can not get any actions'
        print 'action_a = ', action_a
        game.change(action_a);

        print '-------------------Now it is B turn'
        printPebble(game.RotateList)
        if(JustifyOver(game.RotateList,input_n)):
            break


        action_b = game.Search('B')
        game.change(action_b)
        print 'action_b = ', action_b
        print '-------------------Now it is A turn'
        printPebble(game.RotateList)
        if(JustifyOver(game.RotateList,input_n)):
Exemplo n.º 4
0
def computer_next_step(currentlist,input_n,d,Clever_Stupid):
    game =Alpha_Beta(input_n,d)
    game.re_construct_pebble(currentlist)
    action_a = game.Search(Clever_Stupid);
    game.change(action_a);
    return {'list':game.RotateList, 'index':action_a}
Exemplo n.º 5
0
import pdb
import sys
from utils import Move, JustifyOver, printPebble
from techniques import Alpha_Beta
#!/usr/bin/python

if __name__ == '__main__':
    input_n = 3
    d = 5
    game = Alpha_Beta(input_n, d)

    while input_n >= 2:

        action_a = game.Search('A')
        if (action_a < 0): print 'it can not get any actions'
        print 'action_a = ', action_a
        game.change(action_a)

        print '-------------------Now it is B turn'
        printPebble(game.RotateList)
        if (JustifyOver(game.RotateList, input_n)):
            break

        action_b = game.Search('B')
        game.change(action_b)
        print 'action_b = ', action_b
        print '-------------------Now it is A turn'
        printPebble(game.RotateList)
        if (JustifyOver(game.RotateList, input_n)):
            break