Created
March 9, 2011 01:09
-
-
Save TalhaAkkas/861487 to your computer and use it in GitHub Desktop.
# -*- coding: cp1254 -*-
def kontrol(harf): if ord (harf)>128: #"ascii2" return"ascii2" elif ord(harf)<=128: if ord(harf)>96 and ord(harf)<123: return"kucukharf" elif ord(harf)>64 and ord(harf)<9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: cp1254 -*- | |
import turtle | |
import math | |
t = turtle | |
def kontrol(harf): | |
if ord (harf)>128: | |
#"ascii2" | |
return"ascii2" | |
elif ord(harf)<=128: | |
if ord(harf)>96 and ord(harf)<123: | |
return"kucukharf" | |
elif ord(harf)>64 and ord(harf)<91: | |
return"buyukharf" | |
elif ord(harf)>47 and ord(harf)<58: | |
return"rakam" | |
else : | |
return"asciisembol" | |
else: | |
print "hata mesaji 00",harf | |
def degerlendir(parola): | |
seviye=0 | |
for i in parola: | |
if kontrol(i)=="ascii2": | |
seviye=10 | |
elif kontrol(i)=="asciisembol": | |
seviye=6 | |
elif kontrol(i)=="buyukharf" and seviye == 3 and seviye<=5: | |
seviye=5 | |
elif kontrol(i)=="kucukharf" and seviye == 2 and seviye<=4: | |
seviye=4 | |
elif kontrol(i)=="kucukharf" and seviye<=3: | |
seviye=3 | |
elif kontrol(i)=="buyukharf" and seviye<=2: | |
seviye=2 | |
elif kontrol(i)=="rakam" and seviye<=1: | |
seviye=1 | |
return seviye | |
def katsayiver(seviye): | |
if seviye == 10: | |
return 256 | |
elif seviye == 5 or seviye == 4 or seviye == 6: | |
return 128 | |
elif seviye == 3 or seviye == 2: | |
return 64 | |
elif seviye == 1: | |
return 10 | |
else: | |
print "hata mesaji 22" | |
def ihtimal (seviye,parola): | |
return ((katsayiver(seviye))**(len(parola))) | |
def gucolc(ihtimal): | |
if ihtimal>(256**16): | |
return "Cok Guclu" | |
elif ihtimal>(128**16): | |
return "Guclu" | |
elif ihtimal>(128**8): | |
return "Orta Gucte" | |
elif ihtimal>(64**8): | |
return "Zayif" | |
elif ihtimal>(10**8): | |
return "Cok Zayif" | |
else: | |
return "Hic Sifre Koyma Istersen" | |
def sifreiste(): | |
parola=raw_input("Parolanızı giriniz") | |
seviye=degerlendir(parola) | |
olasilik=ihtimal(seviye,parola) | |
yanit=gucolc(ihtimal) | |
return yanit,olasilik | |
def cizim(): | |
yanit=sifreiste() | |
if yanit=="Cok Guclu": | |
t.pencolor("#00ff00") | |
t.fillcolor("#00ff00") | |
elif yanit=="Guclu": | |
t.pencolor("#32c800") | |
t.fillcolor("#32c800") | |
elif yanit=="Orta Gucte": | |
t.pencolor("#649600") | |
t.fillcolor("#649600") | |
elif yanit=="Zayif": | |
t.pencolor("#966400") | |
t.fillcolor("#966400") | |
elif yanit=="Cok Zayif": | |
t.pencolor("#c83200") | |
t.fillcolor("#c83200") | |
elif yanit=="Hic Sifre Koyma Istersen": | |
t.pencolor("#ff0000") | |
t.fillcolor("#ff0000") | |
t.begin_fill() | |
t.forward(100) | |
t.right(90) | |
t.forward(20) | |
t.right(90) | |
t.forward(100) | |
t.right(90) | |
t.forward(20) | |
t.end_fill() | |
t.penup() | |
t.right(180) | |
t.forward(60) | |
t.right(270) | |
t.write(yanit) | |
def barciz(x): | |
red=255 | |
green=0 | |
mavi="00" | |
t.speed(0) | |
for i in range (255): | |
t.tracer(10) | |
kirmizi = str(hex(red)) | |
yesil = str(hex(green)) | |
if red<16: | |
kirmizi = "0"+kirmizi[2] | |
else: | |
kirmizi = kirmizi[2]+kirmizi[3] | |
if green<16: | |
yesil = "0"+yesil[2] | |
else: | |
yesil = yesil[2]+yesil[3] | |
color="#"+kirmizi+yesil+mavi | |
t.pendown() | |
t.pencolor(color) | |
t.forward(x) | |
t.right(90) | |
t.forward(1) | |
t.penup() | |
t.right(90) | |
t.forward(x) | |
t.right(180) | |
red -= 1 | |
green += 1 | |
def cizim2(): | |
yanit,ihtimal=sifreiste() | |
x=t.clone() | |
t.hideturtle() | |
go = math.log(ihtimal,2)*6 | |
print go | |
if go>256: | |
go = 256 | |
x.penup() | |
x.forward(go) | |
x.left(90) | |
t.left(90) | |
barciz(20) | |
t.penup() | |
t.setpos(0,20) | |
t.hideturtle() | |
t.write(yanit) | |
cizim2() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment