Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bigger Map, generated randomly, custom font for player characters. #69

Open
miron opened this issue Mar 2, 2023 · 0 comments
Open

Bigger Map, generated randomly, custom font for player characters. #69

miron opened this issue Mar 2, 2023 · 0 comments

Comments

@miron
Copy link
Owner

miron commented Mar 2, 2023

A random map generator

import random

def generate_map(width, height):
    maze = [["#" for x in range(width)] for y in range(height)]
    stack = [(1, 1)]
    while stack:
        x, y = stack.pop()
        maze[y][x] = "."
        directions = [(x-2, y), (x+2, y), (x, y-2), (x, y+2)]
        random.shuffle(directions)
        for new_x, new_y in directions:
            if 0 < new_x < width-1 and 0 < new_y < height-1 and maze[new_y][new_x] == "#":
                maze[new_y][new_x] = "."
                maze[(new_y+y)//2][(new_x+x)//2] = "."
                stack.append((new_x, new_y))
    for row in maze:
        print("".join(row))

generate_map(79, 24)

Custom font like https://www.fontspace.com/human-silhouettes-free-font-f17344
Or create own cyberpunk themed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant