Original Usenet thread from alt.ascii-art, started 11 Jul 1999.
ASCII Maze
alt.ascii-art
· 1 message · 11 Jul 1999
[][ hi ... trawling my archives ... (mag-tape2cd procedure) i found something which some readers may find of passing interest the snippet-items below were taken from:- > >From: gre...@otc.otca.oz.au (Greg McFarlane) >Newsgroups: alt.sources >Subject: VI SOLVES MAZE (commented macros) >Date: 10 Feb 91 23:31:02 GMT > >A real working model. See it walk the maze in front of your very own eyes. >To prove that you can do anything in vi, I wrote a couple of macros that >allows vi to solve mazes. It will solve any maze produced by maze.c >that was posted to alt.sources last month. > >After studying these macros, anyone who cannot write an emacs emulator >in vi macros should just curl up and :q!. > >Coming soon to a newsgroup near you: "Vi macros solve Tower of Hanoi", >and a repost of the original "Turing Machine implemented in Vi macros" > >Anyone who has a version of these macros for edlin or nroff, please post. > maze.c - John Tromp (tro...@piring.cwi.nl) char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C); -- E; J[ E] =T [E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|" ) , A = 39 ,C -- ) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C & A == T[ A] |6<<27<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];} [i got segmentation-fault with this][i486 gcc2.6 linux1.3.0] maze.ansi.c - ant...@nntp-server.caltech.edu (Bill T. Cat) 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,"_.":" |"];} . /|\ | `---- i had to change this to 27 (my rand.seed default is 1) with an input value of 5 (rows) produces: ._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ | ._| . . ._| | |_._._. . ._|_._._._._. ._|_. ._|_._. ._| | . ._|_. | . ._._. | | ._|_| |_. | | | | ._._|_._|_._. . |_. | | | ._._| |_._._._| | ._. ._| . . |_| |_._._._. | ._|_. ._._._. | | ._. |_._. . | ._._| |_. | . ._._._. |_. | |_|_| | | | . |_._| . ._._._| ._._. ._._| | | |_| . | |_. . ._|_|_| ._._. |_._|_| . | | |_._|_._._._|_._._._|_|_._._._|_._|_._._._|_._._._|_._._._._|_._._._._._._|_._| | and using this - maze.ansi40.c char*M,A,Z,E=20,J[40],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 = 19 ,C -- ) ; Z || printf (T ))T[Z]=Z[A-(E =A[J-Z])&&!C & A == M[ A] |6<<27<rand()||!C&!Z?J[M[E]=M[A]]=E,J[M[A]=A-Z]=A,"_.":" |"];} cc -o maze40 maze.ansi40.c maze40 with an input value of 15 gave: ._._._._._._._._._._._._._._._._._._._ | |_. ._._| |_._._. |_. | |_. |_. ._._| |_. | | | |_. . |_._._._._. ._|_. | ._| | . | | |_. |_| | | ._._._. |_. ._. | | |_| . ._._._._| | |_. ._| | |_._| | | | |_. | ._|_. |_._._. |_| | | | | | |_. | | | |_| ._. | | |_. . |_. | ._| | ._. | |_._._. | ._._|_._._| |_. ._._. . . | | |_._._. | ._._. ._._|_. ._._. | |_|_|_| | | | ._|_|_._. | . |_. . ._|_| ._. ._| |_. | . |_._. | . |_. ._| |_. | ._|_| | |_._. |_. . . |_| ._|_| |_| | ._. ._| | |_._. . | |_|_._| . ._._._| |_._| |_. | | | . |_| ._._| | |_|_. | ._._. ._._| | | |_| |_._._._._| | |_. |_. | |_|_. | | |_._._|_._._._._._|_._._._._._._._._._| | watching vi solve the maze is quite entertaining (the maze.vi.macros are binary) [][ see yuz [][ colin -- . /\_/\ ( () /_ / /\) _/ /? .\ /\) /) .\ /_ /_ :( a a( CJRandall http://www.shieldwolf.demon.co.uk ' \___") --<<nOWiStHEbEST-=oOo=-tIMEoFyOURlIVES>>--
About this thread.
These messages were posted publicly to the newsgroup
alt.ascii-art
in 1999 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.
Report this message
Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.