def getPlayers(html): soup = BeautifulSoup(html, "html.parser") # <div class="order-title"><div>Miami Heat - Oklahoma City Thunder</div> pl = soup.findAll("span", "ev-outcome") playersJson = [] for a in pl: if not a.has_attr("onclick"): continue onclick = a["onclick"] onclick = re.sub("^[^{]*{[^{]*", "", onclick) onclick = re.sub("[^}]*}$", "", onclick) #print(onclick) resp = json.loads(onclick) if "Player total" in resp["alt_name"]: playersJson.append(resp) # print(resp["option"]) # print(resp["coef"]) # print() players = [] for a, b in util.pairwise(playersJson): player = util.Player() player.player_name = cleanName(a["option"]) player.player_total = cleanPoints(a["option"]) player.under = a["coef"] player.over = a["coef"] player.start_time = "NONE" player.bookie_name = BOOKIE_NAME player.bookie_url = BOOKIE_URL players.append(player) return players
def test_decorator(): print('[py/decorator]') oPlayer = util.Player(1024) oPlayer.signin() oPlayer.buyItem(64) print(oPlayer.getBaseName())
def getPlayers(html): soup = BeautifulSoup(html, "html.parser") pll = soup.findAll("tr", "ev_even_row") players = [] for p in pll: nameAndPoints = p.find("span").find(text=True) odds = p.findAll("td", "ev_pick_cell") under = odds[0].find(text=True) over = odds[1].find(text=True) player = util.Player() player.nameAndPoints = nameAndPoints player.under = under player.over = over players.append(player) return players
instructions_read = False while not instructions_read: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: instructions_read = True # Setting up Game Board board = util.Board(light_color=constants.LIGHT_COLOR, dark_color=constants.DARK_COLOR, surface=window, grid_dim=constants.GRID_DIM) player1 = util.Player(window, constants.PLAYER_1_COLOR, board, constants.PLAYER_1_CHECKER_POSITIONS, name="Player Red") player2 = util.Player(window, constants.PLAYER_2_COLOR, board, constants.PLAYER_2_CHECKER_POSITIONS, name="Player Blue") select = util.Selector(surface=window, des_color=constants.DESTINATION_COLOR, loc_color=constants.LOCATION_COLOR) logic = game_logic.GameLogic(player1=player1, player2=player2, board=board) # Main Game Loop while run: # If not paused, draw all board and selector
automated = False #Raised player flag raised = False #Game ended flag ended = False #Will display menu and ask player if ready to play #Will not move forward until the player answers 'yes' #Will display hint menu if answer != yes (or variant) automated = newGame() #Ceate players, everyone starts with $100 agent = util.Player("agent", 100) human = util.Player("human", 100) pot = 0 #This loop represents one entire playing hand while(True): #Shows starting new hand screen util.clear() util.printStartingNewHand() sleep(2) #Game starts util.clear() comCards = ["", "", "", "", ""] playerFolded = False playerCheck = False