1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- from Outils.Moteur_de_jeu import *
- from Outils.Moteur_de_jeu.Partie import *
- from Outils import IA_alphabeta
- from Outils.IA_alphabeta import *
- from Outils.IA_biland import *
- def fct_eval_Biland (plateau,num) :
- b_IA = plateau.barrieres_restantes[num]
- b_adv = plateau.barrieres_restantes[1-num]
- return -evaluation(plateau,b_IA,num) + evaluation(plateau,b_adv,1-num)
- def fct_eval(plateau, num) :
- nIA = plateau.longueur_chemin(num)
- n_opponent = plateau.longueur_chemin(1-num)
- b_IA = plateau.barrieres_restantes[num]
- b_adv = plateau.barrieres_restantes[1-num]
- e = 0
- if b_IA < 7 :
- e = - evaluation(plateau,b_adv,b_adv,num) + evaluation(plateau,b_IA,b_IA,1-num)
- print(e)
- if IA_minmax_alpha_beta.dist == None or IA_minmax_alpha_beta.dist > 5 :
- return (f(nIA) - f(n_opponent) + g(b_IA) - g(b_adv))/10 + e
-
- """
- if deux_chemins(plateau,num) : c = -4
- if deux_chemins (plateau,1-num) : d = 3
- """
- return 10*e + f(nIA) - f(n_opponent) + g2(b_IA) - g2(b_adv)
-
- def f(n) :
- t = [1000000000,1000000,40,38]
- a = len(t)
- if n< a : return t[n]
- else :
- return 40-n
- def g(b) :
- t = [6,4,2,0,-2,-4,-6,-8,-10,-12.9,-15.8]
- return t[10-b]
- def g2(b) :
- t = [0.5,0,-0.5,-1,-1.5,-2,-3,-4,-5,-7.9,-10.8]
- return t[10-b]
- joueurA = Humain("Humain")
- joueurB = IA_minmax_alpha_beta("Biland", fct_eval, 2)
- Global.partie = Partie(joueurA, joueurB, True, Partie.DOSSIER_STANDARD, True)
- Global.partie.demarrer()
|