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
|
{Représentation d'un échiquier avec ses pièces dans un tableau.}
{Compilateur : Turbo Pascal 7.0}
PROGRAM tablier;
USES crt;
TYPE
tablier12x12 = array [1..12] of array [1..12] of shortint;
tablier144 = array [1..144] of shortint;
VAR position : tablier12x12;
x,y : shortint;
CONST initiale : tablier144=(
+7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7,
+7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7,
+7, +7, -4, -2, -3, -5, -6, -3, -2, -4, +7, +7,
+7, +7, -1, -1, -1, -1, -1, -1, -1, -1, +7, +7,
+7, +7, +0, +0, +0, +0, +0, +0, +0, +0, +7, +7,
+7, +7, +0, +0, +0, +0, +0, +0, +0, +0, +7, +7,
+7, +7, +0, +0, +0, +0, +0, +0, +0, +0, +7, +7,
+7, +7, +0, +0, +0, +0, +0, +0, +0, +0, +7, +7,
+7, +7, +1, +1, +1, +1, +1, +1, +1, +1, +7, +7,
+7, +7, +4, +2, +3, +5, +6, +3, +2, +4, +7, +7,
+7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7,
+7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7, +7);
BEGIN
textbackground(blue);
textcolor(white);
clrscr;
for x:=1 to 12 do
begin
for y:=1 to 12 do
begin
{copie du tableau de constantes dans le tableau de variables}
position[x,y]:=initiale[12*y +x -12];
{affichage sommaire pour vérification du résultat}
gotoXY(2*x,2*y);
writeln (abs(position[x,y]));
end;
end;
readln;
END. |
Partager