Skip to content

Instantly share code, notes, and snippets.

@lifthrasiir
Created August 20, 2012 08:37
Show Gist options
  • Save lifthrasiir/3402278 to your computer and use it in GitHub Desktop.
Save lifthrasiir/3402278 to your computer and use it in GitHub Desktop.
마법의 MD5 스펙 생성기
# coding=utf-8
def score(s, encoding=None):
if encoding: s = s.encode(encoding)
import hashlib; a = hashlib.md5(s).digest()
return (int(round(10+ord(a[0])/255.*90)), # 공격
int(round(10+ord(a[5])/255.*90)), # 민첩
int(round(10+ord(a[1])/255.*90)), # 방어
int(round(10+ord(a[2])/255.*90)), # 명중
int(round(10+ord(a[3])/255.*90)), # 운
int(round(100+ord(a[4])/255.*200))) # 체력
def test_score():
for r in [
('EImy', 100, 99, 100, 99, 100, 292),
('A#v[3i', 100, 100, 100, 100, 100, 298),
(u'9yュOトE'.encode('sjis'), 100, 100, 100, 100, 100, 300),
('9yュOトE', 44, 68, 30, 76, 89, 117),
('레전드 골드란', 98, 58, 98, 90, 88, 299),
('미야코 요시카', 86, 100, 97, 99, 89, 145),
('오크년', 92, 83, 100, 100, 11, 262),
('울트라태훈', 94, 37, 96, 94, 96, 241),
('덴마', 95, 82, 61, 40, 91, 299),
('HP', 91, 95, 99, 59, 89, 105),
('나유나', 50, 24, 35, 32, 42, 118),
('이승희', 67, 58, 35, 45, 11, 204),
]:
print [b-a for a,b in zip(score(r[0]), r[1:])]
if __name__=='__main__': test_score()
@puzzlet
Copy link

puzzlet commented Oct 15, 2012

잘 하면 전투 과정도 복원할 수 있지 않을까요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment