Exemplo n.º 1
0
def index():
    result = request.forms.get('result')
    msg = request.forms.get('msg')
    data = {}
    cards = [basics.card("A","S"), basics.card("J","S")]
    played_cards = [basics.card("9","C"), basics.card("J","D"), basics.card("Q","C"), basics.card("A","H")]
    show = {'msg': msg, 'result': result, 'played_cards':played_cards, 'cards':cards, 'suits':1, 'yesno':1, 'next':1}
    
    if 'error' in data:
        show['error'] = data['error']
    return show	
Exemplo n.º 2
0
def index():
    msg = request.GET.get('msg')
    data = {}
    if not msg:
        msg = "all"
    cards = [basics.card("A","S"), basics.card("J","S")]
    played_cards = [basics.card("9","C"), basics.card("J","D"), basics.card("Q","C"), basics.card("A","H")]

    show = {'msg':msg, 'played_cards':played_cards, 'cards':cards, 'suits':1, 'yesno':1, 'next':1}
    if 'error' in data:
        show['error'] = data['error']
    return show	
Exemplo n.º 3
0
    def show_played(self, master, played_cards, dealer, side=TOP):
        labels = ["U:", "1:", "P:", "3:"]
        labels[dealer] = "*" + labels[dealer] + "*"
        labels.reverse()
        played_frame = Frame(master)
        played_frame.pack(side = side)
        rows = [1,0,1,2]
        columns = [2,1,0,1]
        dummys = 4 * [basics.card()]
        played_cards.cards.reverse()
#        for index, _card in enumerate(played_cards):
        for index, _card in enumerate((played_cards.cards + dummys)[:4]):
            self.show_card(_card, played_frame, text=labels[index], relief = FLAT, grid = (rows[index],columns[index]))                
Exemplo n.º 4
0
import curses
import basics

A = basics.card("A","C")
B = basics.card("9","C")
C = basics.card("K","H")
D = basics.card("J","D")

def display(top_card = None, trump = "S", dealer = 0, played_cards = [], cards = None, team = [4,5], msg = "", error = ""):
    ## Pulled from curses.wrapper 2.6, modified.
    try:
        # Initialize curses
        stdscr = curses.initscr()

        # Turn off echoing of keys, and enter cbreak mode,
        # where no buffering is performed on keyboard input
        curses.noecho()
        curses.cbreak()

        # In keypad mode, escape sequences for special keys
        # (like the cursor keys) will be interpreted and
        # a special value like curses.KEY_LEFT will be returned
        stdscr.keypad(1)

        # Start color, too.  Harmless if the terminal doesn't have
        # color; user can test with has_color() later on.  The try/catch
        # works around a minor bit of over-conscientiousness in the curses
        # module -- the error return from C start_color() is ignorable.
        try:
            curses.start_color()
        except: