[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Uforståeligt program der ikke virker



Tidsfordriv.
 
Jeg fik lyst til at lege lidt med vi-maze igen. Til at
tegne en tilfældig labyrint bruges maze.ansi.c. Men
den vil ikke tegne en labyrint rigtigt.

Brug: kør programmet og indtast antal linjer, f.eks. 10.

maze.ansi.c

char*M,A,Z,E=40,J[80],T[3];main(C){for(M=J+E,*J=A=scanf("%d",&
C)            ;--            E;J             [E            ]=M
[E   ]=  E)   printf("._");  for(;(A-=Z=!Z)  ||  (printf("\n|"
)    ,   A    =              39              ,C             --
)    ;   Z    ||    printf   (T   ))T[Z]=Z[A-(E   =A[J-Z])&&!C
&    A   ==             M[                                  A]
|6<<11<rand()||!C&!Z?J[M[E]=M[A]]=E,J[M[A]=A-Z]=A,"_.":" |"];}

Jeg har ikke nogen C beautifier på min redhat, så jeg har
forsøgt at gøre det pænere manuelt:

char*M,A,Z,E=40,J[80],T[3];
main(C){
        for(M=J+E,*J=A=scanf("%d",& C); --E; J[E]=M[E]=E)
                printf("._");
        for(;(A-=Z=!Z) || (printf("\n|"), A=39, C--); Z || printf(T))
        T[Z]=Z[A-(E=A[J-Z])&&!C & A == M[A]|6<<11<rand()||!C&!Z?J[M[E]=\
        M[A]]=E,J[M[A]=A-Z]=A,"_.":" |"];
}

Outputtet (echo 5|./maze.ansi) skulle gerne tegne en labyrint,
f.eks. sådan en:

._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
| ._| . . ._| | |_._._. . ._|_._._._._. ._|_. ._|_._. ._| | . ._|_. | . ._._. |
| ._|_| |_. | | | | ._._|_._|_._. . |_. | | | ._._| |_._._._| | ._. ._| . . |_|
|_._._._. | ._|_. ._._._. | | ._. |_._. . | ._._| |_. | . ._._._. |_. | |_|_| |
| | . |_._| . ._._._| ._._. ._._| | | |_| . | |_. . ._|_|_| ._._. |_._|_| . | |
|_._|_._._._|_._._._|_|_._._._|_._|_._._._|_._._._|_._._._._|_._._._._._._|_._|
|

Men den laver ikke nogen lodrette vægge:

._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
|_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. |
|_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. |
|_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. |
|_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. |
|_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._|
|

Er der nogen der vil fikse programmet for mig?

-- 
torben fjerdingstad        | linux-2.2.10-smp/GNU/gnome-1.0
sslug@sslug        | linux får den op og stå


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *