Esempio n. 1
0
def spanish_col(name,
                height,
                length=None,
                average_gradient=None,
                maximum_gradient=None):
    return Col(name, country.Spain(), height, length, average_gradient,
               maximum_gradient)
Esempio n. 2
0
def swiss_col(name,
              height,
              length=None,
              average_gradient=None,
              maximum_gradient=None):
    return Col(name, country.Switzerland(), height, length, average_gradient,
               maximum_gradient)
Esempio n. 3
0
def andorran_col(name,
                 height,
                 length=None,
                 average_gradient=None,
                 maximum_gradient=None):
    return Col(name, country.Andorra(), height, length, average_gradient,
               maximum_gradient)
Esempio n. 4
0
def italian_col(name,
                height,
                length=None,
                average_gradient=None,
                maximum_gradient=None):
    return Col(name, country.Italy(), height, length, average_gradient,
               maximum_gradient)
Esempio n. 5
0
def french_col(name,
               height,
               length=None,
               average_gradient=None,
               maximum_gradient=None):
    return Col(name, country.France(), height, length, average_gradient,
               maximum_gradient)
Esempio n. 6
0
File: okcol.py Progetto: se4ai/code
def _sym1():
    c = Col()
    for x in list('abbcccc'):
        c + x
        print(c.has.ent, c.has.mode)
    assert close(c.has.ent, 1.3787836)
    assert c.has.mode == 'c'
Esempio n. 7
0
File: okcol.py Progetto: se4ai/code
def _col1():
    c = Col()
    for x in [9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4]:
        c + x
        print(c.has.sd)
    assert close(c.has.sd, 3.0608)
    assert c.has.mu == 7
Esempio n. 8
0
File: chops.py Progetto: se4ai/code
 def argmin(lst):  #Find best divide of 'lst'
     lhs, rhs = Col(), Col(y(z) for z in lst)
     least, cut = rhs.spread(), None
     lo, hi = x(lst[0]), x(lst[-1])
     for j, z in enumerate(lst):
         x1, y1 = x(z), y(z)
         rhs - y1
         lhs + y1
         if lhs.n() > width and rhs.n() > width:
             x2 = x(lst[j + 1])
             if x1 != x2:
                 if x1 - lo >= epsilon:
                     if hi - x2 >= epsilon:
                         tmp = xpect(rhs, lhs)
                         print(tmp, least)
                         if tmp < least:
                             cut, least = j + 1, tmp
     return cut
Esempio n. 9
0
File: rows.py Progetto: se4ai/code
 def __init__(i, name=None, headers=[]):
     "build the table, using the text in the headers"
     i.headers = headers
     i.name = name
     i.all = []  # stores all the rows
     i.cols = set([Col(pos=n, txt=txt) for n, txt in enumerate(headers)])
     for col in i.less:
         col.w = -1
     for col in i.more:
         col.w = 1
Esempio n. 10
0
from deck import Deck
from col import Col
from player import Player
from dealer import Dealer
import os

col = Col()
deck = Deck()
player = Player(100)
dealer = Dealer()




#This function resets global variables
def resetVariables():
	global deck, player, dealer
	deck.reset()
	player.reset()
	dealer.reset()

def arrayToString(ar):
	st=''
	for s in ar:
		st+='   '+str(s)
	return st

def printCards(show):
	if show:
		print (col.green("Dealer's cards: \t")+col.red(f"{arrayToString(dealer.getCards())}\t")+col.green("Total: "+col.red(str(dealer.getPoints()))))		
	else:
Esempio n. 11
0
 def do_work(self, row=None):
     r = Col.do_work(self, row)
     r = str(r).replace('.0', '')
     return r
Esempio n. 12
0
 def __init__(self, xe):
     Col.__init__(self, xe=xe)