Beispiel #1
0
 def __init__(self, width=600, height=400, fps=50, title="Planet Invader"):
     self.width = width
     self.height = height
     self.screen = pygame.display.set_mode((self.width, self.height))
     self.fps = fps
     self.title = title
     self.bgColor = (255, 255, 255)
     pygame.init()
     self.highScore=0
     self.score=0
     self.viewScores=Scores(self.highScore)
     self.scoreList=[]
     self.scoreList=self.viewScores.getScores('scores.txt')
     self.scoreList=self.getNumList(self.scoreList)
     self.highScore=max(self.scoreList)
     self.viewScores.drawList()
     self.intro=Start(self.highScore)
     self.tutorial=Instructions()
     self.gamePlay=Game(self.highScore)
     self.over=GameOver(self.highScore,self.score)
     self.clear=GameClear(self.highScore,self.score)
     self.start=True
     self.play=False
     self.howTo=False
     self.isOver=False
     self.congrats=False
     self.scores=False
     self._keys = dict()
     pygame.mixer.pre_init(44100,16,5,4096)
     pygame.mixer.init()
Beispiel #2
0
 def __init__(self, wrapper):
     super(Game, self).__init__(wrapper)
     self.type_scores = {'s': 10, 'e': 50}
     self.field = Field('1_lvl.txt')
     self.units = Units(self)
     self.scores = Scores(position=Vector(
         10,
         self.field.get_size().to_abs().y + 5),
                          level=1)
Beispiel #3
0
    def draw(self):

        cursor = Scores()
        topten = cursor.get_top_ten_scores()

        background = pygame.image.load("res/background_main.jpg").convert()
        self.screen.blit(background, [0, 0])

        mouse = pygame.mouse.get_pos()
        release = pygame.mouse.get_pressed()
        if (self.width / 2 - 75) < mouse[0] < (self.width / 2 +
                                               75) and 700 < mouse[1] < 750:
            pygame.draw.rect(self.screen, (220, 40, 55),
                             (self.width / 2 - 75, 700, 150, 50))
            if release[0] == 1:
                print 'click'
                return False
        else:
            pygame.draw.rect(self.screen, (163, 40, 55),
                             (self.width / 2 - 75, 700, 150, 50))

        pygame.font.init()
        myfont = pygame.font.SysFont("monospace", 72)
        hslabel = myfont.render("HIGHSCORES", 1, BLACK)
        myfont = pygame.font.SysFont("monospace", 24)
        bcklabel = myfont.render("BACK", 1, (0, 0, 0))
        text_rect = hslabel.get_rect(center=(self.width / 2, 30))

        self.screen.blit(hslabel, text_rect)
        self.screen.blit(bcklabel, (self.width / 2 - 33, 715))

        pygame.draw.line(self.screen, BLACK, (0, 60), (600, 60), 5)

        top = 100
        labels = []
        i = 0
        j = len(topten)
        myfont = pygame.font.SysFont("monospace", 32)
        for record in topten:
            labels.insert(
                i,
                myfont.render(
                    '{0}.{1: <55s}{2: >10s}'.format(
                        i + 1,
                        str(record[1]).strip(),
                        str(record[0]).strip()).replace(" ", "."), 0, BLACK))
            i = i + 1

        for label in labels:
            self.screen.blit(label, (50, top))
            top = top + 35

        pygame.display.flip()

        return True
Beispiel #4
0
def main():
    s1 = Scores("input1.txt")
    s1.readFile()
    while True:  # CORRECTION: instead while choice != 5:
        menu_options = [
            0, printByTotal, printByLimit, generateCountry, printByFrequency, 5
        ]
        menu_choice = displayMenu()
        if menu_choice == 5:
            break
        menu_options[menu_choice](s1)
Beispiel #5
0
    def __init__(self, pacSettings):
        pygame.init()
        self.screen = pygame.display.set_mode(
            (pacSettings.screen_width, pacSettings.screen_height))
        pygame.display.set_caption("Pacman Portal")

        self.player = Player(self.screen, 'images/PacMaze.txt', 'pacman0')

        self.maze = Maze(self.screen, "images/PacMaze.txt", "square")

        self.pellets = Pellets(self.screen, "images/PacMaze.txt", "pellets")

        self.nodes = Nodes(self.screen, "images/PacMaze.txt", "node")

        self.blueGhost = BlueGhost(self.screen, 'images/PacMaze.txt',
                                   'BlueGhost0')

        self.redGhost = RedGhost(self.screen, 'images/PacMaze.txt',
                                 'RedGhost0')

        self.yellowGhost = YellowGhost(self.screen, 'images/PacMaze.txt',
                                       'YellowGhost0')

        self.pinkGhost = PinkGhost(self.screen, 'images/PacMaze.txt',
                                   'PinkGhost0')

        self.stats = GameStats(pacSettings)

        self.playButton = Button(pacSettings, self.screen, "Play")

        self.pac = PacMan(self.screen, "pacman0")

        self.yellow = Yellow(self.screen, 'YellowGhost0')

        self.pink = Pink(self.screen, 'PinkGhost0')

        self.red = Red(self.screen, 'RedGhost0')

        self.blue = Blue(self.screen, "BlueGhost0")

        self.oldHiscore = 0

        self.scores = Scores(pacSettings, self.screen, self.stats)

        fo = open("foo.txt", "r+")
        self.stats.high_score = int(fo.readline())
        fo.close()
        self.oldHiscore = self.stats.high_score
        self.title = Scoreboard(self.screen, "pacmantitle")
Beispiel #6
0
    def get_shop_information4hot(shop, longitude, latitude, user_id):
        result = dict()
        try:
            result["shop_id"] = shop.id
            result["shop_name"] = shop.name
            result["shop_price"] = shop.dianping_avg_price
            if shop.category:
                result["shop_category"] = shop.category.name
            else:
                result["shop_category"] = None
            if shop.dianping_city:
                result["city"] = shop.dianping_city
            else:
                result["city"] = None

            result["shop_rate"] = DianPings.DIANPING_RATING[int(2 * shop.dianping_avg_rating)]
            if shop.photo_url:
                result["shop_image"] = files.BASE_URL_4_IMAGE + shop.photo_url
            else:
                if shop.category:
                    result["shop_image"] = files.BASE_URL_4_IMAGE + shop.category.icon
                else:
                    result["shop_image"] = None
            result["distance"] = Shops.get_distance_from_shop(shop, latitude, longitude)
            if shop.dianping_business_id:
                result["is_from_dianping"] = True
            else:
                result["is_from_dianping"] = False

            publishes = Publishes.get_publishes_by_shop(shop.id)
            if publishes:
                result["publish_count"] = publishes.count()
            else:
                result["publish_count"] = 0

            score_dict = Scores.get_total_score(shop, user_id)
            score = Scores.get_concrete_score(score_dict)
            score_level = Scores.get_level_info(score)
            if score_level:
                result["score_key"] = score_level.get("key", "--")
            else:
                result["score_key"] = "--"

        except Exception as ex:
            Logs.print_current_function_name_and_line_number(ex)

        return result
Beispiel #7
0
def back_populator():
    # Start date of season
    start_date = datetime.date(2020, 12, 22)
    end_date, _ = get_dates()
    while start_date <= end_date:
        Report().generate_reports(start_date)
        Scores(start_date).poll()
        start_date = start_date + datetime.timedelta(days=1)
Beispiel #8
0
def main():
    data = Scores()  # create Scores object
    gen = data.getOne()  # create generator object
    print(next(gen))  # fetch first data of object
    data.printByLast()  # print all data sorted by last field
    print(next(gen))  # fetch next data of object
    data.printMaxMin()  # print the max and min of the total scores
    print(next(gen))  # fetch next data of object
Beispiel #9
0
 def __init__(self, config):
     self.query_f = Queries.get_by_name(config['query'])
     self.score_f = Scores.get_by_name(config['score'])
     self.create_model = Models.get_by_name(config['model'])
     if 'encoder' in config:
         self.create_encoder = Encoders.get_by_name(config['encoder'])
     self.init_size = config['init_size']
     self.batch_size = config['batch_size']
     self.total_size = config['total_size']
     self.queries_number = config['queries_number']
     self.random_state = config['random_state']
Beispiel #10
0
    def __init__(self):
        self.settings = Settings()
        self.show_scores = False
        self.play_game = False
        self.bg_music.play(99)
        self.elapsed_time = 0
        self.count = 0

        self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
        self.settings.screen_width = self.screen.get_rect().width
        self.settings.screen_height = self.screen.get_rect().height
        pygame.display.set_caption("Alien Invasion")

        self.stats = GameStats(self)
        self.sb = Scoreboard(self)
        self.highscores = Scores(self)
        self.scores = []
        self.ship = Ship(self)
        self.bullets = pygame.sprite.Group()

        self.aliens = pygame.sprite.Group()
        self.aliens2 = pygame.sprite.Group()
        self.aliens3 = pygame.sprite.Group()
        self.ufo_group = pygame.sprite.Group()

        # Images
        self.image = 'images/alien.png'
        self.image2 = 'images/alien2.png'
        self.image3 = 'images/alien3.png'
        self.image4 = 'images/alien4.png'
        self.image5 = 'images/alien5.png'
        self.image6 = 'images/alien6.png'
        self.al_image = pygame.image.load('images/alien.png')
        self.al_image2 = pygame.image.load('images/alien2.png')
        self.al_image3 = pygame.image.load('images/alien3.png')
        self.al_image4 = pygame.image.load('images/alien4.png')
        self.al_image5 = pygame.image.load('images/alien5.png')
        self.al_image6 = pygame.image.load('images/alien6.png')

        self.al_image7 = pygame.image.load('images/ufo.png')
        self.ufo_spawned = False

        self._create_fleet()
        self.load_ufo()

        self.clock = pygame.time.Clock()
        self.fps = 120

        # Buttons
        self.play_button = Button(self, "PLAY", 700, 400)
        self.restart_button = Button(self, "RESTART", 900, 10)
        self.exit_button = Button(self, "EXIT", 1000, 400)
        self.scores_button = Button(self, "SCORES", 850, 500)
        self.back_button = Button(self, "BACK", 100, 200)
Beispiel #11
0
def main():

    pygame.display.set_caption(TITLE)
    crashed = False

    while not crashed:
        if GAMESTATE.changed():
            if GAMESTATE.get() == 0:
                backgroundGroup = Backgrounds()
                groundGroup = Grounds()
                menuGroup = pygame.sprite.Group(Menu(0))

                GROUPS.add(backgroundGroup, groundGroup, menuGroup)

            elif GAMESTATE.get() == 1:
                birdGroup = Birds()
                backgroundGroup = Backgrounds()
                pipeGroup = Pipes(birdGroup.getBird())
                groundGroup = Grounds()
                scoreGroup = Scores()

                GROUPS.add(backgroundGroup, pipeGroup, groundGroup, birdGroup,
                           scoreGroup)

            elif GAMESTATE.get() == 2:
                menuGroup = pygame.sprite.Group(Menu(1))

                GROUPS.add(menuGroup)
            else:
                crashed = True

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                crashed = True
            elif event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
                if GAMESTATE.get() == 0:
                    GAMESTATE.set(1)
                elif GAMESTATE.get() == 1:
                    birdGroup.getBird().bounce()
                elif GAMESTATE.get() == 2:
                    GAMESTATE.set(0)
                else:
                    crash = True

        GROUPS.update()
        GROUPS.draw(DISPLAY)

        pygame.display.update()
        CLOCK.tick(TICKRATE)

    pygame.quit()
    quit()
Beispiel #12
0
    def __init__(self, master):
        self.game_state = 0

        # set up frame
        self.frame = tk.Frame(master)
        self.frame.pack()
        self.board = None
        self.touched = False
        self.timer = Timer()
        self.after = None
        self.scores = Scores()
        self.scores.print_scores()

        self.start_new_game()
Beispiel #13
0
def main():
    iris_parameters = []
    iris_species = []

    with open('datasets/iris.csv', mode='r') as iris_file:
        irises = list(csv.reader(iris_file))
        rd.shuffle(irises)  # get our lines of data in random order
        for iris in irises:
            parameters = [float(n) for n in iris[0:4]]
            iris_parameters.append(parameters)
            species = iris[4]
            iris_species.append(species)

    iris_parameters = np.array(iris_parameters)
    normalizar(iris_parameters)
    iris_species = np.array(iris_species).reshape(-1, 1)

    print("\nTreinando...\n")

    iris_network = Perceptron(taxa=0.2, ativacao="l_relu", N=[4], debug=1)

    # número de dados de treino
    n_train = 120

    # train over the first 140 irises in the data set 50 times
    x_train = iris_parameters[:n_train]
    y_train = iris_species[:n_train]

    iris_network.treinar(x_train, y_train, M=100)
    y_train_pred = iris_network.prever(x_train)
    scores = Scores(y_train, y_train_pred)
    scores.exibir_grafico()

    # test over the last 10 of the irises in the data set
    x_test = iris_parameters[n_train:]
    y_test = iris_species[n_train:]
    y_test_pred = iris_network.prever(x_test)

    # minha classe geradora da matriz de confusão
    scores = Scores(y_test, y_test_pred)
    scores.exibir_grafico()
