Create a Leet Translator!

This is the place for ALL of the user submitted challenges. If you create a little challenge/mission/riddle/whatever, post it here.
Forum rules
Do not post missions that you did NOT create without proper citing.

Re: Create a Leet Translator!

Post by centip3de on Sun Aug 11, 2013 4:29 pm
([msg=76809]see Re: Create a Leet Translator![/msg])

They've been updated.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Addict
Addict
 
Posts: 1479
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by -Ninjex- on Sun Aug 11, 2013 4:34 pm
([msg=76810]see Re: Create a Leet Translator![/msg])

centip3de wrote:They've been updated.


Points have been updated as promised. You received a total of 130 for this, congratz!
image
For those that know
K: 0x2CD8D4F9
User avatar
-Ninjex-
Moderator
Moderator
 
Posts: 1691
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by mShred on Sun Aug 11, 2013 4:47 pm
([msg=76811]see Re: Create a Leet Translator![/msg])

Updated as well. I suppose I should have read the instructions more thoroughly before submitting my code...
User avatar
mShred
Addict
Addict
 
Posts: 1899
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)


Re: Create a Leet Translator!

Post by apples on Sun Aug 11, 2013 5:05 pm
([msg=76812]see Re: Create a Leet Translator![/msg])

Code: Select all
import qualified Data.Bimap as B
import Control.Monad

main = forever $ getLine >>= putStrLn . map mutate
  where dict     = B.fromList $ zip "abcdefghijklmnoqrstuvwxy" "ɐߩЀƒ&#I¿K£M?øQЯ§†µ^W×¥"
        mutate c = maybe c id $ B.lookup c dict `mplus` B.lookupR c dict
User avatar
apples
New User
New User
 
Posts: 37
Joined: Sat Apr 12, 2008 8:30 pm
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by -Ninjex- on Sun Aug 11, 2013 6:45 pm
([msg=76816]see Re: Create a Leet Translator![/msg])

@mShred, 100 points added for you, great work.

@apples, 100 points for you as well. However your program could be more flexible instead of forcing it to terminate. You as well need to update your post with what language you used.
image
For those that know
K: 0x2CD8D4F9
User avatar
-Ninjex-
Moderator
Moderator
 
Posts: 1691
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by tgoe on Wed Sep 18, 2013 2:04 am
([msg=77395]see Re: Create a Leet Translator![/msg])

Language: None
Code: Select all
$ echo "hack this site" | tr "abcdefghijklmnopqrstuvwxyz" "@8(D3FG#1JK|MN0?Q7$+UVWXYZ"


Ok, sh.
Code: Select all
#!/bin/sh

PLAIN="abcdefghijklmnopqrstuvwxyz"
LEETZ="@8(D3FG#1JK|MN0?Q7$+UVWXYZ"

usage () {
    echo "$0 [-d | -e] 'str'";
}

leetness () {
    echo $1 | tr $PLAIN $LEETZ
}

getit () {
    echo $1 | tr $LEETZ $PLAIN
}

case $1 in
    "-e") leetness  "$2" ;;
    "-d") getit  "$2" ;;
       *) usage "$0" ;;
esac
User avatar
tgoe
Contributor
Contributor
 
Posts: 718
Joined: Sun Sep 28, 2008 2:33 pm
Location: q3dm7
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by -Ninjex- on Wed Sep 18, 2013 10:31 pm
([msg=77413]see Re: Create a Leet Translator![/msg])

@tgoe, you have a slight problem with the program. It does not account for spaces and ends the encoding process after one word because of this.

You get +50 for a semi working program, fix the errors and you will get the other half.
image
For those that know
K: 0x2CD8D4F9
User avatar
-Ninjex-
Moderator
Moderator
 
Posts: 1691
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by tgoe on Thu Sep 19, 2013 8:23 pm
([msg=77425]see Re: Create a Leet Translator![/msg])

I should have had a better usage message and an example:

Code: Select all
$ ./translator -e 'hack this site'
#@(K +#1$ $1+3


Code: Select all
$ ./translator -d '#@(K +#1$ $1+3'
hack this site


Is it a requirement to work on streams?
User avatar
tgoe
Contributor
Contributor
 
Posts: 718
Joined: Sun Sep 28, 2008 2:33 pm
Location: q3dm7
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by -Ninjex- on Thu Sep 19, 2013 9:31 pm
([msg=77428]see Re: Create a Leet Translator![/msg])

