Générateur de labyrinthes.

Version PostScript / Version PDF

**Attention : Ecrire ce programme en Mode Wrt / Matrix !!!!**

Il faut absolument créer une matrice de 22*18
Pour executer le Porgramme lancer Prog 3 ## Programme LABYCREATION Alias Prog 1

LABYCREATION

"CREATION DE LABY"
"                     PAR REMI P" Disp
0->ACARSPECIAUX 126 f "Symbol"Z
Mat Y[1,5]+2->A
Lbl 3
Mat Y[1,6]+2->B
9111->Mat Y[B+1,A]
Dsz B
Goto 4
Dsz A
Goto 3
0->A~B
Mat Y[1,5]->A
Mat Y[1,6]->B
"NOMBRE DE COLONNES:"
A Disp
"NOMBRE DE LIGNES :"
B Disp
B->C
Lbl 1
A->D
Lbl 2
11->Mat Y[C+2,D+1]
Dsz D
Goto 2
Dsz C
Goto 1
111->Mat Y[B+2,A+1]
B->V
Lbl A
V+1->D
A->U
Lbl B
U+1->C
Mat Y[D+1,C]>99=>Goto C
C->E:D->F:0->W
Lbl 6
0->M~T
-1->N:1->O:1->R:-1->S
Int (Ran#*4)->K
K->L
Lbl D
-1->N:1->O
Mat Y[F+M[K*2+1]+1,E+M[K*2]]->G
W=1=>G>99=>Goto O
W=0=>GGoto O
W=0=>G>199=>Goto O
0->M~P
F+M[K*2+1]->J
E+M[K*2]->I
Mat Y[J+1,I]->G
Frac (K/2) 0=>Int (G/10)-Int (G/100)*10=0=>Goto O
Frac (K/2)=0=>Int (G/10)-Int (G/100)*10=0=>Goto O
Goto E
Lbl O
K+1->K
K>3=>0->K
K=L=>Goto C
Goto D
Lbl E
Frac (K/2)0=>(Frac(G/10)+Int(G/100)*10)*10->G
Frac (K/2)=0=>Int (G/10)*10->G
G->Mat Y[J+1,I]
-1->N
1->O
W=1=>F+M[K*2+1]->F
W=1=>E+M[K*2]->E
Mat Y[F+1,E]+100->Mat Y[F+1,E]
1->W
Goto G
Lbl  C
Dsz U
Goto B
Dsz V
Goto A
Int (Mat Y[3,2]/10)*10->Mat Y[3,2]
Int (Mat Y[3,A+1]/10)*10->Mat Y[3,A+1]
1->Mat Y[1,1]
0->Mat Y[1,2]
A->Mat Y[1,3]
B->Mat Y[1,4]
"OK"

Programme LABYMASTER Alias Prog 2

LABYMASTER

"LABYRINTHE MASTER"
"                     PAR REMI P" Disp
Mat Y[1,1]->A
Mat Y[1,2]->B
Lbl A
Mat Y[B+2,A+1]->C
Int (C/10)- int (C/100)*10->D
C-Int (C/10)*10->C
Mat  Y[B+3,A+1]->E
E-Int (E/10)*10->E
Met Y[B+2,A]->F
Int (F/10)-Int (F/100)*10->F
Lbl  B
T=1=>Goto X
" "
"QUELLE DIRECTION:"
C=0=>" 8 - NORD"
E=0=>" 2 - SUD"
F=0=>" 4 - OUEST"
D=0=>" 6 - EST"
?->G
V->R:W->S
Goto V
Lbl X:V->R:W->S
Prog 5
Lbl V
G=-1=>Goto 5
T=1=>Goto 5
Plot V,W Disp
Plot V,W : Line Disp
Lbl 55
Goto W
Plot V,W
Lbl U
Plot V,W Disp
Abs (X/(126/A))+Abs (Y/(64/B))=1=>Goto C
G=0=>Goto Z
G=8=>C=0=>Goto C
G=2=>E=0=>Goto C
G=4=>F=0=>Goto C
G=6=>D=0=>Goto C
"DIRECTION IMPOSSIBLE" Disp
Goto B
Lbl C
G=8=>B-1->B
G=2=>B+1->B
G=4=>A-1->A
G=6=>A+1->A
A->Mat Y[1,1]
B->Mat Y[1,2]
B 0=>Goto D
A=1=>Goto D
"BRAVO VOUS ETES SORTI DU LABYRINTHE" Disp
"UN AUTRE ?"
Goto Z
Lbl D
Goto A
Lbl Z
"OK"

Programme LABYAFFICHE Alias Prog 3

LABYAFFICHE

Range 0,126,0,0,62,0
Cls
Plot 0,0
Plot 126,0:Line
Plot 126,62:Line
Plot 0,62:Line
Plot 0,0:Line
Mat Y[1,3]->A
Mat Y[1,4]->B
124/A->C
60/B->D
A->E:Lbl 1
B->F:Lbl 2
Mat Y[F+2,E+1]->G
G-Int (G/10)*10=0=>Goto 4
Plot  (E-1)*C+1,62-((F-1)*D+1)
Plot (E*C+1),62-((F-1)*D+1):Line
Lbl 4
Int (G/10)-Int (G/100)*10=0=>Goto 5
Plot  E*C+1,62-((F-1)*D+1)
Plot E*C+1,62-(F*D+1):Line
Lbl 5
Dsz F:Goto 2
Dsz E:Goto 1

Programme LABYRINTHE Alias Prog 4

LABYRINTHE

"LABYRINTHE"
"              PAR REMI P" Disp
Lbl A
" "
" 0 - TERMINER"
" 1 - CREER LE LABY"
" 2 - CONTINUER"
" 3 - RECOMMENCER"
" 4 - VOIR LE LABY"
" 5 - DIMENSIONNER"
?->A
A>5=>Goto A

A=0=>Goto Z
A=1=>Goto B
A=2=>Goto C
A=3=>Goto D
A=4=>Goto E
A=5=>Goto F
Goto A
Lbl  B
Prog 1
Goto A
Lbl C
Prog 2
Goto A
Lbl D
1->Mat Y[1,1]
0->Mat Y[1,2]
Prog 2
Goto A
Lbl E
Prog 3 Disp
Goto A
Lbl F
" "
"NOMBRE DE COLONNES : "
?->E
"NOMBRE DE LIGNES : "
?->F
E>20=>Goto F
F>15=>Goto F
F->Mat Y[1,6]
E->Mat Y[1,5]
Goto A
Lbl Z
"OK"

Programme LABYMODULE Alias Prog 5

Lbl 1
W>61=>61->W
Plot V,W Disp
Int (X/(126/Mat Y[1,5]))+1->Z
Y>60=>64->Y
Int ((63-Y)/63/Mat Y[1,6])+1->U
Abs (A-Z)+Abs (B-U) = 1=>Goto 5
Goto 1
Lbl 5
A-Z=0=>B-U=1=>8->G
A-Z=0=>B-U=-1=>2->G
B-U=0=>A-Z=1=>4->G
B-U=0=>A-Z=-1=>6->G

© Copyright 1995 – Rémi Peyronnet