miron / NeonCore

Terminal based Cyberpunk Tabletop RPG with Nostr as database and openAI API compatible commands
3 stars 1 forks source link

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

Open miron opened 1 year ago

miron commented 1 year ago

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.