Ejemplo n.º 1
0
def main():
    global DISPLAYSURF, FPSCLOCK, FPS
    pygame.init()
    FPSCLOCK = pygame.time.Clock()
    FPS = 15

    global XMARGIN, YMARGIN, BOXSIZE, FONTSIZE
    width, height = pygame.display.Info().current_w, pygame.display.Info(
    ).current_h

    windowHeight = int(0.8 * height)
    windowWidth = int(1.9 * windowHeight)

    XMARGIN = YMARGIN = int(windowHeight / 40)
    BOXSIZE = int((windowHeight - 2 * YMARGIN) / 36)
    FONTSIZE = int(0.8 * BOXSIZE)

    DISPLAYSURF = pygame.display.set_mode((windowWidth, windowHeight))
    pygame.display.set_caption('Map Maker')

    squareX = squareY = 0
    yMin, yMax = 0, 4
    xMin, xMax = 0, 4
    mouseX = mouseY = 0
    tileCoords = (36, 0)

    mapSquares = [x[2] for x in os.walk('mapSquares')][0]
    mapSquares.sort()

    # left, top = left_top_coords_of_box(0, 17, mapArea=False)
    # surf, prevRect = make_text('Prev', WHITE, BLACK, left, top, size=FONTSIZE)
    # DISPLAYSURF.blit(surf, prevRect)

    # left, top = left_top_coords_of_box(4, 17, mapArea=False)
    # surf, nextRect = make_text('Next', WHITE, BLACK, left, top, size=FONTSIZE)
    # DISPLAYSURF.blit(surf, nextRect)

    mapImages = []
    mapData = []

    for file in mapSquares:
        filename = 'mapSquares' + sep + file
        if 'main_map' in file:
            pass
        elif 'png' in file:
            mapImages.append(load_image(filename))
        elif 'pickle' in file:
            mapData.append(load_map_square(filename))

    # print(mapData)

    draw_mapSquares(mapImages)
    pygame.display.update()

    area = []

    global mapCoords
    mapCoords = []
    mainMap = []
    mainMapData = []
    for x in range(5):
        column1 = []
        column2 = []
        column3 = []
        for y in range(5):
            column1.append((x, y))
            column2.append(None)
            column3.append(None)
        mapCoords.append(column1)
        mainMap.append(column2)
        mainMapData.append(column3)

    mainMapImages = mainMap

    while True:
        DISPLAYSURF.fill(BLACK)

        # left, top = left_top_coords_of_box(2, 17, mapArea=False)
        # text = '%s/%i' % (str(tileSetNum+1).zfill(2), len(tileSets))
        # surf, rect = make_text(text, WHITE, BLACK, left, top, size=FONTSIZE)
        # DISPLAYSURF.blit(surf, rect)

        # left, top = left_top_coords_of_box(0, 17, mapArea=False)
        # surf, prevRect = make_text('Prev', WHITE, BLACK, left, top, size=FONTSIZE)
        # DISPLAYSURF.blit(surf, prevRect)

        # left, top = left_top_coords_of_box(4, 17, mapArea=False)
        # surf, nextRect = make_text('Next', WHITE, BLACK, left, top, size=FONTSIZE)
        # DISPLAYSURF.blit(surf, nextRect)

        left, top = left_top_coords_of_box(12, 34, mapArea=True)
        surf, saveRect = make_text('Save',
                                   WHITE,
                                   BLACK,
                                   left,
                                   top,
                                   size=FONTSIZE)
        DISPLAYSURF.blit(surf, saveRect)

        draw_map(mainMapImages)
        draw_mapSquares(mapImages)

        for event in pygame.event.get():
            keys = pygame.key.get_pressed()
            if not keys[K_LSHIFT]:
                xStart, xEnd = squareX, squareX + 1
                yStart, yEnd = squareY, squareY + 1

            if event.type == QUIT or (event.type == KEYUP
                                      and event.key == K_ESCAPE):
                quit()
            elif event.type == KEYDOWN:
                if event.key in [K_UP, K_w]:
                    if squareY != yMin:
                        squareY -= 1
                    else:
                        squareY = yMax
                    if keys[K_LSHIFT]:

                        yStart -= 1

                elif event.key in [K_LEFT, K_a]:
                    if squareX != xMin:
                        squareX -= 1
                    else:
                        squareX = xMax
                    if keys[K_LSHIFT]:
                        xStart -= 1

                elif event.key in [K_RIGHT, K_d]:
                    if squareX != xMax:
                        squareX += 1
                    else:
                        squareX = xMin
                    if keys[K_LSHIFT]:
                        xEnd += 1

                elif event.key in [K_DOWN, K_s]:
                    if squareY != yMax:
                        squareY += 1
                    else:
                        squareY = yMin
                    if keys[K_LSHIFT]:
                        yEnd += 1

                elif event.key == K_SPACE:
                    columns = mapCoords[xStart:xEnd]
                    area = [y[yStart:yEnd] for y in columns]
                    highlight_area(area)
                    mainMapData, mainMapImages, tileCoords = set_tiles(
                        mainMapData, mainMapImages, area, mapData, mapImages,
                        tileCoords)

            elif event.type == MOUSEBUTTONUP:
                mouseX, mouseY = event.pos

                if saveRect.collidepoint(mouseX, mouseY):
                    # print(mainMapData)
                    # print('\n\n')
                    # print(mainMapImages)
                    save(mainMapData)

                else:
                    pass

            else:
                continue

        columns = mapCoords[xStart:xEnd]
        area = [y[yStart:yEnd] for y in columns]
        highlight_area(area)
        FPSCLOCK.tick(FPS)
def main():
    global DISPLAYSURF, FPSCLOCK, FPS

    pygame.init()
    FPSCLOCK = pygame.time.Clock()
    FPS = 30

    global XMARGIN, YMARGIN, BOXSIZE

    width, height = pygame.display.Info().current_w, pygame.display.Info(
    ).current_h

    windowHeight = int(0.6 * height)
    windowWidth = int(1.5 * windowHeight)

    XMARGIN = YMARGIN = 0
    BOXSIZE = int((windowWidth / 15))

    DISPLAYSURF = pygame.display.set_mode((windowWidth, windowHeight))
    pygame.display.set_caption('Map Test')

    player = Player()

    playerSprite = pygame.sprite.Group()
    playerSprite.add(player)

    startX = player.get_position()[0] - 7
    endX = startX + 15

    startY = player.get_position()[1] - 5
    endY = startY + 11

    mainMap = load_map_square('main_map')
    mapSquare = mainMap.tiles
    mapImages = mainMap.new_screen_images_array(player, tileSize=BOXSIZE)

    global mapCoords
    mapCoords = []
    for x in range(len(mapSquare)):
        column = []
        for y in range(len(mapSquare)):
            column.append((x, y))
        mapCoords.append(column)

    count = 0
    maxCount = 4
    running = True
    lastKeys = None
    while running:
        # offsetX, offsetY = 0, 0
        change = False
        count += 1
        if count == maxCount:
            count = 0

        position = player.get_position()
        move = (0, 0)

        columns = mapCoords[startX:endX]
        displayArea = [y[startY:endY] for y in columns]

        keys = pygame.key.get_pressed()
        for event in pygame.event.get():
            if event.type == pygame.QUIT or (event.type == KEYUP
                                             and event.key == K_ESCAPE):
                running = False
            else:
                pass

            # elif event.type == KEYDOWN:
            # if event.key == K_UP:
            # 	move = (0, -1)

            # elif event.key == K_DOWN:
            # 	move = (0, 1)

            # elif event.key == K_LEFT:
            # 	move = (-1, 0)

            # elif event.key == K_RIGHT:
            # 	move = (1, 0)

            # else:
            # 	pass

        if keys[K_SPACE]:
            interact(mainMap, player)

        elif keys[K_UP] or keys[K_w]:
            move = (0, -1)
        elif keys[K_DOWN] or keys[K_s]:
            move = (0, 1)
        elif keys[K_LEFT] or keys[K_a]:
            move = (-1, 0)
        elif keys[K_RIGHT] or keys[K_d]:
            move = (1, 0)

        if move != (0, 0):

            if count == 0 and mainMap.passable(player, move):
                change = True
                offsetX = int(1 * BOXSIZE / 4) * move[0]
                offsetY = int(1 * BOXSIZE / 4) * move[1]

            elif count == 1 and mainMap.passable(player, move):
                change = True
                offsetX = int(2 * BOXSIZE / 4) * move[0]
                offsetY = int(2 * BOXSIZE / 4) * move[1]

            elif count == 2 and mainMap.passable(player, move):
                change = True
                offsetX = int(3 * BOXSIZE / 4) * move[0]
                offsetY = int(3 * BOXSIZE / 4) * move[1]

            elif count == 3 and mainMap.passable(player, move):
                change = True
                startX += move[0]
                endX += move[0]
                startY += move[1]
                endY += move[1]
                offsetX, offsetY = 0, 0

                player.update(move)

                mapImages = update_map(mainMap, mapImages, player, move)

            # elif count == 3:
            # 	change = True
            # 	player.turn(move)

        if change:
            draw_mapImages(mapImages, (offsetX, offsetY))
            # draw_map(mainMap, displayArea)

            playerSprite.draw(DISPLAYSURF)

            pygame.display.update()

        FPSCLOCK.tick(FPS)
Ejemplo n.º 3
0
    # saveSquare = MainMap(mapData)
    save_map_square(mapData, text)
    # mapImages = load_map(mapSquare, scaleImages=False)
    # surface = saveSquare.draw()
    # text = text.replace('.pickle', '.png')
    # savefile = 'mapSquares/' + text
    # pygame.image.save(surface, savefile)


pygame.init()
display = pygame.display.set_mode((1, 1))

mapSquares = [x[2] for x in os.walk('mapSquares')][0]
mapSquares.sort()

for file in mapSquares:
    if 'pickle' in file:
        mapData = load_map_square(file)

        for x in range(32):
            for y in range(32):
                tile = mapData.tiles[x][y]

                for i in range(1, 10):
                    oldString = 'tiles/%i_' % i
                    if oldString in tile.baseTile:
                        newString = 'tiles/0%i_' % i
                        tile.baseTile = tile.baseTile.replace(
                            oldString, newString)

        save(mapData, file)
Ejemplo n.º 4
0
def main():
    global DISPLAYSURF, FPSCLOCK, FPS

    pygame.init()
    FPSCLOCK = pygame.time.Clock()
    FPS = 60
    pygame.key.set_repeat(int(1000 / FPS))

    global XMARGIN, YMARGIN, BOXSIZE

    width, height = pygame.display.Info().current_w, pygame.display.Info(
    ).current_h

    maxHeight = int(0.8 * height)
    maxWidth = int(1.5 * maxHeight)

    XMARGIN = YMARGIN = 0
    BOXSIZE = 16
    maxBoxSize = int((maxWidth / 15))
    for scale in range(2, 5):
        if BOXSIZE * scale > maxBoxSize:
            break
    scale -= 1
    scale = 3
    BOXSIZE *= scale

    windowWidth = 15 * BOXSIZE
    windowHeight = 10 * BOXSIZE

    DISPLAYSURF = pygame.display.set_mode((windowWidth, windowHeight))
    pygame.display.set_caption('Map Test')
    DISPLAYSURF.set_colorkey((255, 0, 255))

    mixer = Mixer()

    player = Player(scale,
                    party=[
                        get_pokemon(132, level=50),
                        random_pokemon(level=50),
                        random_pokemon(level=50)
                    ])
    # player = Player()

    playerSprite = pygame.sprite.Group()
    playerSprite.add(player)

    startX = player.get_position()[0] - 7
    endX = startX + 15

    startY = player.get_position()[1] - 5
    endY = startY + 11

    mainMap = load_map_square('main_map_full_test')
    mapSquare = mainMap.tiles
    mapImages, mapDecorations = mainMap.new_screen_images_array(
        player, tileSize=BOXSIZE)

    mixer.play_song(mainMap.tiles[player.x][player.y].group)

    global mapCoords
    mapCoords = []
    for x in range(len(mapSquare)):
        column = []
        for y in range(len(mapSquare)):
            column.append((x, y))
        mapCoords.append(column)

    count = 0
    maxCount = 4
    running = True
    lastKeys = None
    change = True
    while running:
        offsetX, offsetY = 0, 0

        count += 1
        if count == maxCount:
            count = 0

        position = player.get_position()
        move = (0, 0)

        columns = mapCoords[startX:endX]
        displayArea = [y[startY:endY] for y in columns]

        for event in pygame.event.get():
            if event.type == pygame.QUIT or (event.type == KEYUP
                                             and event.key == K_ESCAPE):
                running = False

            elif event.type == KEYDOWN:
                if event.key == K_SPACE:
                    interact(mainMap, player)
                elif event.key in [K_UP, K_w]:
                    move = (0, -1)

                elif event.key in [K_DOWN, K_s]:
                    move = (0, 1)

                elif event.key in [K_LEFT, K_a]:
                    move = (-1, 0)

                elif event.key in [K_RIGHT, K_d]:
                    move = (1, 0)

            elif event.type == KEYUP:
                if event.key == K_x:
                    player.toggle_run()

                elif event.key == K_b:
                    player.toggle_bike()
                    change = True

                elif event.key == K_v and mainMap.surfable(player):
                    player.toggle_surf()
                    move = player.facing
                    change = True

                else:
                    pass

        if move != (0, 0):
            if mainMap.passable(player, move):
                change = True
                player.update(move)
                do_move(mapImages, playerSprite, mapDecorations, player, move)
                mapImages, mapDecorations = update_map(mainMap, mapImages,
                                                       mapDecorations, player,
                                                       move)
            elif mainMap.jumpable(player, move):
                change = True
                move = tuple_add(move, move)
                player.update(move)
                do_jump(mapImages, playerSprite, mapDecorations, player, move)
                mapImages, mapDecorations = update_map(mainMap, mapImages,
                                                       mapDecorations, player,
                                                       move)
            else:
                change = True
                player.turn(move)

            if mainMap.encounter_tile(player):
                # print('encounter')
                encounterPokemon = random_pokemon(level=50)
                WildBattle(DISPLAYSURF, mixer, player, encounterPokemon)
                # DISPLAYSURF.set_mode((windowWidth, windowHeight))

        # keys = pygame.key.get_pressed()
        # if keys[K_SPACE]:
        # 	interact(mainMap, player)

        # elif keys[K_UP] or keys[K_w]:
        # 	move = (0, -1)
        # elif keys[K_DOWN] or keys[K_s]:
        # 	move = (0, 1)
        # elif keys[K_LEFT] or keys[K_a]:
        # 	move = (-1, 0)
        # elif keys[K_RIGHT] or keys[K_d]:
        # 	move = (1, 0)

        # if move != (0, 0):

        # 	if count == 0 and mainMap.passable(player, move):
        # 		change = True
        # 		offsetX = int(1*BOXSIZE/4) * move[0]
        # 		offsetY = int(1*BOXSIZE/4) * move[1]

        # 	elif count == 1 and mainMap.passable(player, move):
        # 		change = True
        # 		offsetX = int(2*BOXSIZE/4) * move[0]
        # 		offsetY = int(2*BOXSIZE/4) * move[1]

        # 	elif count == 2 and mainMap.passable(player, move):
        # 		change = True
        # 		offsetX = int(3*BOXSIZE/4) * move[0]
        # 		offsetY = int(3*BOXSIZE/4) * move[1]

        # 	elif count == 3 and mainMap.passable(player, move):
        # 		change = True
        # 		startX += move[0]
        # 		endX += move[0]
        # 		startY += move[1]
        # 		endY += move[1]
        # 		offsetX, offsetY = 0, 0

        # 		player.update(move)

        # 		mapImages = update_map(mainMap, mapImages, player, move)

        # 	elif count == 3:
        # 		change = True
        # 		player.turn(move)

        if change:
            offsetX, offsetY = 0, 0

            draw_screen(mapImages, playerSprite, mapDecorations,
                        (offsetX, offsetY))

            pygame.display.update()
            change = False

            # print(mainMap.tiles[player.x][player.y].group)
            if player.isBiking:
                mixer.play_song('Cycling')
            elif player.isSurfing:
                mixer.play_song('Surfing')
            else:
                mixer.play_song(mainMap.tiles[player.x][player.y].group)

        FPSCLOCK.tick(FPS)
