Introduction
Welcome to your first practical. Practical assignments are longer assignments, and you have roughly two weeks to complete the assignment during a 16-week session (1 week for 8-week class sessions). It is important that you start early, as the most common feedback we get from students is that they wish they started earlier.
For this practical, you will practice two major concepts
- Reading Other People’s Code
- Debugging Code (especially with zybooks feedback)
That is it. However, it isn’t as simple as it sounds. Why do we do this? One, it will help you understand debugging in zybooks, and two debugging other peoples code is actually fairly common for your first job. Often, testers are given code and told to “figure it out”. Learning the skill to figure out other code, and correct errors is essential.
Knight Fight
Student, you have been hired by Round Table Games. They are a startup company that believes text-based games are going to make a comeback. However, the programmer they hired to prototype their latest game Knight Fight, quit mid-development, and you have been hired to pick up the slack. Once completed, you will have a very, very basic game to play.
Your Task For This Practical
Your goal for this practical is to simply get the code working! You may submit as many times as possible, but it is suggested you don’t submit for grading without first trying to figure out ways to debug!
Provided Code
You will find by clicking the drop-down arrow next to the name of the file in Zybooks, that this program has a lot of files. Most programs have as much code divided out between files as is reasonable, and this is no exception. In all the files, you will find extensive comments to help guide you on what each method does or is supposed to do.
Where To Start?
Here are some suggestions on how to approach this problem
- First figure out what the code is supposed to do.
- This may involve writing an outline, documenting it visually on paper, writing notes to yourself!
- Feel free to talk with others about it, and post in MS Teams questions you have about it.
- Get the code compiling. The provided code does not compile. Your first step is to find the compiling errors. Make sure to submit to grading after that.
- After the code compiles, you will have at least 7 (maybe more) logic errors to track down. For simplicity’s sake, we kept those errors to RtKnight, RtView, and RtTarotDeck.
- RtView.splash - while not part of the graded code, we would like you to implement the .splash() method. Have FUN with it! You will be asked to post your splash screen as part of Reflection 1, and we will “grade” it there (make sure you completed it).
Suggestions
You should test after every couple if statements! While they won’t all work right away, it is much easier to trace errors like missing curly brackets if you are only looking at a couple lines of code.
System.out.println
Is a great tool to debug! We suggest putting “DEBUG” in the line as you debug. For example, System.out.println(“DEBUG: “ + value);
Remember to start early, ask questions, and more! In this case, help desk can’t help you track down the errors themselves, but asking in general channel will cause the TAs and Instructors to provide guides on where to find the errors.
Random Insights
No System.out.printlns?
You will notice that none of the classes have Systems.out.print/println except for RtTests and RtView. This is intentional, and common practice. Methods rarely print directly! Instead, they pass messages of information to other methods and user interfacing (UI/UX) happens in a specific layer of your program. In this case, RtView. It could be in the future, we change RtView to interact with a webpage, making the game a web-based game. UI/UX design is an emphasis of Human-Centered Computing, where as full-stack development is more Software Engineering and focuses on figuring the entire design.
User Interface Design
The RtView class is the heart of your user interface, along ith the RtController acting as an interface to the rest of the program. We will explore this MVC design more in the future (take CS 312!), but for now, go here to learn about user interfaces.
Some examples of splash screens:
ASCII art source.
Submitting
Make sure to click through canvas before your last ‘submit for grading’. This will ensure the code is linked, and updates to canvas. After submitting, you should complete Reflection 1.