Last active
December 23, 2016 23:06
-
-
Save jnozsc/a4fc47356b3968d0a99a6c5b0b3e4f82 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import argparse | |
from random import shuffle | |
GUEST_NAME = [ | |
u'阿仁', | |
u'sk', | |
u'lulu', | |
u'えるし', | |
u'S', | |
u'熊猫叔', | |
u'崭崭', | |
u'呆鲑', | |
u'オラララ', | |
u'阿源', | |
u'周游', | |
u'许可', | |
u'周璟', | |
u'YZ', | |
u'阿花', | |
] | |
def main(person): | |
if person < 2 or person > len(GUEST_NAME): | |
print 'invalid input' | |
exit() | |
x = range(person) | |
done = False | |
while (not done): | |
shuffle(x) | |
done = True | |
for idx, val in enumerate(x): | |
if idx == val: | |
done = False | |
break | |
y = range(person) | |
shuffle(y) | |
for i in y: | |
print GUEST_NAME[i], '->', GUEST_NAME[x[i]] | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser( | |
description="hehe") | |
parser.add_argument('--person', type=int, | |
default='15') | |
args = parser.parse_args() | |
main(args.person) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment