You know, if you put your hands in their “correct” positions on the keyboard, and then shift your right hand one space to the right (so your pointer finger is over the H instead of the J) and then begin touch-typing again, what comes out resembles Russian somewhat. Try it in the comments! Oh, and the “delete” key is still delete. I mean don’t hit “=” and expect us to translate that.
This is what happens when I stay up past midnight several nights in a row working on web development. Man, I’m so glad I love doing this or it would suck.
un bir syre thus kiijs kujw Rysssuan.
Actyakkt, tiy’re ruggt. Ut’s nire kuje Swedusg,
u tgubj ut resenbkes gernab as wekk, Byt tgat us yo ti tiy,
U tgybj ut kiijs renarjabkt kuje Dabusg. Wgatever ut us, ut’s orettt ciik. Wgat ab anazubg ibservatuib.
Tgatkk be ebiyug if tgat biw,
cgecj tgus iyt!
“The Sweedizer”
#!/usr/bin/python
import sys
topRow = [ ‘t’, ‘y’, ‘u’, ‘i’, ‘o’, ‘p’ ]
middleRow = [ ‘f’, ‘g’, ‘h’, ‘j’, ‘k’, ‘l’ ]
bottomRow = [ ‘v’, ‘b’, ‘n’, ‘m’ ]
def to_sweedish_mapping():
mapping = {}
for i in range(1,len(topRow)):
mapping[topRow[i]] = topRow[i-1]
for i in range(1,len(middleRow)):
mapping[middleRow[i]] = middleRow[i-1]
for i in range(1,len(bottomRow)):
mapping[bottomRow[i]] = bottomRow[i-1]
return mapping
def from_sweedish_mapping():
mapping = {}
for i in range(0,len(topRow)-1):
mapping[topRow[i]] = topRow[i+1]
for i in range(0,len(middleRow)-1):
mapping[middleRow[i]] = middleRow[i+1]
for i in range(0,len(bottomRow)-1):
mapping[bottomRow[i]] = bottomRow[i+1]
return mapping
m = {}
if len(sys.argv) > 1 and sys.argv[1].startswith(“to”):
m = to_sweedish_mapping()
else:
m = from_sweedish_mapping()
for line in sys.stdin:
nl = “”
for c in line:
if c.lower() in m:
nc = m[c.lower()]
if c.isupper():
nc = nc.upper()
c = nc
nl += c
print nl,
Compliments of my friend Trevor . ( @mpersandbox.net )
Whoops! I mean &mpersandbox.com
Kahleephornya. Wait! Isn’t that Austrian?
Andy, I’m pretty sure that’s the first time someone posted source code to my blog. That’s pretty frickin’ sweet. Thanks! Was that custom-made for our discussion, or did it already exist? I kinda find it hard to believe it was already out there, but you never know. I don’t read Python too well, but it looks custom to me!
Tgabjs!
My friend just cranked it out, he’s good like that 🙂