Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from alt.ascii-art, 11 Jul 1999.
ASCII Maze

ASCII Maze

[][ 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>>-- 

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f996b,467b62ebb14959d1,start
X-Google-Attributes: gidf996b,public
From: CJRandall <col...@shieldwolf.demon.co.uk>
Subject: ASCII Maze
Date: 1999/07/11
Message-ID: <MFG...@shieldwolf.demon.co.uk>#1/1
X-Deja-AN: 499778749
X-NNTP-Posting-Host: shieldwolf.demon.co.uk:193.237.26.148
X-Trace: news.demon.co.uk 931708183 nnrp-02:14403 NO-IDENT shieldwolf.demon.co.uk:193.237.26.148
Organization: me? organised?
MIME-Version: 1.0
Newsgroups: alt.ascii-art
X-Complaints-To: abu...@demon.net
About this message. This message was posted publicly to the newsgroup alt.ascii-art in 1999 and is 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 the author? 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.

Help classify this post