diff --git a/build/lib/mazeforge/__init__.py b/build/lib/mazeforge/__init__.py deleted file mode 100644 index 696eaaa..0000000 --- a/build/lib/mazeforge/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -""" - MazeForge - ========= - - Provides - 1. Generation of mazes - 2. Solving of mazes - 3. Visualisation of mazes - - Contact - - oskar.meyenburg@gmail.com - - More information - - https://pypi.org/project/mazeforge/ - - https://github.com/oskarmeyenburg/mazeforge -""" -#from .generator import generate -#from .core.loader import mazeforge_util -from .maze import generate - -__version__ = "0.1.1" -__all__ = ['generate'] diff --git a/build/lib/mazeforge/base.py b/build/lib/mazeforge/base.py deleted file mode 100644 index 9aa8cbe..0000000 --- a/build/lib/mazeforge/base.py +++ /dev/null @@ -1,16 +0,0 @@ -import numpy - - -class Maze(numpy.ndarray): - def __new__(cls, width, height): - # Create a new array with the specified dimensions and fill value - maze_array = numpy.full((height, width), 0, dtype=numpy.int_) - obj = maze_array.view(cls) - return obj - - @classmethod - def from_array(cls, array): - """ - Create a new Maze instance from an existing NumPy array - """ - return array.view(cls) \ No newline at end of file diff --git a/build/lib/mazeforge/core/loader.py b/build/lib/mazeforge/core/loader.py deleted file mode 100644 index 6b3bbf7..0000000 --- a/build/lib/mazeforge/core/loader.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- -import platform -import ctypes -import os - - -SHARED_OBJECT_FOLDER = "platform" -SHARED_OBJECT_NAME = "libmaze" - - -def load_library(): - system = platform.system() - machine = platform.machine() - - library_path = None - cwd = os.path.dirname(os.path.abspath(__file__)) - - if system == "Linux": - if "x86_64" in machine: - library_path = SHARED_OBJECT_FOLDER + "/linux/x86_64/" + SHARED_OBJECT_NAME + ".so" - elif "i686" in machine: - library_path = SHARED_OBJECT_FOLDER + "/linux/i686/" + SHARED_OBJECT_NAME + ".so" - elif "arm" in machine: - library_path = SHARED_OBJECT_FOLDER + "/linux/arm/" + SHARED_OBJECT_NAME + ".so" - elif "aarch64" in machine: - library_path = SHARED_OBJECT_FOLDER + "/linux/aarch64/" + SHARED_OBJECT_NAME + ".so" - elif system == "Darwin": - if "x86_64" in machine: - library_path = SHARED_OBJECT_FOLDER + "/macos/x86_64/" + SHARED_OBJECT_NAME + ".dylib" - else: - library_path = SHARED_OBJECT_FOLDER + "/macos/arm/" + SHARED_OBJECT_NAME + ".dylib" - elif system == "Windows": - if "AMD64" in machine or "x86_64" in machine: - library_path = SHARED_OBJECT_FOLDER + "/windows/x86_64/" + SHARED_OBJECT_NAME + ".dll" - else: - library_path = SHARED_OBJECT_FOLDER + "/windows/i686/" + SHARED_OBJECT_NAME + ".dll" - - if library_path: - try: - return ctypes.CDLL(os.path.join(cwd, library_path)) - except Exception as e: - raise RuntimeError("Error loading library at {}: {}".format(library_path, e)) - else: - raise RuntimeError("Unsupported platform: {} {}".format(system, machine)) - - -def configure_library(lib): - lib.c_print.argtypes = [] - lib.c_print.restype = None - - -generator = load_library() -generator.init.argtypes = [] -generator.init.restype = None -generator.init() -generator.test.argtypes = [] -generator.test.restype = None - -# print_maze -generator.print_maze.argtypes = [ - ctypes.POINTER(ctypes.c_uint8), - ctypes.c_int, - ctypes.c_int -] -generator.print_maze.restype = None -print_maze = lambda array, width, height: generator.print_maze( - (ctypes.c_uint8 * (width * height))(*array), - width, - height -) - -# generate_maze -generator.generate_maze.argtypes = [ - ctypes.POINTER(ctypes.c_uint8), - ctypes.c_int, - ctypes.c_int -] -generator.generate_maze.restype = None -generate_maze = lambda array, width, height: generator.generate_maze( - (ctypes.c_uint8 * (width * height))(*array), - width, - height -) - diff --git a/build/lib/mazeforge/core/platform/linux/aarch64/libmaze.so b/build/lib/mazeforge/core/platform/linux/aarch64/libmaze.so deleted file mode 100755 index ede67ea..0000000 Binary files a/build/lib/mazeforge/core/platform/linux/aarch64/libmaze.so and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/linux/arm/libmaze.so b/build/lib/mazeforge/core/platform/linux/arm/libmaze.so deleted file mode 100755 index 0342d6b..0000000 Binary files a/build/lib/mazeforge/core/platform/linux/arm/libmaze.so and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/linux/i686/libmaze.so b/build/lib/mazeforge/core/platform/linux/i686/libmaze.so deleted file mode 100755 index 5333a62..0000000 Binary files a/build/lib/mazeforge/core/platform/linux/i686/libmaze.so and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/linux/x86_64/libmaze.so b/build/lib/mazeforge/core/platform/linux/x86_64/libmaze.so deleted file mode 100755 index 33d2fba..0000000 Binary files a/build/lib/mazeforge/core/platform/linux/x86_64/libmaze.so and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/macos/arm/libmaze.dylib b/build/lib/mazeforge/core/platform/macos/arm/libmaze.dylib deleted file mode 100755 index 0258b35..0000000 Binary files a/build/lib/mazeforge/core/platform/macos/arm/libmaze.dylib and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/macos/x86_64/libmaze.dylib b/build/lib/mazeforge/core/platform/macos/x86_64/libmaze.dylib deleted file mode 100755 index f35a293..0000000 Binary files a/build/lib/mazeforge/core/platform/macos/x86_64/libmaze.dylib and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/windows/i686/libmaze.dll b/build/lib/mazeforge/core/platform/windows/i686/libmaze.dll deleted file mode 100755 index 805f5a1..0000000 Binary files a/build/lib/mazeforge/core/platform/windows/i686/libmaze.dll and /dev/null differ diff --git a/build/lib/mazeforge/core/platform/windows/x86_64/libmaze.dll b/build/lib/mazeforge/core/platform/windows/x86_64/libmaze.dll deleted file mode 100755 index 4feabce..0000000 Binary files a/build/lib/mazeforge/core/platform/windows/x86_64/libmaze.dll and /dev/null differ diff --git a/build/lib/mazeforge/generator.py b/build/lib/mazeforge/generator.py deleted file mode 100644 index 524e2da..0000000 --- a/build/lib/mazeforge/generator.py +++ /dev/null @@ -1,54 +0,0 @@ -import random -import numpy - -def generate(width, height): - """ - Generate a 2d maze on a grid. - - Parameters - ---------- - width : int - Number of columns in the maze. - height : int - Number of rows in the maze. - - Returns - ------- - numpy.ndarray - Maze as a numpy.ndarray with the shape (2 * width + 1, 2 * height + 1) - """ - # Prim's algorithm - array_width = width * 2 + 1 - array_height = height * 2 + 1 - maze = numpy.ones((array_width, array_height), dtype=numpy.int_) - - for x, y in numpy.ndindex((array_width, array_height)): - if 1 == x % 2 == y % 2: - maze[x, y] = 0 - - def get_neighbours(x, y): - neighbours = {(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)} - for neighbour in tuple(neighbours): - if not (0 <= neighbour[0] < width and 0 <= neighbour[1] < height): - neighbours.discard(neighbour) - return neighbours - - existing_cells = {(width // 2, height // 2)} - adjacent_cells = get_neighbours(*list(existing_cells)[0]) - - while len(adjacent_cells): - new_cell = random.choice(tuple(adjacent_cells)) - neighbours = get_neighbours(*new_cell) - existing_neigbours = neighbours.intersection(existing_cells) - new_neighbours = neighbours.difference(existing_cells) - - connection = random.choice(tuple(existing_neigbours)) - existing_cells.add(new_cell) - adjacent_cells |= new_neighbours - adjacent_cells.discard(new_cell) - - x = (new_cell[0] * 2 + 1 + connection[0] * 2 + 1) // 2 - y = (new_cell[1] * 2 + 1 + connection[1] * 2 + 1) // 2 - maze[x, y] = 0 - - return maze \ No newline at end of file diff --git a/build/lib/mazeforge/lib.py b/build/lib/mazeforge/lib.py deleted file mode 100644 index 99da7a8..0000000 --- a/build/lib/mazeforge/lib.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- -import platform -import ctypes -import os - - -def load_library(): - system = platform.system() - machine = platform.machine() - - library_path = None - cwd = os.path.dirname(os.path.abspath(__file__)) - - if system == "Linux": - if "x86_64" in machine: - library_path = "lib/linux/x86_64/libmazeforgeutil.so" - elif "i686" in machine: - library_path = "lib/linux/i686/libmazeforgeutil.so" - elif "arm" in machine: - library_path = "lib/linux/arm/libmazeforgeutil.so" - elif "aarch64" in machine: - library_path = "lib/linux/aarch64/libmazeforgeutil.so" - elif system == "Darwin": - if "x86_64" in machine: - library_path = "lib/macos/x86_64/libmazeforgeutil.dylib" - else: - library_path = "lib/macos/arm/libmazeforgeutil.dylib" - elif system == "Windows": - if "AMD64" in machine or "x86_64" in machine: - library_path = "lib/windows/x86_64/libmazeforgeutil.dll" - else: - library_path = "lib/windows/i686/libmazeforgeutil.dll" - - if library_path: - try: - return ctypes.CDLL(os.path.join(cwd, library_path)) - except Exception as e: - raise RuntimeError("Error loading library at {}: {}".format(library_path, e)) - else: - raise RuntimeError("Unsupported platform: {} {}".format(system, machine)) - - -def configure_library(lib): - lib.c_print.argtypes = [] - lib.c_print.restype = None - - -mazeforge_util = load_library() -configure_library(mazeforge_util) - - -""" -# Function prototypes -graphics.c_init.argtypes = [ctypes.c_int, ctypes.c_int] -graphics.c_init.restype = ctypes.c_int - -graphics.c_update.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)] -graphics.c_update.restype = ctypes.POINTER(ctypes.c_uint8) - -graphics.c_quit.argtypes = [] -graphics.c_quit.restype = None - -graphics.c_info_max_tex_size = [] -graphics.c_info_max_tex_size = ctypes.c_int - -graphics.c_load_shader.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_char_p), ctypes.c_int] -graphics.c_load_shader.restype = ctypes.c_int -graphics.load_shader = lambda vertex, fragment, **variables: graphics.c_load_shader( - vertex.encode("utf-8"), fragment.encode("utf-8"), - (ctypes.c_char_p * len(variables))(*map(lambda v: v.encode("utf-8"), variables.keys())), - (ctypes.c_char_p * len(variables))(*map(lambda v: v.encode("utf-8"), variables.values())), - len(variables)) - -graphics.c_update_shader_value.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_void_p] -graphics.c_update_shader_value.restype = None -def p_update_shader_value(shader, index, value): - if isinstance(value, int): - c_value = ctypes.c_int(value) - elif isinstance(value, float): - c_value = ctypes.c_float(value) - elif isinstance(value, (list, tuple)): - if isinstance(value[0], int): - c_value = (ctypes.c_int * len(value))(*value) - elif isinstance(value[0], float): - c_value = (ctypes.c_float * len(value))(*value) - else: - raise ValueError("Invalid value %r" % value) - graphics.c_update_shader_value(shader, index, ctypes.byref(c_value)) -graphics.update_shader_value = p_update_shader_value - -graphics.activate_shader.argtypes = [ctypes.c_int] -graphics.activate_shader.restype = None - -""" \ No newline at end of file diff --git a/build/lib/mazeforge/lib/linux/aarch64/libmazeforgeutil.so b/build/lib/mazeforge/lib/linux/aarch64/libmazeforgeutil.so deleted file mode 100755 index 32d57ee..0000000 Binary files a/build/lib/mazeforge/lib/linux/aarch64/libmazeforgeutil.so and /dev/null differ diff --git a/build/lib/mazeforge/lib/linux/arm/libmazeforgeutil.so b/build/lib/mazeforge/lib/linux/arm/libmazeforgeutil.so deleted file mode 100755 index 992df14..0000000 Binary files a/build/lib/mazeforge/lib/linux/arm/libmazeforgeutil.so and /dev/null differ diff --git a/build/lib/mazeforge/lib/linux/i686/libmazeforgeutil.so b/build/lib/mazeforge/lib/linux/i686/libmazeforgeutil.so deleted file mode 100755 index a9a30b9..0000000 Binary files a/build/lib/mazeforge/lib/linux/i686/libmazeforgeutil.so and /dev/null differ diff --git a/build/lib/mazeforge/lib/linux/x86_64/libmazeforgeutil.so b/build/lib/mazeforge/lib/linux/x86_64/libmazeforgeutil.so deleted file mode 100755 index e6386fa..0000000 Binary files a/build/lib/mazeforge/lib/linux/x86_64/libmazeforgeutil.so and /dev/null differ diff --git a/build/lib/mazeforge/lib/macos/arm/libmazeforgeutil.dylib b/build/lib/mazeforge/lib/macos/arm/libmazeforgeutil.dylib deleted file mode 100755 index a460537..0000000 Binary files a/build/lib/mazeforge/lib/macos/arm/libmazeforgeutil.dylib and /dev/null differ diff --git a/build/lib/mazeforge/lib/macos/x86_64/libmazeforgeutil.dylib b/build/lib/mazeforge/lib/macos/x86_64/libmazeforgeutil.dylib deleted file mode 100755 index 7480ed7..0000000 Binary files a/build/lib/mazeforge/lib/macos/x86_64/libmazeforgeutil.dylib and /dev/null differ diff --git a/build/lib/mazeforge/lib/windows/i686/libmazeforgeutil.dll b/build/lib/mazeforge/lib/windows/i686/libmazeforgeutil.dll deleted file mode 100755 index db8fccc..0000000 Binary files a/build/lib/mazeforge/lib/windows/i686/libmazeforgeutil.dll and /dev/null differ diff --git a/build/lib/mazeforge/lib/windows/x86_64/libmazeforgeutil.dll b/build/lib/mazeforge/lib/windows/x86_64/libmazeforgeutil.dll deleted file mode 100755 index 982078e..0000000 Binary files a/build/lib/mazeforge/lib/windows/x86_64/libmazeforgeutil.dll and /dev/null differ diff --git a/build/lib/mazeforge/maze.py b/build/lib/mazeforge/maze.py deleted file mode 100644 index 33d7dd7..0000000 --- a/build/lib/mazeforge/maze.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -from .core.loader import generator -import ctypes - -""" -class Maze: - def __init__(self, width, height): - self.array = [0] * width * height - self.width = width - self.height = height - - def print(self): - print_maze(self.array, self.width, self.height) - - def generate(self): - generate_maze(self.array, self.width, self.height) -""" - -def generate(width, height): - """ - Generate a 2d maze on a grid. - The maze is printed into the console. This will change in future versions. - - Parameters - ---------- - width : int - Number of columns in the maze. - height : int - Number of rows in the maze. - - Returns - ------- - list[int] - Internal list representation of the maze. - """ - array = [0] * width * height - array = (ctypes.c_uint8 * (width * height))(*array) - generator.generate_maze(array, width, height) - #return [array[i * width + j] for i in range(height) for j in range(width)] \ No newline at end of file diff --git a/build/lib/mazeforge/test.py b/build/lib/mazeforge/test.py deleted file mode 100644 index 4a1da7e..0000000 --- a/build/lib/mazeforge/test.py +++ /dev/null @@ -1,4 +0,0 @@ -from lib import mazeforge_util - - -mazeforge_util.c_print() \ No newline at end of file diff --git a/dist/mazeforge-0.1.1-py3-none-any.whl b/dist/mazeforge-0.1.1-py3-none-any.whl deleted file mode 100644 index a90b4a5..0000000 Binary files a/dist/mazeforge-0.1.1-py3-none-any.whl and /dev/null differ diff --git a/dist/mazeforge-0.1.1.tar.gz b/dist/mazeforge-0.1.1.tar.gz deleted file mode 100644 index 8c7fd3d..0000000 Binary files a/dist/mazeforge-0.1.1.tar.gz and /dev/null differ diff --git a/src/mazeforge.egg-info/PKG-INFO b/src/mazeforge.egg-info/PKG-INFO index 9ba5ea5..e04a0bb 100644 --- a/src/mazeforge.egg-info/PKG-INFO +++ b/src/mazeforge.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: mazeforge -Version: 0.1.1 +Version: 0.1.2 Summary: Simple and fast generation of mazes Author-email: Oskar Meyenburg License: MIT License diff --git a/src/mazeforge/core/platform/windows/i686/libmaze.dll b/src/mazeforge/core/platform/windows/i686/libmaze.dll index 805f5a1..f7a1b31 100755 Binary files a/src/mazeforge/core/platform/windows/i686/libmaze.dll and b/src/mazeforge/core/platform/windows/i686/libmaze.dll differ diff --git a/src/mazeforge/core/platform/windows/x86_64/libmaze.dll b/src/mazeforge/core/platform/windows/x86_64/libmaze.dll index 4feabce..2a58bcd 100755 Binary files a/src/mazeforge/core/platform/windows/x86_64/libmaze.dll and b/src/mazeforge/core/platform/windows/x86_64/libmaze.dll differ diff --git a/src/mazeforge/core/scripts/generator.c b/src/mazeforge/core/scripts/generator.c index cb4519b..02a67de 100644 --- a/src/mazeforge/core/scripts/generator.c +++ b/src/mazeforge/core/scripts/generator.c @@ -136,6 +136,7 @@ void print_maze(int8_t *array, int width, int height) { } } + /* switch (value) { case 0: printf(" "); @@ -185,6 +186,56 @@ void print_maze(int8_t *array, int width, int height) { case 15: printf("┼─"); break; + }*/ + switch (value) { + case 0: + printf(" "); + break; + case 1: + printf("\u2576\u2500"); + break; + case 2: + printf("\u2577 "); + break; + case 3: + printf("\u250c\u2500"); + break; + case 4: + printf("\u2574 "); + break; + case 5: + printf("\u2500\u2500"); + break; + case 6: + printf("\u2510 "); + break; + case 7: + printf("\u252c\u2500"); + break; + case 8: + printf("\u2575 "); + break; + case 9: + printf("\u2514\u2500"); + break; + case 10: + printf("\u2502 "); + break; + case 11: + printf("\u251c\u2500"); + break; + case 12: + printf("\u2518 "); + break; + case 13: + printf("\u2534\u2500"); + break; + case 14: + printf("\u2524 "); + break; + case 15: + printf("\u253c\u2500"); + break; } } printf("\n");