EECS 183 Labs
EECS 183 Lab 4: RPS Functions + Testing
Lab due on your scheduled lab day (September 22 - 25)
Lab accepted for full credit until Monday, September 28 11:59 pm Eastern
You must complete both part 1 and part 2 to receive full credit for the lab.
Code autograder direct submission link
Canvas RME quiz direct submission link
In this lab, you will implement and test two Project 2 functions. The main focus of the lab exercise is how to write and test function behavior before full Project 2 integration.

By completing this lab assignment, you will learn:
- To understand how conditionals work in C++.
- To understand how to call and test functions.
- To learn how to write testing code for functions you will implement in projects.
- To practice test-driven development by writing focused test suites.
- To understand how to read RMEs and use them in function definitions.
For all labs in EECS 183, to receive a grade, every student must individually submit the lab assignment, even if you are working in a group.
Starter Files
You can download the starter files using this link.
The IDE setup tutorials for Visual Studio and XCode include a video about how to set up a project using the starter files. You can access the tutorials here:
Lab Assignment Part 1 - start.cpp, test.cpp, rpsLab.cpp
- Create a new project in Xcode or in Visual Studio. See the links above for creating a new project.
- Add
start.cpp,test.cpp, andrpsLab.cppto your project. - Don’t forget to delete
main.cpp(if you are using Xcode). Otherwise, you will get a build error. - For this portion of the lab, you are to implement and test
isMoveGood()andannounceRoundWinner().
NOTE: The test cases you create in this lab can and should be used for your Project 2 tests. Specifically, add those tests to your
test.cppin Project 2. The implementations you write in this lab forisMoveGood()andannounceRoundWinner()should also be copied into yourrps.cppin Project 2.
File Roles
rpsLab.cpp: implementisMoveGood()andannounceRoundWinner().test.cpp: writetest_isMoveGood()andtest_announceRoundWinner().start.cpp: lets you run your tests from a simple menu.
Function to implement: isMoveGood()
-
This function determines whether or not a player’s move is valid. A valid move consists of an ‘r’, ‘p’, or ‘s’ character, corresponding to “rock”, “paper”, and “scissors”, respectively. The uppercase versions of these characters are also considered valid.
-
RME and function declaration:
/** * Requires: nothing * Modifies: nothing * Effects: Returns true if and only if move represents a valid move character: * one of 'R', 'r', 'P', 'p', 'S', 's'. Returns false otherwise. */ bool isMoveGood(char move);
Function to implement: announceRoundWinner()
-
This function announces the name of the round winner. If there is no round winner, it outputs that the round resulted in a draw.
-
RME and function declaration:
/** * Requires: winnerName is the name of the player who won the round. * Modifies: cout * Effects: If winnerName is empty, print a message indicating the round * is a draw. Otherwise, print a congratulatory message to the * winner. * Prompt: This round is a draw! * ------------- OR ------------- * [winner_name] wins the round! */ void announceRoundWinner(string winnerName);
Required tests in test.cpp
Implement and call both:
test_isMoveGood()test_announceRoundWinner()
IMPORTANT: Since
announceRoundWinner()has return typevoid, you must test it by checking printed output behavior.
Bugs To Expose
There are a total of 4 unique bugs to find in buggy implementations of these functions. Your tests should expose the bugs from the following set:
- CHECK_ISMOVEGOOD_1
- CHECK_ISMOVEGOOD_2
- CHECK_ANNOUNCEROUNDWINNER_1
- CHECK_ANNOUNCEROUNDWINNER_2
How to Submit
- When ready to submit to the autograder, visit https://autograder.io/web/project/3974.
- Submit your
test.cppandrpsLab.cppfiles.
Note: If you’re using Xcode and need to find files on disk, right-click the file in the Navigator and choose Show in Finder.

If you’re using Visual Studio and need to find files on disk, right-click the file tab and choose Open Containing Folder.

IMPORTANT: For all labs in EECS 183, to receive a grade, every student must individually submit the lab. Late submissions for labs will not be accepted for credit.
Lab Assignment Part 2 - RME Canvas Quiz
RMEs
RMEs (Requires, Modifies, Effects) are the comments that appear above function declarations for labs and projects. They document what a programmer needs to know to be able to call a function.
To complete this portion of the lab:
- Take a few minutes to review the slides on RMEs here.
- Complete the Canvas quiz Lab 4 - RME Quiz..