Talk-Line-Code: Emacs Lisp ASCII stereogram genarator
From Michael L. Littman <ml...@chekov.cs.brown.edu>
· rec.arts.ascii
· 21 Aug 1994 23:05 · View full thread
· report
Hey,
Inspired by some of the recent postings, I fixed up my Emacs Lisp
ASCII stereogram generator. It enables you create single image
random character stereograms.
************************** INTRODUCTION *************************
0. Install sird.el (instructions below).
1. Take a simple ASCII drawing like this:
**********
****..........****
**.**...*..**.......**
********..**..**...*....**
**..***********.**......******
**....*********.........********
**.....********..........****...**
**......*****.*............*....**
**.......***..............*****.**
**.........**............*********
**...........**..........*********
**..........******........********
**.........********........*****
**........*******...........**
**.......******.........**
**......****........**
****..**......****
**********
(This picture of the earth was adapted from a posting in
rec.arts.ascii.)
2. Put it in a GNU Emacs buffer by itself.
3. Type M-x sird-buffer.
4. The buffer will now look something like this:
x!'6ro,1ne!fnsutx!'6ro,1ne!fnsutx!'6ro,1ne!fnsutx!'6ro,1ne!fnsutx!'6ro,1ne!
%,)u&5xrgmfh&p02%,)u&5xrgmfh&p02%,)u&5xrfh&p02%,)u7%&5xrfh&p02%,)u7%&5xrfh&
"hp2&&-mxydl#6r1"hp2&&-mxydl#6r1"hp2-mxyidl#6r1"hp-mxy6.idl#6r1"hp-mxy6.idl
*u,wk3k.!tohc0e!*u,wk3k.!tohc0e!*uk3%.!ttoc20!*6uk3%.!to/1c20!*6uk3%.!to/1c
lpnyu(gqt%utpj"klpnyu(gqt%utpj"knyu(gqt%*upj""nydu(q!t%*pjlk""nydu(q!t%*pjl
*$jg!(n$ne3!foy)*$jg!(n$ne3!fo*$kj!(n$ne3!fo*5kj(!(n$n3!fo*5/5kj(!(n$n3!fo*
-m*w5idieqgnlp"s-m*w5idieqgnls-(m*widieqgnls)-(m*widiqgnls)-(0qm*widiqgnls)
/.'(u(gtqx-0#qj!/.'(u(gtqx-0j!//.'((gtqx-0jw!//.'((gtx-0j3w!/.'p'((gtx-0j3w
,m#),5oe,#u$&i'4,m#),5oe,#u$'4/,m#),oe,#u4'v4/,m#),oe,#4f'v4,m/q#),oe,#4f'v
5g/403fw17mwj!u35g/403fw17mwu345g/403w175mwu345g/403w15mwu3w5g4t/403w15mwu3
i#2evs2#wr*+q$hgi#2evs2#wr*+hg.i#2evs2#r*6+hg.i#2evs2r*6+hg.i#q$2evs2r*6+hg
y.kd'#y#gp-&1quvy.kd'#y#gp-&uv0y.kd'#y#gp&ukv0y.kd'#ygp&ukv0y.g"kd'#ygp&ukv
mg/h%.jp%')h!kn(mg/h%.jp%')hn($mg/h%.jp%)hn($mfg/h%.jp)hn($mfgm-/h%.jp)hn($
#rp6&h#..'j$#(5y#rp6&h#..'j$#y#3rp6&h#..j$#y#3rpo6&h#..j#y#3rgipo6&h#..j#y#
27onuxgepml.efn/27onuxgepml.ef27+onuxgepl.ef27+'onuxgepl.e270,+'onuxgepl.e2
q(lvmj4/'ou)."npq(lvmj4/'ou)."nplv2mj4/'o)."nplsv2mj4/'o.""(nplsv2mj4/'o.""
m37q+!3dgjls2(2rm37q+!3dgjls2(2rm3+!v3dgjl2(2rim3+!v3djlf"2(2rim3+!v3djlf"2
)"h%3krfr46"sw(x)"h%3krfr46"sw(x)"h%rfr4n6swl(x)"hrfr4f3n6swl(x)"hrfr4f3n6s
6qfh%"rd1(k#yu*66qfh%"rd1(k#yu*66qfh%"rdk#yu*66qfhru%"rdk#yu*66qfhru%"rdk#y
)/w3ril(-4-j2uqr)/w3ril(-4-j2uqr)/w3ril(-4-j2uqr)/w3ril(-4-j2uqr)/w3ril(-4-
This is a single image random character stereogram. The spaces in the
original image become background, the dots become slightly closer and
the asterisks closer still.
************************** INSTALLATION *************************
1. Clip out the Emacs Lisp code from the section labeled "CODE"
below. For instance, you could put it in ~/lisp/sird.el.
2. From inside of GNU-Emacs, load the code using M-x load-file
followed by the file name (e.g., ~/lisp/sird.el).
3. Follow directions above to convert an image.
************************** CODE *************************
;; Program to make a 3d image from a 2d one. Michael Littman 8/94
;; Spaces are background, *'s foreground, anything else middle.
(defvar sird-alist '((? 16) (?. 15) (?* 14) (?\n 16)))
(defun sird-buffer ()
(interactive)
(goto-char (point-min))
(let ((kill-whole-line t))
(while (< (point) (point-max))
(kill-line)
(insert (sird-str (car kill-ring) 75) ?\n))))
(defun sird-str (instr len)
(setq instr (concat instr (make-string (- len (length instr)) ? )))
(let ((outstr (make-string len ? )) (i 0) fwd)
(while (< i len)
(if (= (aref outstr i) ? ) (aset outstr i (+ (random 89) 33)))
(setq fwd (car (cdr (or (assoc (aref instr i) sird-alist) '(t 15)))))
(if (< (+ i fwd) len) (aset outstr (+ i fwd) (aref outstr i)))
(setq i (+ i 1)))
outstr))
;;; You are free to use and distribute this code as long as you leave
;;; this message intact. Copyright 1994, Michael Littman
************************** THEORY *************************
In a nutshell, here's how these stereograms work. When you diverge
your eyes, each eye receives a different image. The random characters
in the stereogram repeat in blocks of 14, 15, or 16 characters. If
your eyes are focussed 16 characters apart, both eyes appear to be
looking at the same image. Your brain concludes that you are seeing a
single image and that the image is some fixed distance behind the
computer screen. The patches of the image that repeat more or less
often cause your brain to assume are correspondingly closer or further
away. Thus, the illusion of depth comes from manipulation of the
spacing between the repeating patterns.
Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fbb9d,6926c2ff283da566,start X-Google-Attributes: gidfbb9d,public X-Google-ArrivalTime: 1994-08-21 16:08:50 PST Path: bga.com!news.sprintlink.net!sashimi.wwa.com!gagme.wwa.com!not-for-mail From: ml...@chekov.cs.brown.edu (Michael L. Littman) Newsgroups: rec.arts.ascii Subject: Talk-Line-Code: Emacs Lisp ASCII stereogram genarator Date: 21 Aug 1994 18:05:10 -0500 Organization: Brown University Department of Computer Science Lines: 114 Sender: bob...@gagme.wwa.com Approved: bob...@wwa.com Message-ID: <338mj6$jm...@gagme.wwa.com> Reply-To: mli...@cs.brown.edu NNTP-Posting-Host: gagme.wwa.com
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this message.
This message was posted publicly to the newsgroup
rec.arts.ascii
in 1994 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.