```/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        S U R J E C T I O N   F R A C T A L E   D E   [ 0 , 1 ]   D A N S   [ 0 , 1 ] x [ 0 , 1 ]   D E   P E A N O  :             */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '\$xtc/Peano_SurjectionFractale.01\$vv\$c' :                                                                        */
/*                                                                                                                                   */
/*                    Jean-Francois Colonna (LACTAMME, 20220319114042).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

#include  "INCLUDES.01.I"

#define   BASE                                                                                                                          \
3

int       Parametre_t[]={0,1,2,0,1,2,0,1};

#define   INDEX_0                                                                                                                       \
1
#define   INDEXATION(vecteur,index)                                                                                                     \
(vecteur[MAX2(index,INDEX_0)-INDEX_0])

#define   N                                                                                                                             \
(sizeof(Parametre_t)/sizeof(int))

void      Surjection(parametre)
int       parametre[];
{
int       Coordonnee_x[N];
int       Coordonnee_y[N];
int       n=0;
int       p=0;

printf("\n");

if        ((N%2) != 0)
{
printf("ERREUR : la liste 't' a un nombre impair d'elements.\n\n");
}
else
{
}

for       (n=INDEX_0 ; n <= (N) ; n++)
{
printf("a(%d)=%d\n",n,INDEXATION(parametre,n));

if        ((INDEXATION(parametre,n) >= 0) && (INDEXATION(parametre,n) <BASE))
{
}
else
{
printf("Le chiffre %d de rang %d n'est pas dans [0,%d].\n",INDEXATION(parametre,n),n-INDEX_0,BASE-1);
}
}

printf("\n");

for       (n=INDEX_0 ; n <= (N/2) ; n++)
{
int       somme_x=0;
int       somme_y=0;
char      *parite;

printf("n=%d     ",n);

if        (n > INDEX_0)
{
for       (p=INDEX_0 ; p <= (n-1) ; p++)
{
printf("a(%d)%s",(2*p)-0,COND(p<(n-0),"+",""));
somme_x = somme_x + INDEXATION(parametre,(2*p)-0);
}

if        ((somme_x % (BASE-1)) == 0)
{
INDEXATION(Coordonnee_x,n) = INDEXATION(parametre,(2*n)-1);
parite="__Pair";
}
else
{
INDEXATION(Coordonnee_x,n) = (BASE-1)-INDEXATION(parametre,(2*n)-1);
parite="ImPair";
}
}
else
{
INDEXATION(Coordonnee_x,n) = INDEXATION(parametre,INDEX_0);
parite="__Pair";
}

printf(" --> b(%d)=%s(a(%d))=%d\n",n,parite,(2*n)-1,INDEXATION(Coordonnee_x,n));

printf("n=%d     ",n);

for       (p=INDEX_0 ; p <= n ; p++)
{
printf("a(%d)%s",(2*p)-1,COND(p<(n-0),"+",""));
somme_y = somme_y + INDEXATION(parametre,(2*p)-1);
}

if        ((somme_y % (BASE-1)) == 0)
{
INDEXATION(Coordonnee_y,n) = INDEXATION(parametre,(2*n)+0);
parite="__Pair";
}
else
{
INDEXATION(Coordonnee_y,n) = (BASE-1)-INDEXATION(parametre,(2*n)+0);
parite="ImPair";
}

printf(" --> c(%d)=%s(a(%d))=%d\n",n,parite,(2*n)+0,INDEXATION(Coordonnee_y,n));

printf("\n");
}

printf("\n");

printf("t    = 0.");

for       (n=INDEX_0 ; n <= N ; n++)
{
printf("%d",INDEXATION(parametre,n));
}

printf("\n");

printf("x(t) = 0.");

for       (n=INDEX_0 ; n <= (N/2) ; n++)
{
printf("%d",INDEXATION(Coordonnee_x,n));
}

printf("\n");

printf("y(t) = 0.");

for       (n=INDEX_0 ; n <= (N/2) ; n++)
{
printf("%d",INDEXATION(Coordonnee_y,n));
}

printf("\n");

return;
}

void      main()
{
Surjection(Parametre_t);
}
```