Skip to content

soulik/maze_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maze Generator

Simple maze generator for LuaJIT with Win32 console output.

General usage:

local mazeGenerator = require 'maze'
local maze = mazeGenerator {
	width = 50,
	height = 25,
	entry = {x = 2, y = 2},
	exit = {x = 30, y = 4},
	finishOnExit = false,
}

-- iterate over each step of maze generator so you can observe how it's created
for i=1,10000 do
	local result = maze.generate()
	if result == 1 then
		break
	end
end

-- access map cell with {x, y} table
local x,y = 1, 2
local cell = maze.map[{x, y}]

-- unvisited cells return false
local cellType = (type(cell)=='table' and cell.type) or 0

Tests:

Run a test with (Win32 environment only due console handler):

luajit tests/test.lua

Screenshots:

alt text

About

Simple maze generator for LuaJIT with Win32 console output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages