Giter VIP home page Giter VIP logo

2018-06-generatemaze's Introduction

Maze

For this challange we will be creating, viewing and solving mazes.

Binary map format:

   // 00 01 02 03  04 05 06 07 
      01                       // byte order marker      -- 1 byte       : little endian
                               //    0 for big endian 
                               //    1 for little endian 

      5D 90                    // magic                   -- 2 bytes     : 5D 90
      01                       // version                 -- 1 byte      : 1

      10 10                    // map size width x height -- 2 bytes     : 16,16 

      20 00                    // map data length(16 bit) -- 2 byte      : 32
      FF FF 80 0D  B7 51 B5 65 // map data (MSb first, packed)
      E5 0D DC B1  98 55 A3 D3 //    a bit set to 1 represents a wall
      87 59 B1 4D  94 55 D3 95 //    a bit set to 0 represents a path
      88 11 B7 ED  80 01 FF FF //    note: one can not travel diagonally

      01 01                    // start x,y position      -- 2 bytes     : 1,1

      02                       // items length            -- 1 byte      : 2 items
                               //    item type value:
                               //       00 required goal  -- 2 bytes
                               //       01 optional goal  -- 2 bytes
                               //       02 warp           -- 4 bytes

                               // item 0
      00                       // required goal           -- 2 bytes     : required goal 
      08 08                    //    x,y position on the map             : 8,8

                               // item 1
      02                       // warp                    -- 4 bytes     : warp 
      0C 0A                    //    x,y position on the map             : 12,10
      01 01                    //    x,y warp destination                : 1,1

Challenge 0: Reader

  1. Create a reader for the above map format

Challenge 1: Visulization

  1. Write a program that given a map file, visualize it to the screen.
  2. validate the map file with the following rules:
    1. Map data length is properly computed
    2. Ensure there is a start
    3. Ensure there is at least one required goal
    4. Ensure no elements overlap.
  3. Map:
    • X -- Start position
    • G -- Goal
    • W -- Warp
    ████████████████
    █X           █ █
    █ ██ ███ █ █   █
    █ ██ █ █ ██  █ █
    ██   █ █    ██ █
    ██ ███  █ ██   █
    █ █   ████ █  ██
    █    ███G█ ██  █
    █ ██   █ █  ██ █
    █  █ █   █ █W█ █
    ██ █  ███  █ █ █
    █   █      █   █
    █ ██ ██████ ██ █
    █              █
    ████████████████
    

Bonus

  • Render the map to an image.

Challenge 2: Maze Generation

  • Modify the above program to generate a random maze.
  • Modify the above program to report if the maze is invalid.

Challenge 3: Maze Solver

  • Return the solution of the given map as a set of instructions.
  • Create an animated gif showing the how to solve the map

Challenge 4: Maze Validation

  • In addition to the above validation, make sure there is a solution (a first don't worry about maps with warps).
  • Make sure there is only one solution to a map.
  • Be able to deal with maps with Warps.

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.