Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bionet!uwm.edu!spool2.mu.edu!samsung!munnari.oz.au!metro!otc!gregm From: gregm@otc.otca.oz.au (Greg McFarlane) Newsgroups: alt.sources Subject: VI SOLVES MAZE (update) Message-ID: <2164@otc.otca.oz> Date: 14 Jan 91 00:28:40 GMT Sender: news@otc.otca.oz Reply-To: gregm@otc.otca.oz.au (Greg McFarlane) Organization: OTC Development Unit, Australia Lines: 111 Thanks for all those who wrote to me about my maze-solving vi macros. To quote some of the reviews: "I was very impressed ..." "A-maze-ing!" "ABSOLUTELY THE GREATEST THING I'VE SEEN IN YEARS!" "it just flat blew me away" "AMAZING!!!!!!!!!!!!!!!!!!!!!!!!!!!" "Wow." (from rsalz@bbn.com him/herself) If you haven't already seen these amazing macros at work, you have another chance with this update. To get the correct ending message, ":set noterse" should be done. I have modified the macros below to do this. (This is probably not worth the effort.) Anyone who can't get the maze.c file to compile, get a new compiler. I have included a 5-line maze below for you. If you can compile it but the maze comes out looking like a fence and not a maze and you are using SysV or DOS replace the "27" on the last line by "11" If you try to figure out how the macros work and wimp out, I will send a commented version of the macros to anyone who mails me. By the way, I learnt about the power of vi macros from an item posted by Dave Hitz to comp.sources.misc: v02i057: vi macros simulate a Turing Machine. I recommend this to anyone interested in such trivia. What follows is a repeat of my previous posting, with ":set noterse" added to the macros, and with a maze to keep those with buggy compilers happy. ========================================================================= 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 the net last month. (Maze.c is also included below.) Just follow this recipe and SEE FOR YOURSELF. 1. save this article and strip off all lines except those between the "cut here for vi macros" markers 2. run uudecode on the file to produce "maze.vi.macros" 3. if you haven't already done so, compile maze.c (cc -o maze maze.c) 4. run maze > maze.out and input a small number (for example 10 if you are on a fast machine, 3-5 if slow) which is the size of the maze to produce 5. edit the maze (vi maze.out) 6. include the macros with the vi command: :so maze.vi.macros 7. type the letter "g" (for "go") and watch vi solve the maze 8. when vi solves the maze, you will see why it lies Tested on a sparc, a sun and a pyramid (although maze.c will not compile on the pyramid). Any donations should be in unmarked small denomination bills :^)=. uuencoded maze.vi.macros: (note that the second last line (above "end") consists of a single space) ----------------- cut here for vi macros ---------------------- begin 664 maze.vi.macros M,D=1;&UA1UE*>DIE2D1*2U P4V!A"FUA<"!,(%%!;6%'3D(P M33!%0&T-=UA@84!M1U0D0B12,$TP14!M#69:8E-B6$=62C!(8&% 6P*;6%P($$@70@"FUA<"!6(&%R&PIM87 @2B B8W *;6%P M($@@(G)Y) IM87 @1B B;GEL"FUA<"!9(&]S02 @:R!%6B!S05\@;6T@0EH@ M