GithubHelp home page GithubHelp logo

holmies's Introduction

holmies

mazeSolver project

personnel

Camilla Cheng & Lisa Ye


Maze Solver

Statement of problem

What is the boolean value of the statement "it is possible to make a path from explorer's current position to treasure"?

Recursive abstraction

When I'm asked
    if it is possible to find a path to the treasure,
the recursive abtraction can say
    if it is possible to find a path to the treasure from a point next to the the explorer's current location

Base case

  • When explorer is on treasure, return true
  • When explorer is on a wall, return false

Pseudocode of algorithm

if (explorer is on treasure)
    return true;
if (explorer is on wall)
    return false;
else {
    take a snapshot of maze; // saves image of maze before the explorer moves to a new spot
    for ( each spot in all four directions [N,E,S,W] next to the current position ) {
        drop a wall on current location;
        move explorer to the new spot (in the direction mentioned in the for loop);
        if ( [RECURSIVE ABSTRACTION: repeat the problem starting with that new spot] ) {
            return true;
        }
        else {
            set current maze to snapshot; // reset the image of the maze to before the explorer moved
        }
    }
    return false;
}

Class(es), with fields and methods

Maze

Fields

  • int[][] maze
  • representation of treasure
  • representation of wall
  • representation of stepping stone
  • rep of directions [N,E,S,W]

Methods

  • public Maze
  • public go(direction)
  • public explorerIsOnA(location)
  • public toString

UserOfMaze

Fields

  • Maze m

Methods

  • public static void main(String[] args)

Known Bugs/Issues

  • nullPointer error when testing on big maze(1 rank, 3 files)
  • Snapshot is being replaced on every recursive call
  • Need to change parameter in for loop

Version n

  • Find and return all of the solutions of the maze
  • Find the shortest solution to the maze
  • Build a nice visual of the maze

holmies's People

Contributors

lisaye1221 avatar camillac avatar

Watchers

James Cloos avatar  avatar

holmies's Issues

hw95 README issues

Solid work! The solution looks mostly correct.
As Holmes mentioned make sure to take snapshots and use them when backtracking. One nit-picky thing is that saying "for every spot next to location" is a little vague since it can be any spot, not just a single step north, east, south, or west.

"big"

Mere personal reaction: I am a giant fan of the use of "big" in your README to refer to a maze that has three (3) cells.

Also, I liked the strikethrough in the "Bugs" section

issues from spot-checks

Don't panic!

Your project has a new issue opened for it because I used your team's work to spot-check progress for the class. Having observed a potential improvement, it seemed worth passing it along directly to you, in addition to considering presenting it in class, anonymously.

meaning of "start"

statement of problem

Your use of "the start" is unclear to me, so it may be unclear to you also.

If it means something like

the explorer's location at the beginning of a particular execution of the recursive procedure

then your thinking looks good. It would help communication to make that thinking clear in the English.

On the other hand, if "the start" means something like

the root call for this problem

then your "statement of problem" fails to apply to the recursive abstraction. You will want to correct that.

You used "the start" in your recursive abstraction also (as one would expect), so make sure the meaning there is also clear, and consistent with the meaning here.

NTTSTT?

Your pseudo code is on the right track. But "if (new spot is not a WALL)" seems redundant with the base case check.

snapshot-restore

Since I'm looking at your pseudocode anyway:

I see where you drop a wall appropriately. But I'm also expecting some kind of snapshot-restore pair to get rid of that wall. It will likely take a bit of hard thinking to decideout where to put the snapshot and the restore.

Lot of people will have the challenge of that thinking, so lots of people will be helped by a Piazza post, if that sounds appropriate.

hw93 feedback

Please proofread your work. That is your job, not my job.

statement of problem

"expression" makes little sense. You probably mean "value".

recursive abstraction

"When I'm asked to if it is possible" Verb?

base cases

Please reconsider the "1 step/space". I recommend a smaller base case. As usual, smaller base cases are easier to program.

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.