Bonjour

Je me suis amusé, j'ai même pris grandement plaisir à programmer un jeu d'échecs avec Ada.
Le moteur est un minimax : games.adb.html
Par contre compter pas sur moi pour vous dire comment ça marche.
Vous pouvez télécharger divers paquets relatif sur la même adresse.
Voici une des heuristique, celle pour les noir qui contre(et gagne).
Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
 
function Black_heuristic(Echiquier : in Echiquier_Type; Pred : in Echiquier_Type) return Float is
      Ucost : Float := 0.0;        
      Hcost : Float := 0.0;
      Successors : Successors_Type;
      Sum : Float := 0.0;
   begin                  
      Hcost := Count - (Total(Echiquier.Black, Echiquier.Black_last) - Total(pred.Black, pred.Black_last));      
 
 
 
      for Line in Line_Type loop
   	 for Colum in Colum_Type loop
   	    if Echiquier.Board(Line, Colum).piece in BK..BP then
   	       declare 
   		  The_Successors : Successors_Type;
   	       begin
   		  Echiquier_Succ(Echiquier.Board(Line, Colum).Piece)(Echiquier, Line, Colum, The_Successors);
   		  case Echiquier.board(Line, Colum).Piece is
   		     when Empty =>
   			null;
   		     when BK =>
   			Sum := Sum + Float(The_Successors.Successor) * King_Move_Factor/10.0;
   		     when BQ =>
   			Sum := Sum + Float(The_Successors.Successor) * Queen_Val/10.0;
   		     when BC =>
   			Sum := Sum + Float(The_Successors.Successor) * Chavalier_Val/10.0;
   		     when BV =>
   			Sum := Sum + Float(The_Successors.Successor) * Valey_Val/10.0;
   		     when BT =>
   			Sum := Sum + Float(The_Successors.Successor) * Tower_Val/10.0;
   		     when BP =>
   			Sum := Sum + Float(The_Successors.Successor) * Pion_Val/10.0;
   		     when others =>
   			null;
   		  end case;
   	       end;
   	    end if;
   	 end loop;
      end loop;
 
 
      hcost := hcost + Sum;
 
 
      Sum := 0.0;
            for Line in Line_Type loop
   	 for Colum in Colum_Type loop
   	    if Pred.Board(Line, Colum).piece in BK..BP then
   	       declare 
   		  The_Successors : Successors_Type;
   	       begin
   		  Echiquier_Succ(Pred.Board(Line, Colum).Piece)(Pred, Line, Colum, The_Successors);
   		  case Pred.board(Line, Colum).Piece is
   		     when Empty =>
   			null;
   		     when BK =>
   			Sum := Sum + Float(The_Successors.Successor) * King_Move_Factor/10.0;
   		     when BQ =>
   			Sum := Sum + Float(The_Successors.Successor) * Queen_Val/10.0;
   		     when BC =>
   			Sum := Sum + Float(The_Successors.Successor) * Chavalier_Val/10.0;
   		     when BV =>
   			Sum := Sum + Float(The_Successors.Successor) * Valey_Val/10.0;
   		     when BT =>
   			Sum := Sum + Float(The_Successors.Successor) * Tower_Val/10.0;
   		     when BP =>
   			Sum := Sum + Float(The_Successors.Successor) * Pion_Val/10.0;
   		     when others =>
   			null;
   		  end case;
   	       end;
   	    end if;
   	 end loop;
	    end loop;
 
      hcost := hcost - Sum;
 
 
      Sum := 0.0;
      Successors  := White_Successors(echiquier);
      if Successors.Successor /= 0 then
      	 for I in 1..Successors.Successor loop
      	    declare
      	       Tmp : Echiquier_Type := Successors.Plan(i);
      	    begin
      	       Sum := Sum + ((Total(Tmp.White, Tmp.White_last) - Total(pred.White, pred.White_last)));
      	    end;
 
      	 end loop;	 
 
      end if;      
      return Hcost - Sum;
 
 
 
   end Black_Heuristic;
Voilà, je retourne jouer pour une éventuelle amélioration.