Topics #
Common Policy Questions #
This section is actively under construction and will be populated as more questions come up.
Are hallways with a width of 2 allowed? #
Yes, as long as they are not ambiguous with rooms.
Are overlapping rooms allowed? #
Yes, as long as the rest of the validity criteria are still met.
Are double walls (walls directly adjacent to each other) allowed? #
Yes, as long as each wall is generated as a part of its own associated room or hallway. Any wall tile that is not directly or diagonally adjacent to a floor tile is invalid.
Can there be entrances to the void? #
No, your world will be considered invalid if any floor tile is adjacent to a void tile. If you are interested in generating an “outside” section to your world, consult with a staff member first.
Does the size of my world have to be random? #
No, it is permissible to hardcode the dimensions of your game canvas. Any dimensions that fill up around half of a laptop screen are acceptable. If you would like, you can use the canvas dimensions in Lab 9 for Project 3.
Can two structures share the same wall? #
Yes, as long as they meet all other world requirements (such as non-overlap).
Common Problems and Errors #
I can’t get text to show up / My tile characters became weird / My HUD flickers! #
See the Common UI Problems page.
Two instances of my class are saying they are not equal when they should be. Also, I set the instance of my class to be the key in a HashMap, but I can’t find it when I try to access that key. #
Make sure that if you create any classes, override the .equals()
method AND the .hashcode()
method. This will guarantee that two instances that are equal will have the same hashcode
I’m not passing the test where the input is “lwsd”. #
We provided a valid input with a seed prior to calling lwsd. Likely, you’re not handling persistence properly. Make sure to input the exact sequence of calls to replicate this functionality (edit configurations to call getWorldFromInput with a valid parameter, then call it again with “lwsd”).
I’m getting an AccessControlException
- what do I do? #
Be sure you’re only creating / writing to files (not directories). This means that you should only be writing to CWD
in a file ending with .txt
, for example — not any other folders or subfolders.
I’m trying to implement getWorldFromInput
but my world is not rendering when I’m running Main.java
! #
Make sure to temporarily call ter.renderFrame() (with your appropriate 2-D TETile array input) in getWorldFromInput - you must comment this method call out before submitting to the autograder. If you’re using a separate class to generate random worlds, you can debug by creating a main method within that class and calling ter.renderFrame().
How do I close my world after the input :q
? #
Call System.exit(0); You are allowed to System.exit(0), but you cannot use it in your getWorldFromInput method.
What do I do if the input to getWorldFromInput()
has extra characters after :q
? #
You do not need to worry about replay strings that contain multiple saves or characters after the save, i.e. “N5SDD:QD” is not considered a valid replay string.
Autograder Errors #
Why is the autograder saying “Could not initialize class edu.princeton.cs.algs4.StdDraw”? #
Somewhere in your code, your getWorldFromInput
method tries to use the StdDraw
class which is not allowed. For example if you call TERenderer.initialize()
, you are using StdDraw
. No StdDraw
window should open when you call getWorldFromInput
. We’ve seen some students whose code only opens a StdDraw
window for some seeds, so look very carefully.
The autograder is getting a NumberFormatException
caused by Integer.parseInt
. #
The Random
class takes long
as input, so the seeds we provide are too big to fit into an int
. You need to use the Long
class instead to parse the seed.
The autograder is telling me my worlds are not distinct, even though I run the seeds locally, and the worlds appear visually different. #
Check to see that every tile you use is represented by a distinct character. This is especially important if you create any new tiles.
I am getting weird autograder messages that don’t make sense with the internals of my code. #
Make sure you are not changing TETile.java’s character
field or character()
method.
I’m getting “unreported exception IOException
(or some other exception) must be caught or declared to be thrown” on the autograder, but my code works fine locally. #
The autograder probably won’t compile if you throw exceptions in your method signatures. Instead, use a try-catch block with the part of your code that throws the exception, then remove throws
from your method signatures.
The autograder seems to be exiting early, even when I don’t have a bug in my code? #
Make sure you are not calling System.exit()
.
Custom World Features #
I want to make a world where we can explore the outdoors or caves or something like that, not a bunch of rooms. What should I do? #
That’s fine, you can just use the seed to create a starter house (with rooms and hallways) for your avatar that they can freely exit.
Can I make a world, that supports scrolling or multiple levels (i.e. stairs)? #
Sure. In this case, getWorldFromInput
should return only the part of the world that is visible on the screen at the time that the last character in the replay string is entered.
Can I add the ability for users to customize their character before creating a world? #
Yes, but you’ll need to create a fourth main menu option. Your project must support exactly the API described in this spec. That is, “N23123S” must always create a new world with the seed 23123, and must not ask for any additional input from the user.
Do I need Main Menu for the Phase I Autograder? #
No, we won’t grade you on that.
Are there any live checkoffs? #
Yes, sign ups will be released on Ed at a later date.
Would it be possible to get points back if we lost some points in either autograder? #
Yes, there will be some instructions about it later on in the checkoff script!