示例#1
0
def fx():
    L = ['\u2660', '\u2663', '\u2665', '\u2666']
    l = [str(x) for x in range(2, 11)]
    l += [
        'A',
        'J',
        'Q',
        'K',
    ]
    w = ['大王', '小王']
    pai = [x + y for x in L for y in l]
    P = pai + w
    from random import shuffle as sh
    sh(P)
    k = 1
    while True:
        i = input('按回车键发牌')
        if k == 1:
            f = P[0:17]
        elif k == 2:
            f = P[17:34]
        elif k == 3:
            f = P[34:51]
        else:
            print('底牌:\n%s' % P[51:54])
            break
        print('第%d个人的牌:\n%s' % (k, sorted(f, key=lambda x: x[1])))
        k += 1
示例#2
0
def init_deck(mine, plant, tower, scours):
    global my_deck, opp_deck

    #my_deck
    my_deck = [0] * (40 - (mine + plant + tower + scours) - 1)
    mine_deck = [MINE] * mine
    plant_deck = [POWER_PLANT] * plant
    tower_deck = [TOWER] * tower
    scours_deck = [SCOURS] * scours
    my_deck = my_deck + mine_deck + plant_deck + tower_deck + scours_deck
    sh(my_deck)

    #opp_deck
    opp_deck = [0] * (40 - (mine + plant + tower)
                      ) + opp_deck + mine_deck + plant_deck + tower_deck
    sh(opp_deck)
示例#3
0
文件: minc.py 项目: kcyu1993/keras
 def loadfromtxt(self, fname='train1.txt', shuffle=True):
     path = os.path.join(self.labels_dir, fname)
     with (open(path, 'r')) as f:
         list = [line.rstrip().split('/')[2] for line in f]
         f.close()
     # loadcompleteimages the category and generate the look up table
     label = []
     img = []
     if shuffle:
         from random import shuffle as sh
         list = sh(list)
     for file in list:
         index, img = self._load(file)
         label.append(index)
         img.append(img)
     return np.array(img), np.array(label)
示例#4
0
文件: minc.py 项目: kcyu1993/keras
 def loadfromtxt(self, fname='train.txt', shuffle=True):
     path = os.path.join(self.labels_dir, fname)
     # label, photo_id, x, y
     with (open(path, 'r')) as f:
         file_list = [line.rstrip().split(',') for line in f]
         f.close()
     # load the category and generate the look up table
     label = []
     img = []
     if shuffle:
         from random import shuffle as sh
         file_list = sh(file_list)
     for file in file_list:
         index, img = self._load(file)
         label.append(index)
         img.append(img)
     return np.array(img), np.array(label)
示例#5
0
# import random
#
# x = random.randint(1,10)
# for i in range (10):
#     print(random.randint(1,10))

from random import randint

x = randint(1,20)
print(x)

from random import shuffle as sh

list = [1,2,3,5,6,3]
sh(list)
print(list)
示例#6
0
 def shuffle(self):
     from random import shuffle as sh
     sh(self.deck)
示例#7
0
 def shuffle(self):
     sh(self.cards)
示例#8
0
 def shuffle(self):
     sh(self)
示例#9
0
 def shuffle(self):
     from random import shuffle as sh
     sh(self.deck)
示例#10
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-


values = range(1, 11) + 'J Q K'.split()
suits = 'Dianonds clubs hearts spades'.split()
deck = ['%s of %s' % (v, s) for v in values for s in suits]

from pprint import pprint as p

p(deck)

from random import shuffle as sh

sh(deck)

p(deck)


print '-' * 30

while deck:
    raw_input(deck.pop())
示例#11
0
 def shuffle(self):
     from random import shuffle as sh
     self.new_regular()
     for x in range(7):
         sh(self.cards)
 def shuffle(self):
     sh(self)