Giter Club home page Giter Club logo

vga-maze's Introduction

vga-maze

A pseudorandom maze generator for MS-DOS written in 80x86 real mode assembly and featuring ground-breaking mode 13h VGA graphics.

This is a simple, recursive implementation of a randomized depth-first traversal algorithm of a connected graph here encoded as an array of maze cells for the purpose maze generation. The program provides a step-by-step visualization of the algorithm as it makes way through the walls of a square grid pattern and backtracks along the visited paths until the initial cell is reached.

Installation

An 80x86 assembler and MS-DOS machine with VGA graphics support are required to assemble and run the program, which lives in the single source file vgamaze.asm. NASM for DOSBox is a clean solution to emulate such an architecture.

Mount the folder with the assembler executables (make sure it includes nasm.exe and cwsdpmi.exe) on the emulator. To assemble and run the source file:

C:\> nasm vgamaze.asm -fbin -o vgamaze.com

C:\> vgamaze

Usage

Just watch as the algorithm walks the grid in a depth first, randomized fashion. You'll know the generation animation is complete once all the visited cells are filled with a solid color. Then, you can run the generator again by pressing R or exit the program with Q.

The parameters of the gerenator are hardcoded - for now - in the assembly code. The maze's dimensions are parametric to the cell size, which should divide both the screen's width and height (in mode 13h these are 320 and 200 pixels respectively). A maze cell comprises a square of pixels whose side is defined by the CELL_SIZE constant.

Shrink or enlarge the maze output by playing with the CELL_SIZE constant (beware of values less than 4 as they lead to stack overflow). Adjust the color constants to your liking using a subset of values drawn from the VGA standard palette.

Gallery

The generator in action.

Animation

Have fun adjusting the cell size and color palette to your liking.

vgamaze_006

tmp_045

tmp_047

Notes

vga-maze was realized in the context of a low-level computing course over at my Uni.

Further improvements to the code include:

  • assembly optimization
  • user menu offering customization options
  • an iterative implementation of the search

vga-maze's People

Contributors

dalps avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.