Re: Re: spiral cipher

*To*: mathgroup at smc.vnet.net*Subject*: [mg55828] Re: [mg55777] Re: spiral cipher*From*: DrBob <drbob at bigfoot.com>*Date*: Thu, 7 Apr 2005 05:10:07 -0400 (EDT)*References*: <d2tfng$qoi$1@smc.vnet.net> <200504060711.DAA13523@smc.vnet.net>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

I understood the problem very differently: dat = (ToCharacterCode["i love apples and cats"] /. (32 -> Sequence[])) - 96; right = {1, 0}; north = {0, 1}; Show@Graphics@Line@FoldList[ Plus, {0, 0}, dat*PadRight[{}, Length@dat, {right, north, -right, -north}]] Bobby On Wed, 6 Apr 2005 03:11:05 -0400 (EDT), dh <dh at metrohm.ch> wrote: > Hi zak, > here a short solution: > get some data: > dat = ToCharacterCode["i love apples and cats"]; > calculate the spiral > res = {}; > Fold[(AppendTo[res, {#1 + {#2[[1]], 0}, #1 + {0, #2[[2]]}, #1 + > {-#2[[3]], 0}, #1 + {0, -#2[[1]]} } ]; {0, -#2[[1]]} ) & , {0, 0} , > Partition[dat, 4] ]; > and draw it: > Show[Graphics[Line[Flatten[res, 1]]]]; > > > zak wrote: >> spiral cipher >> suppose i have the string "i love apples and cats" >> the sentence composed from 18 letters. we will neglect space letter. >> if we give to every letter a value which depend on the english alphabet such as: >> a=1; b=2 ; c=3; d=4;...; i=9;...; l=12 ... >> now i pick the letters one by one: >> I=9 plot 9 units to the right >> L=12 plot 12 units to the north >> O=15 plot 15 units to the left >> V=22 plot 22 units to the south >> E=5 plot 5 units to the right >> and so on... >> >> this will create a messy spiral but it will represent our string. >> we may dream to see some patterns in poets or similar texts. >> i hope someone may have an idea about how to draw this messy spiral >> cipher using mathematica >> we will see if the letters of some texts will crawl to some >> directions, or it will clutter arround the center point >> and if someone could construct a text wich when spiralling it will >> crawl to the north as an example. or may plot a bird figure. >> regards >> >> zak >> > > > > -- DrBob at bigfoot.com