Beispiel #14
0
def run_game():
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode(
        (ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("Pong")

    first_time = True
    play_but = Button(screen, 'Play')
    ball = Ball(screen)
    paddles = Group()
    score = Scores(screen)
    func.create_paddles(screen, ball, paddles)

    while True:
        func.check_events(ai_settings, paddles, play_but)
        if ai_settings.game_active:
            paddles.update()
            first_time = False
        func.update_screen(ai_settings, screen, ball, paddles, score, play_but,
                           first_time)
Beispiel #15
0
# _*_ coding: utf-8 _*_

import pygame  # pygame
from var import Var  # for const
from ship import Ship  # ship
from scores import Scores
from sounds import Sounds
import game_functions as gf  # Game functions
from pygame.sprite import Group

pygame.init()
ai_var = Var()
screen = pygame.display.set_mode([ai_var.screen_width, ai_var.screen_height])
pygame.display.set_caption("Alien War")
ship = Ship(screen)
sc = Scores(screen, ai_var)
sd = Sounds()
timer = pygame.time.Clock()
bullets = Group()
aliens = Group()


def main():
    while sc.game_active:  # Game Started
        gf.check_events(ship, ai_var, screen, bullets, sc, sd)  # Check events
        ship.update(ai_var)  # Update the status of the ship
        bullets.update()
        aliens.update(sc)
        gf.update_aliens(aliens, screen, ai_var, bullets, sc, ship, sd)
        gf.remove(bullets, aliens, screen)
        gf.update_screen(ai_var, screen, ship, bullets, aliens,
Beispiel #16
0
#pygame.init()
#fps = pygame.time.Clock()

#color palette
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLACK = (0, 0, 0)
SILVER = (192, 192, 192)
BLUE = (0, 0, 255)
YELLOW = (237, 249, 57)
PURPLE = (189, 26, 221)
GOLD = (206, 184, 136)

CLOCK = pygame.time.Clock()
scoredb = Scores()
#BALL_RADIUS = math.sqrt(WIDTH*HEIGHT)
#PAD_WIDTH = WIDTH/10
#PAD_HEIGHT = HEIGHT/50
#HALF_PAD_WIDTH = PAD_WIDTH/2
#HALF_PAD_HEIGHT = PAD_HEIGHT/2
score = 0
score_multi = 1

#window = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)
#pygame.display.set_caption('Brick Break')


def init(width, height):
    global fps
    global lives
Beispiel #17
0
    def get_shop_information4discovery(shop, longitude, latitude, user_id):
        result = dict()
        result["shop_id"] = shop.id
        result["business_url"] = shop.dianping_business_url
        result["deals_url"] = shop.dianping_deals_url
        result["shop_name"] = shop.name
        result["shop_price"] = shop.dianping_avg_price
        result["shop_category"] = shop.category.name
        if shop.dianping_business_id:
            result["city"] = shop.dianping_city
            result["shop_address"] = shop.dianping_city + shop.dianping_address
            result["is_from_dianping"] = True
        else:
            result["is_from_dianping"] = False
            if shop.address.china:
                result["city"] = shop.address.china.name
                result["shop_address"] = shop.address.china.name + shop.address.detail_address
            else:
                result["city"] = shop.dianping_city
                result["shop_address"] = shop.address.detail_address
        if shop.photo_url:
            result["shop_image"] = files.BASE_URL_4_IMAGE + shop.photo_url
        else:
            result["shop_image"] = None

        result["shop_rate"] = DianPings.DIANPING_RATING[int(2 * shop.dianping_avg_rating)]

        result["distance"] = Shops.get_distance_from_shop(shop, latitude, longitude)
        publishes = Publishes.get_publishes_by_shop(shop.id)
        result["publish_count"] = publishes.count()
        result["has_coupon"] = shop.dianping_has_coupon
        result["has_deal"] = shop.dianping_has_deal

        score = -1000
        if publishes.count() < 0:
            pass
        else:
            score_dict = Scores.get_total_score(shop, user_id)
            score = Scores.get_concrete_score(score_dict)
        if score == -1000:
            result["score"] = -1000
            result["score_key"] = "--"
            result["score_name"] = "--"
        else:
            result["score"] = score
            score_level = Scores.get_level_info(score)
            result["score_key"] = score_level.get("key", "--")
            result["score_name"] = score_level.get("name", "--")
        result["formaldehyde"] = shop.formaldehyde
        if shop.formaldehyde_image:
            result["formaldehyde_image"] = files.BASE_URL_4_IMAGE + shop.formaldehyde_image.name
            result["valid_score"] = True
        else:
            result["formaldehyde_image"] = None
            result["valid_score"] = False

        result["recommended_count"] = UserShopRelationMethods.get_recommended_count_by_shop(shop)
        result["not_recommended_count"] = UserShopRelationMethods.get_not_recommended_count_by_shop(shop)
        usr = UserShopRelationMethods.get_by_shop_and_user(shop.id, user_id)
        if usr:
            result["is_recommended"] = usr.is_recommended
        else:
            result["is_recommended"] = -1
        return result
Beispiel #18
0
class Game():
    def __init__(self, pacSettings):
        pygame.init()
        self.screen = pygame.display.set_mode(
            (pacSettings.screen_width, pacSettings.screen_height))
        pygame.display.set_caption("Pacman Portal")

        self.player = Player(self.screen, 'images/PacMaze.txt', 'pacman0')

        self.maze = Maze(self.screen, "images/PacMaze.txt", "square")

        self.pellets = Pellets(self.screen, "images/PacMaze.txt", "pellets")

        self.nodes = Nodes(self.screen, "images/PacMaze.txt", "node")

        self.blueGhost = BlueGhost(self.screen, 'images/PacMaze.txt',
                                   'BlueGhost0')

        self.redGhost = RedGhost(self.screen, 'images/PacMaze.txt',
                                 'RedGhost0')

        self.yellowGhost = YellowGhost(self.screen, 'images/PacMaze.txt',
                                       'YellowGhost0')

        self.pinkGhost = PinkGhost(self.screen, 'images/PacMaze.txt',
                                   'PinkGhost0')

        self.stats = GameStats(pacSettings)

        self.playButton = Button(pacSettings, self.screen, "Play")

        self.pac = PacMan(self.screen, "pacman0")

        self.yellow = Yellow(self.screen, 'YellowGhost0')

        self.pink = Pink(self.screen, 'PinkGhost0')

        self.red = Red(self.screen, 'RedGhost0')

        self.blue = Blue(self.screen, "BlueGhost0")

        self.oldHiscore = 0

        self.scores = Scores(pacSettings, self.screen, self.stats)

        fo = open("foo.txt", "r+")
        self.stats.high_score = int(fo.readline())
        fo.close()
        self.oldHiscore = self.stats.high_score
        self.title = Scoreboard(self.screen, "pacmantitle")

    def play(self):
        eloop = EventLoop(finished=False)

        while not eloop.finished:
            eloop.checkEvents(self)
            self.updateScreen()
            # self.check_events()
            self.player_update()

    def updateScreen(self):
        self.screen.fill((0, 0, 0))
        #put main menu here
        # if game.stats_active

        if self.stats.game_active == False:
            self.player.lives = 2
            self.stats.score = 0
            self.screen.fill((0, 0, 0))
            self.pac.blitme()
            self.blue.blitme()
            self.red.blitme()
            self.yellow.blitme()
            self.pink.blitme()
            self.playButton.draw_button()
            self.title.blitme()
            if self.stats.high_score_active == True:
                self.playButton.prep_hiscores(str(self.stats.high_score))
                self.playButton.show_hiscore()

        else:
            self.nodes.blitme()
            self.maze.blitme()
            self.pellets.blitme()
            self.blueGhost.blitme()
            self.redGhost.blitme()
            self.yellowGhost.blitme()
            self.pinkGhost.blitme()
            self.player.blitme()
            self.scores.show_score()

        pygame.display.flip()

    def player_update(self):
        if self.stats.game_active == True:
            if self.player.lives == 0:
                self.stats.game_active = False
                self.pellets.build()
                pygame.mouse.set_visible(True)
                if self.oldHiscore < self.stats.high_score:
                    foo = open("foo.txt", "w")
                    foo.write(str(self.stats.high_score))
                    foo.close()
            self.blueGhost.update(self.maze)
            self.redGhost.update(self.maze)
            self.yellowGhost.update(self.maze)
            self.pinkGhost.update(self.maze)
            self.player.update(self.maze, self.pellets, self.blueGhost,
                               self.redGhost, self.yellowGhost, self.pinkGhost,
                               self.stats, self.scores)
            self.scores.show_score()
        else:
            self.pac.update()
            self.blue.update()
            self.red.update()
            self.yellow.update()
            self.pink.update()
Beispiel #19
0
 def __init__(self, train, label, extra):
     self.trainSet = train
     self.labelSet = label
     self.scores = Scores()
Beispiel #20
0
    def run(self):
        """Compute the statistical significance of a difference between
        the systems via a paired two-sided approximate randomization test.

        Returns:
            An approximation of the probability of observing corpus-wide
            differences in scores at least as extreme as observed here, when
            there is no difference between the systems.
        """

        absolute_difference = math.fabs(
            self.aggregator(self.system1_scores) -
            self.aggregator(self.system2_scores))
        shuffled_was_at_least_as_high = 0

        for i in range(0, self.trials):
            pseudo_system1_scores = Scores()
            pseudo_system2_scores = Scores()

            for score1, score2 in zip(self.system1_scores,
                                      self.system2_scores):
                if random.randint(0, 1) == 0:
                    pseudo_system1_scores.append(score1)
                    pseudo_system2_scores.append(score2)
                else:
                    pseudo_system1_scores.append(score2)
                    pseudo_system2_scores.append(score1)

            pseudo_difference = math.fabs(
                self.aggregator(pseudo_system1_scores) -
                self.aggregator(pseudo_system2_scores))

            if pseudo_difference >= absolute_difference:
                shuffled_was_at_least_as_high += 1

        significance_level = (shuffled_was_at_least_as_high +
                              1) / (self.trials + 1)

        return significance_level
Beispiel #21
0
class Minesweeper:

    def __init__(self, master):
        self.game_state = 0

        # set up frame
        self.frame = tk.Frame(master)
        self.frame.pack()
        self.board = None
        self.touched = False
        self.timer = Timer()
        self.after = None
        self.scores = Scores()
        self.scores.print_scores()

        self.start_new_game()
        

    def start_new_game(self):
        self.game_state = Game_State.PLAYING
        self.board = Board(5,12,3)
        self.timer.reset()

        # show "Minesweeper" at the top
        self.label_time = tk.Label(self.frame, text="Time: "+str(self.timer.curr_time))
        self.label_time.grid(row = 0, column = 0, columnspan = self.board.width)
        self.refresh_timer()

        for tile in self.board.tiles:
            tile.set_button(self.frame, self.board.image_unopened)
            tile.bind_button(self.left_click_event, self.right_click_event)
            tile.button.grid(row = tile.x + 1, column = tile.y)

        #add mine and count at the end
        self.label_num_mine = tk.Label(self.frame, text = "Mines: "+str(self.board.num_mines))
        self.label_num_mine.grid(row = self.board.height + 1, column = 0)

        self.label_num_flag = tk.Label(self.frame, text = "Flags: "+str(self.board.flags))
        self.label_num_flag.grid(row = self.board.height + 1, column = self.board.width-1)

    def left_click_event(self, tile):
        if not self.touched:
            self.touched = True
            self.timer.start()
        if tile.mine and tile.state == Tile_State.BLANK: #if a mine
            # end game
            self.gameover()
        elif tile.state == Tile_State.BLANK:
            tile.state = Tile_State.CLICKED
            self.board.clicked += 1
            tile.unbind_left_button()
            #change image
            if not tile.nearby_mines and not tile.mine:
                tile.change_button_image(self.board.image_opened)
                self.board.reveal_ring(tile)
            elif not tile.mine:
                tile.change_button_image(self.board.image_num[tile.nearby_mines-1])
            # if not already set as clicked, change state and count
            if self.board.clicked == self.board.num_tiles - self.board.num_mines:
                self.victory()

    def right_click_event(self, tile):
        if not self.touched:
            self.touched = True
            self.timer.start()
        print("right clicked at", tile.x, tile.y)
        # if not clicked
        if tile.state == Tile_State.BLANK:
            tile.state = Tile_State.FLAG
            tile.change_button_image(self.board.image_flag)
            # if a mine
            if tile.mine:
                self.board.correct_flags += 1
            self.board.flags += 1
            self.board.increase_flags(tile)
            self.update_flags()
        # if flagged, unflag
        elif tile.state == Tile_State.FLAG:
            tile.state = Tile_State.QUESTION
            tile.change_button_image(self.board.image_question)
            #button_data[0].bind('<Button-1>', self.lclicked_wrapper(button_data[3]))
            # if a mine
            if tile.mine:
                self.board.correct_flags -= 1
            self.board.flags -= 1
            self.board.decrease_flags(tile)
            self.update_flags()
        elif tile.state == Tile_State.QUESTION:
            tile.state = Tile_State.BLANK
            tile.change_button_image(self.board.image_unopened)
        elif tile.state == Tile_State.CLICKED:
            if tile.nearby_flags == tile.nearby_mines:
                self.board.confirm_flags(tile, self.trigger_gameover)
                if self.game_state == Game_State.LOSS:
                    self.gameover()
                else:
                    self.board.reveal_ring(tile)
                    if self.board.clicked == self.board.num_tiles - self.board.num_mines:
                        self.victory()

    def update_flags(self):
        self.label_num_flag.config(text = "Flags: "+str(self.board.flags))

    def refresh_timer(self):
        self.label_time.config(text="Time: "+str(self.timer.curr_time))
        self.after = root.after(100, self.refresh_timer)

    def victory(self):
        print("you win")
        self.game_state = Game_State.WIN
        self.end_game()
        self.scores.save_score("player1", self.timer.curr_time)

    def trigger_gameover(self):
        self.game_state = Game_State.LOSS

    def gameover(self):
        print("you lose")
        self.game_state = Game_State.LOSS
        self.end_game()


    def end_game(self):
        self.timer.stop()
        if self.after is not None:
            root.after_cancel(self.after)
            self.after = None
        self.board.reveal_mines()
Beispiel #22
0
def main():
    #esto es para centrar la pantalla
    os.environ['SDL_VIDEO_CENTERED'] = "1"

    pygame.init()
    #mouse invisible
    pygame.mouse.set_visible(0)
    screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
    pygame.display.set_icon(tool.load_image("skyhaw"))
    pygame.display.set_caption(NAME)
    f = load_file("options")
    c = 0
    for value in f:
        c += 1
        if c == 1:
            Options.music = str_to_bool(value)
        if c == 2:
            Options.sound = str_to_bool(value)
        if c == 3:
            Options.playername = value
    tool.load_music("music")
    #aca se controla con un if las  opciones de musica on/off
    if Options.music == True:
        pygame.mixer.music.play(-1)
    main_selection = 0
    Sea.global_sea = Sea()
    while not main_selection == 6:
        main_selection = Menu(screen,
                              ("Jugar", "Historia", "Mejores Puntos",
                               "Opciones", "Ayuda", "Creditos", "Salir"),
                              main_selection).run()
        if main_selection == 0:
            dificultad = 0
            dificultad = Menu(screen, ("Cadete", "Teniente", "Halcon"),
                              dificultad).run()
            if (dificultad is not 6):
                screen = pygame.display.set_mode((800, 200))
                puntos = main_loop(dificultad)
                screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

                objScores = Scores(screen, dificultad)
                objScores.scores, res = objScores.loadNewScore(
                    Options.playername, puntos, dificultad)
                if (res):
                    objScores.run()
        elif main_selection == 1:
            Text(screen, "history").run()
            #Historia
        elif main_selection == 2:
            view = 0
            view = Menu(screen, ("Cadete", "Teniente", "Halcon"), view).run()
            if (view is not 6):
                Scores(screen, view).run()
            #Mejores Puntos
        elif main_selection == 3:
            Option(screen).run()
            #Opciones
        elif main_selection == 4:
            Text(screen, "help").run()
        elif main_selection == 5:
            Text(screen, "credit").run()
        pygame.display.update()
    pygame.quit()
    sys.exit()
Beispiel #23
0
 def set_score_f(self, raw_score):
     score = Scores.get_by_name(raw_score)
     res = copy.deepcopy(self)
     res.score_f = score
     return res
Beispiel #24
0
class Main(object):
    
# returns a list of past scores in order to generate score page and high score
    def getNumList(self,list):
        new=[]
        for i in range(len(list)):
            num=int(list[i][:-1])
            new.append(num)
        return new

    def __init__(self, width=600, height=400, fps=50, title="Planet Invader"):
        self.width = width
        self.height = height
        self.screen = pygame.display.set_mode((self.width, self.height))
        self.fps = fps
        self.title = title
        self.bgColor = (255, 255, 255)
        pygame.init()
        self.highScore=0
        self.score=0
        self.viewScores=Scores(self.highScore)
        self.scoreList=[]
        self.scoreList=self.viewScores.getScores('scores.txt')
        self.scoreList=self.getNumList(self.scoreList)
        self.highScore=max(self.scoreList)
        self.viewScores.drawList()
        self.intro=Start(self.highScore)
        self.tutorial=Instructions()
        self.gamePlay=Game(self.highScore)
        self.over=GameOver(self.highScore,self.score)
        self.clear=GameClear(self.highScore,self.score)
        self.start=True
        self.play=False
        self.howTo=False
        self.isOver=False
        self.congrats=False
        self.scores=False
        self._keys = dict()
        pygame.mixer.pre_init(44100,16,5,4096)
        pygame.mixer.init()

    def timerFired(self, dt):
        self.gamePlay.timerFired(dt)

# reset values after each mode change
    def resetTrans(self):
        self.intro.enterPlay=False
        self.intro.enterHowTo=False
        self.intro.enterScores=False
        self.tutorial.enterStart=False
        self.tutorial.pageOne=True
        self.viewScores.backMenu=False
        self.viewScores.drawList()
        self.gamePlay.gameOver=False
        self.gamePlay.gameClear=False
        self.gamePlay.pause=False
        self.gamePlay.player.x=260
        self.gamePlay.player.y=160
        self.gamePlay.gauge=0
        self.gamePlay.score=0
        self.gamePlay.time=0
        self.gamePlay.missileList.empty()
        self.gamePlay.humans.empty()
        self.gamePlay.houses.empty()
        self.gamePlay.buildings.empty()
        self.gamePlay.player.__init__(3,260,160)
        self.gamePlay.player.update(0,0)
        self.gamePlay.beam.__init__(230,240)
        self.gamePlay.beam.update(0,0)
        self.gamePlay.player.livesLeft=3
        self.over.back=False
        self.clear.back=False

# run all of the modes using booleans and while loops
    def run(self):
        clock = pygame.time.Clock()
        # screen = pygame.display.set_mode((self.width, self.height))
        # set the title of the window
        pygame.display.set_caption(self.title)

        # call game-specific initialization
        playing = True
        while playing:
            self.screen.fill(self.bgColor)
            while self.start:
                self.intro.getEvent()
                if self.intro.enterPlay:
                    self.start=False
                    self.play=True
                elif self.intro.enterHowTo:
                    self.start=False
                    self.howTo=True
                elif self.intro.exitGame:
                    playing=False
                    self.start=False
                elif self.intro.enterScores:
                    self.start=False
                    self.scores=True
                self.intro.redrawAll(self.screen)
                pygame.display.flip()
            while self.howTo:
                if self.tutorial.enterStart:
                    self.howTo=False
                    self.start=True
                self.tutorial.getEvent()
                self.tutorial.redrawAll(self.screen)
                pygame.display.flip()
            while self.scores:
                if self.viewScores.backMenu:
                    self.scores=False
                    self.start=True
                self.viewScores.getEvent()
                self.viewScores.redrawAll(self.screen)
                pygame.display.flip()
            while self.play:
                time = clock.tick(self.fps)
                self.timerFired(time)
                if not pygame.mixer.music.get_busy():
                    self.gamePlay.playMusic()
                if self.gamePlay.gameOver:
                    pygame.mixer.music.stop()
                    if self.gamePlay.score>self.highScore:
                        self.highScore=self.gamePlay.score
                    self.intro=Start(self.highScore)
                    self.viewScores.drawList()
                    if self.gamePlay.score>self.viewScores.scoreList[-9]:
                        self.viewScores.writeFile('scores.txt',"%d\n" \
                            % self.gamePlay.score)
                    self.play=False
                    self.isOver=True
                if self.gamePlay.gameClear:
                    pygame.mixer.music.stop()
                    if self.gamePlay.score>self.highScore:
                        self.highScore=self.gamePlay.score
                    self.intro=Start(self.highScore)
                    self.viewScores.drawList()
                    if self.gamePlay.score>self.viewScores.scoreList[-9]:
                        self.viewScores.writeFile('scores.txt',"%d\n" \
                            % self.gamePlay.score)
                    self.viewScores.writeFile('scores.txt',"%d\n" \
                        % self.gamePlay.score)
                    self.play=False
                    self.congrats=True
                self.gamePlay.getEvent()
                self.gamePlay.keys()
                self.gamePlay.redrawAll(self.screen)
                pygame.display.flip()
            while self.isOver:
                self.gamePlay.beamSound.stop()
                if self.over.back:
                    self.isOver=False
                    self.start=True
                self.over.getEvent()
                self.over.redrawAll(self.screen)
                pygame.display.flip()
            while self.congrats:
                self.gamePlay.beamSound.stop()
                if self.clear.back:
                    self.congrats=False
                    self.start=True
                self.clear.getEvent()
                self.clear.redrawAll(self.screen)
                pygame.display.flip()
            self.resetTrans()
        pygame.quit()
Beispiel #25
0
from turtle import Screen
from players import Players
from board import Gameboard
from scores import Scores
from ball import Ball
from time import sleep

screen = Screen()
screen.bgcolor("black")
screen.setup(width=800, height=600)
screen.title("Invalid-Pong")
screen.tracer(0)

score = Scores()
gameborad = Gameboard()
player1 = Players(-350, 0)
player2 = Players(350, 0)
ball = Ball()

screen.update()
screen.listen()

screen.onkeypress(player1.up, "Up")
screen.onkeypress(player1.down, "Down")

screen.onkeypress(player2.up, "w")
screen.onkeypress(player2.down, "s")
ball.move()

on = True
Beispiel #26
0
def poll():
    _, yesterday = get_dates()
    print(f"Polling for date: {yesterday}")
    Report().generate_reports(yesterday)
    Scores(yesterday).poll()
Beispiel #27
0
    def showScores(self, newScore, doki):
        outerRect = Rectangle(Point(CS, CS), Point(WIDTH - CS, HEIGHT - CS))
        outerRect.setFill('purple')
        outerRect.draw(self.win)
        innerRect = Rectangle(Point(CS + 5, CS + 5), \
         Point(WIDTH - CS - 5, HEIGHT - CS - 5))
        innerRect.setFill('floral white')
        innerRect.draw(self.win)

        text = Text(Point(WIDTH / 2, 2 * CS), "Game Over!")
        text.setTextColor('black')
        text.setSize(36)
        text.draw(self.win)

        text = Text(Point(WIDTH / 2, CS * 3.5),
                    "You cleared " + str(newScore) + ' lines!')
        text.setSize(18)
        text.setTextColor('black')
        text.draw(self.win)

        text = Text(Point(WIDTH / 2, CS * 4.5), "High Scores:")
        text.setSize(18)
        text.setTextColor('black')
        text.draw(self.win)

        for i in range(1, 11):
            text = Text(Point(CS * 1.65, CS * (4.4 + i)), str(i) + '.')
            text.draw(self.win)

        sc = Scores()
        newIdx = sc.addScore('', newScore)
        highScore = False
        if newIdx < 10:
            highScore = True
        scoreList = sc.getScores()
        vals = [5.5, 10]
        currScore = None
        for val in range(2):
            for i, scoreArr in enumerate(scoreList):
                if doki and not val:  # :)
                    text = Text(Point(CS * vals[val], CS * (5.4 + i)),
                                'Monika')
                else:
                    text = Text(Point(CS * vals[val], CS * (5.4 + i)),
                                str(scoreArr[val]))
                text.draw(self.win)
                if val == 0 and i == newIdx:
                    currScore = text
        if not highScore:
            return
        newEntry = Entry(Point(CS * 5.5, CS * (5.4 + newIdx)), 10)
        newEntry.draw(self.win)
        submitted = False
        newName = ''
        while self.win.getKey() != 'Return':
            newName = newEntry.getText()
        newEntry.undraw()
        currScore.undraw()
        if doki:
            currScore.setText('Just Monika')  # :')
        else:
            currScore.setText(newName)
        currScore.draw(self.win)
        sc.addName(newIdx, newName)
Beispiel #28
0
def run():
    if with_viewer:
        view = Viewer(config_file)

    loader_test = create_loader(dataset_name, config_file)
    loader_test.start()

    first_time = True
    iter_test_nr = 0  #nr of batches processed
    samples_test_processed = 0

    #torch stuff
    lattice_to_splat = LatticePy()
    lattice_to_splat.create(
        config_file, "splated_lattice"
    )  #IMPORTANT THAT the size of the lattice in this file is the same as the size of the lattice that was used during training
    model_ctx = ModelCtx(base_lr,
                         learning_rate,
                         weight_decay,
                         batch_size,
                         nr_epochs_per_half_cycle,
                         exponential_gamma,
                         model_params,
                         with_debug_output=with_debug_output,
                         with_error_checking=with_error_checking)
    mode = "eval"  #this will switch between train and eval as we finish each epoch

    torch.set_grad_enabled(False)
    scores = Scores(node_name, port)

    write_scannet_predictions = False

    cloud = MeshCore()
    cloud.load_from_file(
        "/home/local/staff/rosu/data/ais_kitchen/kitchen_meshes/kitchen_2105.ply"
    )
    cloud.random_subsample(0.7)
    cloud.rotate_x_axis(1.0)
    cloud.C = cloud.C / 255
    cloud.C = cloud.C + 0.2  # for some reason this yields better results
    # nr_classes=21
    #use the dataloader to get the labelmngr
    while True:
        if (loader_test.has_data()):
            cloud_with_label_mngr = loader_test.get_cloud()
            cloud.m_label_mngr = cloud_with_label_mngr.m_label_mngr
            break

    # for sigma in np.arange(0.04, 0.1, 0.01):
    # lattice_to_splat.lattice.set_sigma(sigma)
    # sigma=0.07
    # lattice_to_splat.lattice.set_sigma(sigma)

    positions, values, target = model_ctx.prepare_cloud(
        cloud
    )  #prepares the cloud for pytorch, returning tensors alredy in cuda
    pred_softmax, pred_raw, delta_weight_error_sum = model_ctx.forward(
        lattice_to_splat, positions, values, mode,
        cloud.m_label_mngr.nr_classes(), 1)

    if first_time:
        first_time = False
        #now that all the parameters are created we can fill them with a model from a file
        model_ctx.model.load_state_dict(torch.load(checkpoint_path))
        #need to rerun forward with the new parameters to get an accurate prediction
        pred_softmax, pred_raw, delta_weight_error_sum = model_ctx.forward(
            lattice_to_splat, positions, values, mode,
            cloud.m_label_mngr.nr_classes(), 1)

    lattice_to_splat.compute_nr_points_per_lattice_vertex()
    print("max color is ", cloud.C.max())

    if with_viewer:
        show_predicted_cloud(pred_softmax, cloud)

    if do_write_predictions:
        pred_path = os.path.join(
            output_predictions_path,
            str(samples_test_processed) + "_2105_pred.ply")
        print("writing prediction to ", pred_path)
        write_prediction(pred_softmax, cloud, pred_path)
Beispiel #29
0
# assim o tipo de rede é definido pelo tipo da conexão dos neurônios
# e o mesmo tipo pode ser treinado de formas diferentes, mas 
# mesmo assim usando esse formato de conexão

# "adam" é outro tipo de otimização, diferente do SGD
model.compile(optimizer="adam", loss='sparse_categorical_crossentropy', metrics=['accuracy'])

print("\nTreinando...\n")
model.fit(x_train, y_train, epochs=20)

# avaliando dados de treinamento
print("\navaliando dados de treinamento")
model.evaluate(x_train, y_train, verbose=2)

# avaliando os dados de teste
print("\navaliando os dados de teste")
model.evaluate(x_test, y_test, verbose=2)

# prevendo a partir dos dados de teste
y_train_pred = np.argmax(model.predict(x_train), axis=-1)
y_test_pred = np.argmax(model.predict(x_test), axis=-1)

# usando a minha classe de validação que mostra a matriz de confusão
score_train = Scores(y_train, y_train_pred)
score_train.exibir_grafico("Dados de treino")

score_test = Scores(y_test, y_test_pred)
score_test.exibir_grafico("Dados de teste")

Beispiel #30
0
        if arg.graph_generation == "guyondata":
            G = Datasets.get_guyon_graph(ctr + 1)
        else:
            G = Datasets.get_scale_free_graph_edge(arg.network_size,
                                                   initial_module, nb_modules,
                                                   arg.module_size, arg.prob_p,
                                                   arg.prob_q,
                                                   arg.removed_edges, rng)

        rate_conection = len(G.edges) / len(G.nodes)

        average_shortest_paths = []
        for _, cluster in Datasets.get_groups(G).items():
            nodes = list(cluster)
            average_shortest_paths.append(
                Scores.average_shortest_path(G, nodes))
        result = str(ctr) + "," + str(arg.network_size) + "," + str(
            arg.module_size) + "," + str(rate_conection) + "," + str(
                average_shortest_paths[0])
        # save the network and the simulation transcripts in the file
        network_path, weight_path = write_network_edge_list(
            G, arg.outfile, "sim" + str(ctr + 1))
        truehits = Datasets.get_groups(G)
        th = set([j for i in truehits.values() for j in i])

        # geting the result of others tools (verify set_variables.json file)
        if 'bionet' in data['tools']:
            print("\nExecuting Bionet\n")
            bionet_output, time = Scores.bionet_result(
                network_path, weight_path, str(data['bionet_fdrs']),
                arg.outfile)
Beispiel #31
0
class Game(Tab):
    """Tab class that represents logic of a game"""
    def __init__(self, wrapper):
        super(Game, self).__init__(wrapper)
        self.type_scores = {'s': 10, 'e': 50}
        self.field = Field('1_lvl.txt')
        self.units = Units(self)
        self.scores = Scores(position=Vector(
            10,
            self.field.get_size().to_abs().y + 5),
                             level=1)

    def set_hs(self, hs):
        # type: (int) -> None
        """Set highscore and write it to file"""
        pass

    def start(self):
        Input.reset()
        self.field = Field(str(self.scores.level) + '_lvl.txt')
        self.units.add_pacman(self.field.get_pacman_spawn())
        self.units.add_ghosts(self.field.get_ghosts_spawn())
        Music.play('bg', .1)

    def pacman_die(self):
        if self.scores.lives >= 1:
            self.scores.lives -= 1
            if self.scores.lives:
                Music.play('go')
                self.units.reset()
                Input.reset()
            else:
                self.game_over()

    def add_score(self, value):
        # type: (int) -> int
        return self.scores.add_score(value)

    def next_level(self):
        # type: () -> None
        """Switch to next level"""
        self.scores.level += 1
        Input.reset()
        self.field = Field(str(self.scores.level) + '_lvl.txt')
        self.units.add_pacman(self.field.get_pacman_spawn())
        self.units.add_ghosts(self.field.get_ghosts_spawn())
        Music.play('bg', .1)

    def get_size(self):
        # type: () -> Vector
        """Return size vector of tab"""
        return Vector(
            self.field.get_size().to_abs().x,
            self.field.get_size().to_abs().y + self.scores.get_size().y)

    def update(self):
        # type: () -> None
        """Update the objects"""
        if self.field.seed_count <= 0:  # все зерна съедены
            self.next_level()
        else:
            if self.scores.score:
                if self.field.get_door_status() == 1:
                    self.field.get_cell(self.field.door).set_type('0')
                for g in (self.units.blinky, self.units.pinky,
                          self.units.clyde):
                    if not g.get_mode():
                        g.set_mode(1)
                if not self.units.inky.get_mode(
                ) and self.scores >= 30 * self.type_scores.get('s'):
                    self.units.inky.set_mode(1)
            self.units.pacman.set_buffer_direction(Input.key_direction)
            self.units.move()

    def game_over(self):
        Music.stop('bg')
        Music.play('go')
        self.wrapper.set_current_tab('mainmenu')
        self.wrapper.add_tab('game', Game(self.wrapper))

    def draw(self):
        # type: () -> None
        """Draw all objects"""
        self.field.draw()
        self.units.draw()
        self.scores.draw()
def train(env, hparams):
    # randomness (https://pytorch.org/docs/stable/notes/randomness.html)

    random_seed = hparams['seed']
    torch.manual_seed(random_seed)
    torch.cuda.manual_seed(random_seed)
    torch.cuda.manual_seed_all(random_seed)
    torch.backends.cudnn.deterministic = True
    torch.backends.cudnn.benchmark = False
    np.random.seed(random_seed)
    random.seed(random_seed)



    # get the default brain
    brain_name = env.brain_names[0]
    brain = env.brains[brain_name]

    scores_hparams = hparams['scores']
    scores = Scores( scores_hparams['expectation'],size=scores_hparams['window_size'], check_solved=scores_hparams['check_solved']) 

    env_info = env.reset(train_mode=True)[brain_name]     # reset the environment    
    # number of agents
    num_agents = len(env_info.agents)

    # size of each action
    action_size = brain.vector_action_space_size
    states = env_info.vector_observations                  # get the current state (for each agent)
    state_size = states.shape[1]

    
    agents = []
    for _ in range(num_agents):
        agents.append( Agent(state_size, action_size, hparams))
    
    prefix = f'result/{hparams["output"]}'

    for i in range(hparams['epoch']):
        env_info = env.reset(train_mode=True)[brain_name]     # reset the environment    
        # number of agents
        num_agents = len(env_info.agents)
        
        for agent in agents:
            agent.reset()
    
        # size of each action
        action_size = brain.vector_action_space_size
        states = env_info.vector_observations                  # get the current state (for each agent)

        # initialize the score (for each agent)
        epoch_score = np.zeros(num_agents)
        for t in range(1, hparams['t_max']+1):
            actions = np.array( [agents[i].act(states[i]) for i in range(num_agents) ])
            env_info = env.step(actions)[brain_name]           # send all actions to tne environment
            next_states = env_info.vector_observations         # get next state (for each agent)
            dones = env_info.local_done                        # see if episode finished
    
            for i in range(num_agents):
                agents[i].step(t, states[i], actions[i], env_info.rewards[i], next_states[i], dones[i]) 

            states = next_states
            epoch_score += env_info.rewards
            #print('\rTimestep {}\tmin: {:.2f}\tmax: {:.2f}' .format(t, np.min(epoch_score), np.max(epoch_score)), end='') 

            if np.any(dones):
                break
        if scores.AddScore(np.max(epoch_score)) is True:
            break

    for i in range(len(agents)):
        agents[i].save( f'{prefix}_agent_{i}' )
        
    scores.FlushLog(prefix, False)
Beispiel #33
0
                if "queued" in stats:
                    queued = stats["queued"]
                started = []
                if "started" in stats:
                    started = stats["started"]
                if not (queued + started):
                    jobs_done = True
                else:
                    print(sys.stderr,\
                          len(started), "started", len(queued), "queued")
                    sleep(10)
                if "error" in stats and stats["error"]:
                    print(sys.stderr, "Errors occurred", stats["error"])
                    sys.exit(1)

            finalScores = Scores()
            print(len(testPoints))
            for job in ssn:
                res, scores = job.results
                print(res)
                finalScores += scores
            classifier.scores = finalScores
        else:
            sys.exit(0)

    else:
        print(sys.stderr, "labeling...")
        classifier.label()

    print(sys.stderr, "test classifier performance")
    print(sys.stderr, classifier.scores)
Beispiel #34
0
from scores import Scores

scores = Scores(debug=True)
games = scores.get_games(only_major_games=True)
# games = scores.get_games()
# games = scores.get_games(include_cancelled=True, include_postponed=True)
# games = scores.get_games(include_cancelled=True, include_postponed=True, only_major_games=True)

print(len(games))

# games[0].jsonprint()

# scores.download_assets(games[0]).jsonprint()