CSCI 3136: Principles of Programming Languages - IT Assignment Help

Download Solution Order New Solution
Assignment Task:

Task:

Rush Hour

This assignment is a continuation of Assignment 6, where you developed the data types necessary to implement a solver for the Rush Hour puzzle. See that assignment for a description of the puzzle and for an overview of a solution strategy.

Submission Instructions
As in the previous assignment, submit your assignment in a single ZIP-file named in the form Banner_LastName_FirstName.zip, where Banner, Lastname, and FirstName are your banner number, last name, and first name. The file should contain the follow directory structure:
.
Banner_LastName_FirstName RushHour.hs

Compiling and Running Your Code
Since I did not teach you how to work in the IO monad, which is necessary to read files and write to stdout, I am providing a skeleton project within which to embed your code. This skeleton project is provided as part of this assignment. If you look inside the src folder of this project, it already contains a file RushHour.hs. This is the file where you need to add your code. To submit it following the instructions above, copy it into a separate folder Banner_LastName_FirstName outside the skeleton project and submit it. To compile and run your code, you need the RushHour.hs file to be inside the src folder of the project I provided.

You compile the code and check for any compilation errors you encounter using $ stack build
This command works anywhere inside the rush hour project directory and any of its subdirectories.
To run the code, use
$ stack run -- <puzzle number>
This again works inside the rush hour project directory. This time, however, you must run it from the top project directory (the one containing package.yaml, stack.yaml, and rush_no_walls.txt). This is because the path to rush_no_walls.txt is hardcoded into the skeleton code I provided to you. Also, this will of course work only once you have implemented a functioning rush hour solver.

 

This Assignment: Implement the Solver
In the previous assignment, you defined a stub for a function myMagicSolver that searches for an optimal solution to a Rush Hour puzzle. Your task in this assignment is to implement this function. In principle, that’s it. Go!

I suspect it may help to break this task down a bit, to give you an idea of how you may structure your solution.

As discussed in the previous assignment, the general strategy is to maintain a frontier, the list of board states on the current level of your breadth-first search. The search is then a repetition of the following process: Given the current frontier, check whether it contains a solution, a configuration where the red car is free. If so, your search should return the path of moves you followed to reach this configuration, so every state in your frontier also needs to store the path of moves you followed to reach this configuration. If there is no solution in the current frontier, then you need to construct the next frontier, the next level in your breadth-first search.

 

The Main “Loop”

search
This function should take the current frontier and the list of configurations seen so far as an argument. Its return value should be the computed solution. To “iterate” over the frontiers, you generate the next frontier from the current frontier and then call search recursively with the new frontier and the new set of seen states as arguments.

Computing The Next Frontier
The search function is easy to implement if you have two helper functions. One is a function that tests whether a given board state is a solved state (the red car is free). See below. The other one generates the next frontier from the current frontier:
 

nextLevel
This function takes the current frontier and the list of seen states as argument and returns the next frontier and the new set of seen states.

 

This CSCI 3136: IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.