From brand guide: https://flsouthern.mediavalet.com/portals/fsc-brand-guidelines
CSC 3380: Algorithms
(Spring 2025)

Syllabus

LMS

Teachers

Assignments
Assignments


Other Pages

Project 0:
Find the code word


Assigned: Mon Jan 06 2025
Due: 11:59:00 PM on Tue Jan 21 2025
Team Size: 2
Language: Java
Out of: 100 points


You stand in front of an extremely long wall with doors at every step along it to both the right and left and a sign above each door. Each sign contains a different word that might be the voice-activated code word that opens the door. Unfortunately, only one of those code words works. Also, you don't know whether the working code word/door combination is to the right or the left. The wall seems to stretch infinitely in both directions... yikes! Okay, go find the right code word and door! (Or, better, write some code to find it.)

Part 0, 0 points: Look at the instructions below to organize your code to simplify the submission process.

Part 1, 0 points: Create a CodeDoorFinder.java file, where you will write code that explores a wall, looking for the door to get through. To run your code, I will call the static and void method findDoor in your file, which takes a single parameter that is a CodeDoorWall. You are free to create any other methods/classes you like, so long as they are all contained in CodeDoorFinder.java. You cannot use any packages outside of the standard Java 8 libraries.

Part 2, 0 points: Add a JavaDoc comment header so I know who is in your team. E.g.:

/**
 * Finds the working code word door in the wall.
 *
 * @author  Anne Borgin and Kyle Burke.
 */
public class CodeDoorFinder {
Additionally, add a method to your class, getAuthors, that returns a string with the names of all members of your team, like this:
    /**
     * Returns the authors' names.
     * @return  The names of the authors of this file.
     */
    public static String getAuthors() {
        return "Anne Borgin and Kyle Burke";
    }

Part 3, 0 points: The CodeDoorWall parameter of the findDoor method models the infinitely-long wall. It starts you in the zero position. You can move left and right and check that the door works at every space:

  • The getPosition() method returns the coordinate of where you are currently positioned at the wall, in case you get lost.
  • stepLeft() and stepRight() move you one step in that direction. The wall keeps track of how many steps you've taken.
  • checkCodeWord() returns whether the code word at your current location opens the door there. If it's true, then it sets a flag in the wall that you've successfully opened the door.
You want your code to continue searching until you've opened the door, at which paint it can finish executing. My code will then report the ratio of the number of steps you took divided by the distance of the door to the starting position. The CodeDoorWall parameter of the findDoor method models the infinitely-long wall. It starts you in the zero position. You can move left and right and check that the door works at every space:
  • The getPosition() method returns the coordinate of where you are currently positioned at the wall, in case you get lost.
  • stepLeft() and stepRight() move you one step in that direction. The wall keeps track of how many steps you've taken.
  • checkCodeWord() returns whether the code word at your current location opens the door there. If it's true, then it sets a flag in the wall that you've successfully opened the door.
You want your code to continue searching until you've opened the door, at which paint it can finish executing. My code will then report the ratio of the number of steps you took divided by the distance of the door to the starting position.

Part 4, 0 points:

Part 5, 100 points: You earn points depending the smallest maximum ratio you achieve. The smaller your ratio, the more points you can earn. I have a tester, CodeDoorTester.java that runs some deterministic and randomized tests. You can use this to test your code, but the only official scoring run is the one that I'll make.

Submitting your Project:

The files I'm looking for in this project are:

  • CodeDoorFinder.java
Pick a team name (all alphabetical characters) for yourself that no one else will choose. (Using your names makes it easier for me, e.g. if I worked with Anne Borgin, our team name could be BorginAndBurke.) Put completed working files you have directly in a folder (no subfolders) named <YourTeamName>Project0, then zip the folder and upload the resulting .zip file to the assignment's canvas page so I can grade it. (E.g. BorginAndBurkeProject0.zip.) If you do it before the deadline and want me to run it through my tester to see how it does against the random players, send me a message and I'll do it. If you upload it after the deadline, please send me a message so I can grade it ASAP. Please please please name the folder correctly, then zip it; don't rename the zip file, or you'll have to resubmit and may incur a lateness penalty.