Ejemplo n.º 5
0
def main():
    global DISPLAYSURF, FPSCLOCK, FPS
    pygame.init()
    FPSCLOCK = pygame.time.Clock()
    FPS = 15

    global XMARGIN, YMARGIN, BOXSIZE, FONTSIZE
    width, height = pygame.display.Info().current_w, pygame.display.Info(
    ).current_h

    windowHeight = int(0.8 * height)
    windowWidth = int(1.9 * windowHeight)

    XMARGIN = YMARGIN = int(windowHeight / 40)
    BOXSIZE = int((windowHeight - 2 * YMARGIN) / 36)
    FONTSIZE = int(0.8 * BOXSIZE)

    DISPLAYSURF = pygame.display.set_mode((windowWidth, windowHeight))
    pygame.display.set_caption('Map Square Maker')

    global setParams
    setParams = {}
    setParams['isWalkable'] = True
    setParams['isRunnable'] = True
    setParams['isBikeable'] = True
    setParams['isSurfable'] = False
    draw_set_params()

    squareX = squareY = 0
    yMin, yMax = 0, 31
    xMin, xMax = 0, 31
    mouseX = mouseY = 0
    tileCoords = (36, 0)
    xStart, xEnd = squareX, squareX + 1
    yStart, yEnd = squareY, squareY + 1

    tileSets = [x[1] for x in os.walk('tiles')][0]
    tileSets.sort()
    tileSetNum = 0
    tileSetFolder = tileSets[tileSetNum]

    left, top = left_top_coords_of_box(0, 17, mapArea=False)
    surf, prevRect = make_text('Prev', WHITE, BLACK, left, top, size=FONTSIZE)
    DISPLAYSURF.blit(surf, prevRect)

    left, top = left_top_coords_of_box(4, 17, mapArea=False)
    surf, nextRect = make_text('Next', WHITE, BLACK, left, top, size=FONTSIZE)
    DISPLAYSURF.blit(surf, nextRect)

    try:
        mapSquare = load_map_square(sys.argv[1]).tiles
    except:
        mapSquare = fill_map(tileSetFolder, tileCoords)[0]

    mapImages = load_map(mapSquare)

    draw_map(mapImages)

    area = []

    global mapCoords
    mapCoords = []
    for x in range(len(mapSquare)):
        column = []
        for y in range(len(mapSquare)):
            column.append((x, y))
        mapCoords.append(column)

    while True:
        DISPLAYSURF.fill(BLACK)

        tileSetFolder = tileSets[tileSetNum]

        left, top = left_top_coords_of_box(2, 17, mapArea=False)
        text = '%s/%i' % (str(tileSetNum + 1).zfill(2), len(tileSets))
        surf, rect = make_text(text, WHITE, BLACK, left, top, size=FONTSIZE)
        DISPLAYSURF.blit(surf, rect)

        left, top = left_top_coords_of_box(0, 17, mapArea=False)
        surf, prevRect = make_text('Prev',
                                   WHITE,
                                   BLACK,
                                   left,
                                   top,
                                   size=FONTSIZE)
        DISPLAYSURF.blit(surf, prevRect)

        left, top = left_top_coords_of_box(4, 17, mapArea=False)
        surf, nextRect = make_text('Next',
                                   WHITE,
                                   BLACK,
                                   left,
                                   top,
                                   size=FONTSIZE)
        DISPLAYSURF.blit(surf, nextRect)

        left, top = left_top_coords_of_box(12, 34, mapArea=True)
        surf, saveRect = make_text('Save',
                                   WHITE,
                                   BLACK,
                                   left,
                                   top,
                                   size=FONTSIZE)
        DISPLAYSURF.blit(surf, saveRect)

        draw_map(mapImages)
        draw_tileSet(tileSetFolder)

        paramRects = draw_set_params()

        for event in pygame.event.get():
            keys = pygame.key.get_pressed()
            if not keys[K_LSHIFT]:
                xStart, xEnd = squareX, squareX + 1
                yStart, yEnd = squareY, squareY + 1

            if event.type == QUIT or (event.type == KEYUP
                                      and event.key == K_ESCAPE):
                quit()
            elif event.type == KEYDOWN:
                if event.key in [K_UP, K_w]:
                    if squareY != yMin:
                        squareY -= 1
                    else:
                        squareY = yMax
                    if keys[K_LSHIFT]:

                        yStart -= 1

                elif event.key in [K_LEFT, K_a]:
                    if squareX != xMin:
                        squareX -= 1
                    else:
                        squareX = xMax
                    if keys[K_LSHIFT]:
                        xStart -= 1

                elif event.key in [K_RIGHT, K_d]:
                    if squareX != xMax:
                        squareX += 1
                    else:
                        squareX = xMin
                    if keys[K_LSHIFT]:
                        xEnd += 1

                elif event.key in [K_DOWN, K_s]:
                    if squareY != yMax:
                        squareY += 1
                    else:
                        squareY = yMin
                    if keys[K_LSHIFT]:
                        yEnd += 1

                elif event.key == K_SPACE:
                    columns = mapCoords[xStart:xEnd]
                    area = [y[yStart:yEnd] for y in columns]
                    highlight_area(area)
                    mapSquare, tileCoords = set_tiles(mapSquare, area,
                                                      tileSetFolder,
                                                      tileCoords)
                    mapImages = load_map(mapSquare)

                elif event.key == K_b:
                    columns = mapCoords[xStart:xEnd]
                    area = [y[yStart:yEnd] for y in columns]
                    highlight_area(area)
                    mapSquare, tileCoords = set_decoration(
                        mapSquare, area, tileSetFolder, tileCoords)
                    mapImages = load_map(mapSquare)

                elif keys[K_LCTRL] and event.key == K_f:
                    mapArea, tileCoords = fill_map(tileSetFolder, tileCoords)
                    if mapArea != None:
                        mapSquare = mapArea
                        mapImages = load_map(mapSquare)

                elif keys[K_LCTRL] and event.key == K_e:
                    columns = mapCoords[xStart:xEnd]
                    area = [y[yStart:yEnd] for y in columns]
                    highlight_area(area)
                    edit_tile_params(mapSquare, area)

                elif keys[K_LCTRL] and event.key == K_r:
                    mapSquare[squareX][squareY].rotate()
                    mapImages[squareX][squareY] = mapSquare[squareX][
                        squareY].draw(BOXSIZE)

                elif keys[K_LCTRL] and event.key == K_h:
                    mapSquare[squareX][squareY].flip_horizontal()
                    mapImages[squareX][squareY] = mapSquare[squareX][
                        squareY].draw(BOXSIZE)

                elif keys[K_LCTRL] and event.key == K_v:
                    mapSquare[squareX][squareY].flip_vertical()
                    mapImages[squareX][squareY] = mapSquare[squareX][
                        squareY].draw(BOXSIZE)

            elif event.type == MOUSEBUTTONUP:
                mouseX, mouseY = event.pos
                tileCoords = (36, 0)
                if nextRect.collidepoint(mouseX, mouseY):
                    tileSetNum += 1
                    if tileSetNum == len(tileSets):
                        tileSetNum = 0

                elif prevRect.collidepoint(mouseX, mouseY):
                    tileSetNum -= 1
                    if tileSetNum < 0:
                        tileSetNum = len(tileSets) - 1

                elif saveRect.collidepoint(mouseX, mouseY):
                    save(mapSquare)

                else:
                    paramKeys = list(setParams.keys())
                    for i in range(len(setParams)):
                        if paramRects[i].collidepoint(mouseX, mouseY):
                            setParams[
                                paramKeys[i]] = not setParams[paramKeys[i]]

            else:
                continue
        columns = mapCoords[xStart:xEnd]
        area = [y[yStart:yEnd] for y in columns]
        draw_tile_params(mapSquare, area)
        highlight_area(area)
        FPSCLOCK.tick(FPS)
Ejemplo n.º 6
0
mapDimensions = (24, 16)

mapData = []

print('Compiling...')
for x in range(mapDimensions[0] + 2):
    column = []
    for y in range(mapDimensions[1] + 2):
        if (x == 0 or y == 0) or (x == mapDimensions[0] + 1
                                  or y == mapDimensions[1] + 1):
            mapName = 'none'
        else:
            mapName = '%i_%i' % (x, y)

        try:
            mapSquare = load_map_square(mapName)
        except:
            mapName = 'none'
            mapSquare = load_map_square(mapName)

        mapSquare.place_on_map_at(x, y)

        column.append(mapSquare)

    mapData.append(column)

print('Saving...')
text = 'main_map_full_test'
fullMap = MainMap(mapData)
save_map_square(fullMap, text)
Ejemplo n.º 7
0
from saveLoad import load_map_square
from sys import argv


def broken():
    print('Map not found or specified.')
    exit()


if len(argv) < 2:
    broken()

try:
    mm = load_map_square(argv[1])
    print(mm.tiles[0][0].group)

except:
    broken()