CS 242 Spring 2010 : Assignment 1.3

This page last changed on Feb 08, 2010 by cemeyer2.

Assignment 1.3 – Creating a GUI for our path finding library

This final part of the assignment will be due on February 17th, 2009 at 8AM in SVN. This assignment will be an extension of the maze solver library. Specifically, it will create a GUI interface for your libraries. Please commit your assignment to a directory called Assignment1.3 in SVN. Please match this spelling exactly so we can automate the export of code for code reading.

For this assignment we will be building a Graphical User Interface (GUI) for the maze solving libraries we have developed. As a method of creating this GUI, we’ll be turning to the model-view-controller (MVC) software architecture. In an MVC architecture there are three components that comprise all the pieces of a GUI. The Model is used to hold data related to an application. In the context of this assignment, this might be the maze representation(s), state of the solution, state of the GUI, etc. The View component contains what the user will see. A view would have all buttons, labels, frames, pictures, and other graphical elements. The Controller handles communication between the user and the application. It will contain the functions to handle button clicks, for example. The following link is an excellent description of the MVC design paradigm (this is the one shown in lecture): http://www.cs.rice.edu/~cork/newBook/node89.html.

To complete this assignment, your GUI must do several things:

  • It should contain a button to test if the maze is solvable.
  • It should contain a button to then solve the maze. If the maze is not solvable, you should prevent this button from initiating the algorithm.
  • The GUI should be able to load a maze from a file, and the GUI should not need to be restarted when new mazes are loaded. You will find this functionality to be easily performed with a File Chooser.
  • It should also contain a visualization of the maze, and when solved, the solution. Preferably, a image of the maze will be displayed with the solved path overlayed on it.
  • Your GUI should also be able to take in any parameters used for scaling uphill/downhill values.
  • Your GUI should allow the user to choose a heuristic (from at least 3 of the ones you have implemented) and be able to find a path with the chosen heuristic.
  • Your GUI should be able to take an interval for running successive tries and allow for running for each of the values in the given ranges.
  • Lastly, your GUI should be able to allow for basic editing of the map. That is, set thresholds for colors deemed to be “walkable” or “not walkable”


You may also complete some challenge requirements to earn some extra credit. Eligible challenge requirements include:

  • animating the maze solution with an adjustable time interval.
  • displaying an alternate view of the solution


As always, you will be graded on participation and implementing the guidelines for modular, readable code. Additionally, you will be graded to ensure that you meet the requirements listed above.

Netbeans Warning!

If you decide to use the UI builder in Netbeans for this assignment, be very careful. Although the UI builder quickly generates Java GUIs, it produces very ugly code that will not meet the requirements for this assignment without modification. Most noticeably, it tightly couples the view with the controller, so significant refactoring of the autogenerated code will be required. In the next few days, we will post a sample of the autogenerated Netbeans code and a refactored version of that same code that will meet the requirements for this assignment.


GUI programming can be a potentially daunting experience. Below are some external resources to help get you going.


  • Usabaility
    • Your program exit cleanly in all cases: 2
    • It is clear how your program should be used: 2
    • There are no unwanted side effects (i.e. clobbered files): 2
  • Documentation
    • Your code contains ample comments: 4
    • Your program provides useful feedback to the user: 4
  • Code Design
    • Your code is modular: 4
    • Functions only do one thing: 2
    • Each function is no longer than 25 lines of code: 2
    • There were no code smells in your code (-2 for each): 10
    • You applied the MVC design pattern: 6
  • Functionality
    • GUI Can load a maze from a file: 2
    • GUI Contains a visualization of the maze: 2
    • Solve button solves the maze and visualizes the solution path: 4
    • GUI has inputs for any parameters including the costs and weights for A*: 4
    • GUI can run successive iterations over ranges supplied for heuristic: 4
    • GUI allows for basic editing of maze: 4
    • GUI can step through runs: 2
    • Extra credit: 5
  • Participation
    • You actively participated in discussion: 4
    • You came prepared based on your assigned code reading: 4
    • You handed your assignment in on time and to the correct location: 4
Total 72 Points
Document generated by Confluence on Feb 22, 2012 18:15

  1. No comments yet.

  1. No trackbacks yet.