parent
88eed944e4
commit
f5eb6d3bd4
@ -0,0 +1,143 @@
|
||||
#GESTION DIVERSE DE CARTE#
|
||||
|
||||
##CREATION DE CARTE
|
||||
|
||||
**CreationCarte(void):** Carte:Tableau(4,3) d'entiers
|
||||
|
||||
**Entrées** : void
|
||||
|
||||
**Sortie** : Carte:Tableau(4,3) d'entiers
|
||||
|
||||
### Début
|
||||
|
||||
> ###Variables locales :
|
||||
>
|
||||
> **Carte**:Tableau(4,3) d'entiers = 0
|
||||
>
|
||||
> **Cox1,Cox2,Coy1,Coy2** : entiers
|
||||
> ---
|
||||
>
|
||||
> **Cox1** <- entier entre 1 et 3;
|
||||
>
|
||||
> **Coy1** <- entier entre 1 et 4;
|
||||
>
|
||||
> **Carte(Coy1,Cox1)** <- 1;
|
||||
>
|
||||
> **Cox2** <- entier entre 1 et 3;
|
||||
>
|
||||
> **Coy2** <- entier entre 1 et 4;
|
||||
>
|
||||
> **tant que** ( **Cox1** == **Cox2** et **Coy1** == **Coy2** ) **faire**
|
||||
>
|
||||
> >**Cox2** <- entier entre 1 et 3;
|
||||
> >
|
||||
> >**Coy2** <- entier entre 1 et 4;
|
||||
>
|
||||
> **fin tant que**
|
||||
>
|
||||
> **Carte(Coy2,Cox2)** <- 2;
|
||||
|
||||
### FIN
|
||||
|
||||
## ROTATION DE CARTE
|
||||
|
||||
**rotationVerticale(Carte:Tableau(4,3) d'entiers)** :Carte:Tableau(4,3) d'entiers
|
||||
|
||||
**Entrées** : Carte:Tableau(4,3) d'entiers
|
||||
|
||||
**Sortie** : Carte:Tableau(4,3) d'entiers
|
||||
|
||||
### Début
|
||||
> ###Variables locales
|
||||
>
|
||||
> Inv:Tableau(3,3) d'entier <- [0,0,1;0,1,0;1,0,0];
|
||||
>
|
||||
> ---
|
||||
>
|
||||
> Carte <- Carte * Inv;
|
||||
>
|
||||
###FIN
|
||||
---
|
||||
|
||||
**rotationHorizontale(Carte:Tableau(4,3) d'entiers)** :Carte:Tableau(4,3) d'entiers
|
||||
|
||||
**Entrées** : Carte:Tableau(4,3) d'entiers
|
||||
|
||||
**Sortie** : Carte:Tableau(4,3) d'entiers
|
||||
|
||||
### Début
|
||||
> ###Variables locales
|
||||
>
|
||||
> Inv:Tableau(4,4)d'entiers <- [0,0,0,1;0,0,1,0;0,1,0,0;1,0,0,0];
|
||||
>
|
||||
> Carte2:Tableau(3,4) d'entiers;
|
||||
>
|
||||
> ---
|
||||
>
|
||||
> Cart2 <- Carte' * Inv;
|
||||
>
|
||||
> Carte <- Carte2';
|
||||
>
|
||||
###FIN
|
||||
|
||||
|
||||
##RECHERCHE COORDONNEES##
|
||||
|
||||
**rechercheCo(Carte:Tableau(4,3) d'entiers)** : xCercle,yCercle,xPoint,yPoint entiers
|
||||
|
||||
**Entrees** : Carte:Tableau(4,3) d'entiers
|
||||
|
||||
**Sortie** : xCercle,yCercle,xPoint,yPoint entiers
|
||||
|
||||
###Debut###
|
||||
>###Variables Locales
|
||||
> Cox,Coy : entiers
|
||||
>
|
||||
> xCercle,yCercle,xPoint,yPoint : entiers
|
||||
>
|
||||
> ---
|
||||
> Cox <- 1
|
||||
>
|
||||
> Coy <- 1
|
||||
>
|
||||
> tant que 1
|
||||
>
|
||||
>>Si Cox == 4 alors
|
||||
>>
|
||||
>>>Si Coy == 4 alors
|
||||
>>>
|
||||
>>>>break;
|
||||
>>>
|
||||
>>>Fin Si
|
||||
>>
|
||||
>>>Cox <- 1
|
||||
>>
|
||||
>>>Coy <- Coy + 1
|
||||
>
|
||||
>>Fin Si
|
||||
>
|
||||
>>>
|
||||
>
|
||||
>>Si Carte(Coy,Cox) == 1 alors
|
||||
>
|
||||
>>> xPoint <- Cox
|
||||
>
|
||||
>>> yPoint <- Coy
|
||||
>
|
||||
>> Fin Si
|
||||
>
|
||||
>>Si Carte(Coy,Cox) == 2 alors
|
||||
>
|
||||
>>>xCercle <- Cox
|
||||
>
|
||||
>>>yCercle <- Coy
|
||||
>
|
||||
>> Fin Si
|
||||
>
|
||||
>Cox <- Cox + 1
|
||||
>
|
||||
>Fin tant que
|
||||
|
||||
### Fin
|
||||
|
||||
|
@ -0,0 +1,151 @@
|
||||
#ANALYSE DE CARTE#
|
||||
|
||||
##COMPARAISON DE CARTE##
|
||||
|
||||
**ComparaisonDeCarte(TasDeCarte:Tableau(4,3) d'entiers, Carte:Tableau(4,3) d'entiers)** : entier
|
||||
|
||||
**Entrées** : **TasDeCarte** et **Carte** :Tableau(4,3) d'entiers
|
||||
|
||||
**Sortie** : entier
|
||||
|
||||
### DEBUT###
|
||||
> ###Variables locales :
|
||||
> **Cox1,Cox2,Coy1,Coy2** : entiers
|
||||
>
|
||||
> ---
|
||||
>
|
||||
> Si TasDeCarte == NULL alors
|
||||
>
|
||||
>> Code <- 2
|
||||
>
|
||||
>> retour Code
|
||||
>
|
||||
>Fin Si
|
||||
> Cox1,Coy1,Cox2,Coy2 <- rechercheCo(Carte)
|
||||
>
|
||||
> Code <- 0
|
||||
>
|
||||
> Si TasDeCarte(Coy1,Cox1) == 3 ou TasDeCarte(Coy2,Cox2) == 3 alors
|
||||
>
|
||||
>>retour Code
|
||||
>
|
||||
>Fin si
|
||||
>
|
||||
>Si TasDeCarte(Coy1,Cox1) == 1 ou TasDeCarte(Coy2,Cox2) == 2 alors
|
||||
>
|
||||
>>Code <- 1
|
||||
>
|
||||
>Fin si
|
||||
>Si TasDeCarte(Coy1,Cox1) == 1 et TasDeCarte(Coy2,Cox2) == 2 alors
|
||||
>
|
||||
>>Code <- 2
|
||||
>
|
||||
>Fin Si
|
||||
>
|
||||
>retour Code
|
||||
|
||||
###FIN
|
||||
|
||||
##COMPARAISON TOTAL DE LA CARTE
|
||||
|
||||
**ComparaisonTotal(TasDeCarte:Tableau(4,3) d'entiers,CarteFille:Tableau(4,3) d'entiers, index entier)**:entier,Tableau(4,3) d'entiers
|
||||
|
||||
**Entrees** : **TasDeCarte,CarteFille** :Tableau(4,3) d'entiers, **index** entier
|
||||
|
||||
**Sortie** : entier
|
||||
|
||||
###DEBUT
|
||||
>###Variables locales
|
||||
>
|
||||
> Code,Code1 entier
|
||||
>
|
||||
>---
|
||||
>
|
||||
>Si TasDeCarte == NULL alors
|
||||
>
|
||||
>>TasDeCarte <- CarteFille
|
||||
>
|
||||
>>Code <- 1
|
||||
>
|
||||
>>retour Code,TasDeCarte
|
||||
>
|
||||
>Fin si
|
||||
>
|
||||
>
|
||||
> **Si** index == 1 alors
|
||||
>
|
||||
>>CarteFille <- rotationVerticale(CarteFille)
|
||||
>
|
||||
>**Fin Si**
|
||||
>
|
||||
>**Si** index == 2 alors
|
||||
>
|
||||
>>CarteFille <- rotationHorizontale(CarteFille)
|
||||
>
|
||||
>**Fin Si**
|
||||
>
|
||||
>**Si** index == 3 alors
|
||||
>
|
||||
>>CarteFille <- rotationVerticale(CarteFille)
|
||||
>
|
||||
>**Fin Si**
|
||||
>
|
||||
>**Si** index == 4 alors
|
||||
>
|
||||
>>Code <- -1
|
||||
>
|
||||
>>retour Code,TasDeCarte
|
||||
>
|
||||
>**Fin Si**
|
||||
>
|
||||
>Code <- ComparaisonDeCarte(TasDeCarte,CarteFille)
|
||||
>
|
||||
>**Si** Code == 2 alors
|
||||
>
|
||||
>>TasDeCarte <- TasDeCarte + CarteFille
|
||||
>
|
||||
>>retour Code,TasDeCarte
|
||||
>
|
||||
>**Fin si**
|
||||
>
|
||||
>**Si** Code == 1 alors
|
||||
>
|
||||
>>Code1 <- ComparaisonDeCarte(TasDeCarte,rotationHorizontale(CarteFille))
|
||||
>
|
||||
>>**Si **Code1 == 1 alors
|
||||
>
|
||||
>>>Code <- 4
|
||||
>
|
||||
>>> retour Code, TasDeCarte
|
||||
>
|
||||
>>**Fin Si**
|
||||
>
|
||||
>>Code1 <- ComparaisonDeCarte(TasDeCarte,rotationVerticale(CarteFille))
|
||||
>
|
||||
>>**Si **Code1 == 2 alors
|
||||
>
|
||||
>>>Code <- 2;
|
||||
>
|
||||
>>> TasDeCarte <- TasDeCarte + rotationVerticale(CarteFille)
|
||||
>
|
||||
>>>retour Code, TasDeCarte
|
||||
>
|
||||
>>**Fin Si**
|
||||
>
|
||||
>> **Si** Code1 == 1 alors
|
||||
>
|
||||
>>> Code <- 3
|
||||
>
|
||||
>>> retour Code,TasDeCarte
|
||||
>
|
||||
>>**Fin Si**
|
||||
>
|
||||
>**Fin si**
|
||||
>
|
||||
>**Si** Code == 0 alors
|
||||
>
|
||||
>> retour ComparaisonTotal(TasDeCarte,CarteFille,index + 1)
|
||||
>
|
||||
>**Fin si**
|
||||
>
|
||||
### FIN
|
Loading…
Reference in new issue