I've been working on my own Python Catchpa. Here's the code:
#PyCatchpa
#Cladus - 19/06/2012
import random
def rchGen():
genrch = ''
nocaps = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
caps = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
while len(genrch) != 4:
listno = (random.randrange(2))+1
if listno == 1:
sno = (random.randrange(26))+1
genrch = genrch + nocaps[sno]
if listno == 2:
sno = (random.randrange(26))+1
genrch = genrch + caps[sno]
return genrch
def genFch(rch):
asch = (
(('a','A'),("""
___
/ |
/ /| |
/ / | |
/ / | |
/_/ |_|""")),(('b','B'),("""
_____
| _ \
| |_| |
| _ {
| |_| |
|_____/""")),(('c','C'),("""
_____
/ ___|
| |
| |
| |___
\_____|
""")),(('d','D'),("""
_____
| _ \
| | | |
| | | |
| |_| |
|_____/""")),(('e','E'),("""
_____
| ____|
| |__
| __|
| |___
|_____|""")),(('f','F'),("""
_____
| ___|
| |__
| __|
| |
|_|""")),(('g','G'),("""
_____
/ ___|
| |
| | _
| |_| |
\_____/ """)),(('h','H'),("""
_ _
| | | |
| |_| |
| _ |
| | | |
|_| |_| """)),(('i','I'),("""
_
| |
| |
| |
| |
|_| """)),(('j','J'),("""
_
| |
| |
_ | |
| |_| |
\_____/ """)),(('k','K'),("""
_ _
| | / /
| |/ /
| |\ \
| | \ \
|_| \_\ """)),(('l','L'),("""
_
| |
| |
| |
| |___
|_____| """)),(('m','M'),("""
___ ___
/ |/ |
/ /| /| |
/ / |__/ | |
/ / | |
/_/ |_| """)),(('n','N'),("""
__ _
| \ | |
| \| |
| |\ |
| | \ |
|_| \_| """)),(('o','O'),("""
_____
/ _ \
| | | |
| | | |
| |_| |
\_____/ """)),(('p','P'),("""
_____
| _ \
| |_| |
| ___/
| |
|_| """)),(('q','Q'),("""
_____
/ _ \
| | | |
| | | |
| |_| |_
\_______| """)),(('r','R'),("""
_____
| _ \
| |_| |
| _ /
| | \ \
|_| \_\ """)),(('s','S'),("""
_____
/ ___/
| |___
\___ \
___| |
/_____/ """)),(('t','T'),("""
_____
|_ _|
| |
| |
| |
|_| """)),(('u','U'),("""
_ _
| | | |
| | | |
| | | |
| |_| |
\_____/ """)),(('v','V'),("""
_ _
| | / /
| | / /
| | / /
| |/ /
|___/ """)),(('w','W'),("""
_ __
| | / /
| | __ / /
| | / | / /
| |/ |/ /
|___/|___/ """)),(('x','X'),("""
__ __
\ \ / /
\ \/ /
} {
/ /\ \
/_/ \_\ """)),(('y','Y'),("""
__ __
\ \ / /
\ \/ /
\ /
/ /
/_/ """)),(('z','Z'),("""
______
|___ /
/ /
/ /
/ /__
/_____| """)))
for symbols, replaceStr in asch:
for symbol in symbols:
rch = rch.replace(symbol, replaceStr)
return rch
print genFch(rchGen())
Tell me what you think and how to optimize. Also I need a way to turn the Text into a Image.
This post has been edited by cladus: 19 June 2012 - 08:32 AM

New Topic/Question
Reply



MultiQuote







|