Okay, that works man. Working with streams was not in the requirement.

Added your other 50
image
For those that know
K: 0x2CD8D4F9
User avatar
-Ninjex-
Moderator
Moderator
 
Posts: 1691
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Create a Leet Translator!

Post by Amazingred on Sat Sep 21, 2013 11:36 pm
([msg=77460]see Re: Create a Leet Translator![/msg])

EDIT: Code updated. When will I learn that I should NEVER NEVER try to code when I'm sh!tfaced. I don't know what I was thinking with that. LOL

python-tk
for reference sake if anyone wants some good info on Python's Tk GUI you can find one thats pretty easy to follow here: http://effbot.org/tkinterbook/

Code: Select all
#-------------------------------------------------------------------------------
# Author:      AmazingRed
#-------------------------------------------------------------------------------
import re
from Tkinter import *

fullwords={'you':'j00', 'later':'l8r', 'sucks':'suxx0r', 'rocks':'r0x0r','yay':'w00t','schooled':'sk00l3d','owned':'p3wn3d','newbie':'n00b','tool':'7001','porn':'pr0n','fear':'ph3ar','hacker':'haxx0r','fuck':'fuxx0red','elite':'1337','0':'zer0','1':'wun','2':'t00','3':'thr33','4':'f00r','5':'f1v3','6':'51x','7':'s3v3n','8':'a33t','9':'n1n3'}
alphabet={'a':'@','e':'3','g':'6','i':'1','l':'|','o':'0','s':'5','t':'+','x':'><'}

def convertmessage(message, alphadict, worddict):
    """This takes the data that has already been prepared and performs the actual
    conversion from l33t to english or vice-versa"""
    punc=(".,!?:;")
    cleanedmessage, convertedmessage=[],[]
    placeholder=''
    words=message.split()
    for word in words:
        word=[value for value in word if value!='\'']
        if word[len(word)-1] in punc:
            cleanedmessage.append(''.join(word[:len(word)-1]))
            cleanedmessage.append(''.join(word[len(word)-1:]))
        else: cleanedmessage.append(''.join(word))
    for word in cleanedmessage:
        if word in punc:
            convertedmessage[len(convertedmessage)-1]+=word
        elif word in worddict.keys():
            convertedmessage.append()
        else:
            for letter in word:
                if letter in alphadict.keys():
                    placeholder+=alphadict[letter]
                else: placeholder+=letter
            convertedmessage.append(placeholder)
            placeholder=''
    return ' '.join(convertedmessage)

def encode():
    """Starts by pressing the ENCODE button on the GUI.  Retrieves and prepares
    the message for conversion, and prepares the dictionaries to be used for ENCODING"""
    message=str(t.get()).lower()
    global master
    master.destroy()
    print convertmessage(message, alphabet, fullwords)

def decode():
    """Starts by pressing the DECODE button on the GUI.  Same operations as encode()
    except the preparations are made to be used for DECODING"""
    message=str(t.get()).lower()
    global master
    master.destroy()
    tempalpha=dict()
    tempwords=dict()
    for k, v in alphabet.items():
        tempalpha[v]=k
    for k,v in fullwords.items():
        tempwords[v]=k
    print convertmessage(message, tempalpha, tempwords)


"""The following is the code that creates the User Interface window.
User types or pastes the message into the box and clicks encode or decode.
Window closes on its own after a choice is made."""
master=Tk()
master.title("A-Reds L33t5p3ak converter!")
L1=Label(master, text="Input Text Here.")
t=Entry(master, width=75)
t.pack()
b=Button(master, text="Encode",command=encode, width=30)
c=Button(master, text="Decode",command=decode, width=30)
L1.pack(side=TOP)
b.pack(side=RIGHT)
c.pack(side=LEFT)
mainloop()


EDIT: Removed the crap I wrote here cuz I apparently turn into a friggen ChattiKathyv2.0 when I have both a bottle of Petrone and a keyboard within arms reach....
Last edited by Amazingred on Sun Sep 22, 2013 7:57 pm, edited 3 times in total.
There are 10 types of people in the world. Those who understand binary and those who don't.
User avatar
Amazingred
Experienced User
Experienced User
 
Posts: 74
Joined: Wed Jul 25, 2012 7:10 pm
Location: Wayyyyyy out there
Blog: View Blog (0)


PreviousNext

Return to User Submitted

Who is online

Users browsing this forum: No registered users and 0 guests