Individual Project 1 Due Wednesday September 20, 11:00am EDT
Welcome aboard to the Covey.Town team! We’re glad that you’re here and ready to join our development team as a new software engineer. We’re building an open source virtual meeting application, and are very happy to see that we have so many new developers who can help make this application a reality. By the end of the semester, you’ll be able to propose, design, implement and test a new feature for our project. We understand that some of you may have some web development experience, but don’t expect that most of you do, and hence, have created an individual project to help you get up to speed with our existing codebase and development environment.
Covey.Town is a web application that consists of some code that runs in each client’s web browser, and also code that runs on a server. Users join the application in a “town”: a 2D arcade-style map with different rooms to explore. Each town is also a video call: when two players get close to each other, they can see and hear each other; there is also a text chat available within the town. In Winter of 2021, our lead software engineer, Avery, developed a prototype for Covey.Town, and since then, hundreds of students in this class have built on that codebase. The most recent class-wide effort added a concept called Poster Areas, allowing players to upload a poster which is then dispalyed and discussed in a special part of the town. Many student projects over the past few years (some of which are publicy showcased from Spring 2022 and from Fall 2022) involved creating games within Covey.Town. For example: students created implementations of soccer, blackjack, dance dance revolution and tic-tac-toe.
After studying all of the student projects and their implementation challenges, our lead software engineer, Avery, has refactored Covey.Town, designing a new abstraction to make it easier to create games like these.
Avery’s new abstraction, GameArea
, is a region of the town that provides some core elements to allow players to play games within that area.
The abstraction cuts across the entire technology stack: GameArea
s exist in the 2D map and the application automatically tracks when players enter and exit them.
By pressing the spacebar within an GameArea
, the user can trigger an interaction with that area, which in turn can be easily used to display new content in the web app using React.
A GameArea
in one user’s browser can also emit events that are delivered in real-time to other players interacting with that same area.
The GameArea
provides common functionalities that all games might want to provide: allowing players to join and observe a game, as well as tracking a leaderboard.
The objective for this semester’s individual project is to implement this new GameArea
abstraction, with one concrete implementation: TicTacToeArea
.
The TicTacToeArea
will implement the gameplay for the classic game, Tic-Tac-Toe.
This implementation effort will be split across two deliverables. In this first deliverable, you will implement and test the core backend components for this feature, and in the second deliverable, you will implement and test the frontend components.
Objectives of this assignment
The objectives of this assignment are to:
- Get you familiar with the basics of TypeScript, VSCode, and the project codebase
- Learn how to read and write code in TypeScript
- Translate high-level requirements into code
- Learn how to write unit tests with Jest
Getting started with this assignment
Before you begin, be sure to check that you have NodeJS 18.x installed, along with VSCode. We have provided a tutorial on setting up a development environment for this class
Start by downloading the starter code. Extract the archive and run npm install
to fetch the dependencies. Avery has provided you with some very basic sanity tests that you can extend for testing your implementation as you go. You can run these tests with the command npm test TicTacToe
(note that many tests are expected to fail until you have begun to implement the assignment).
Grading
This submission will be scored out of 100 points, 90 of which will be automatically awarded by the grading script, with the remaining 10 manually awarded by the course staff.
Your code will automatically be evaluated for linter errors and warnings. Submissions that have any linter errors will automatically receive a grade of 0. Do not wait to run the linter until the last minute. To check for linter errors, run the command npm run lint
from the terminal. The handout contains the same eslint configuration that is used by our grading script.
Your code will be automatically evaluated for functional correctness by a test suite that expands on the core tests that are distributed in the handout. Your tests will be automatically evaluated for functional correctness by a process that will inject bugs into our reference solution: to receive full marks your tests must detect a minimum number of injected bugs. Each submission will be graded against the same set of injected bugs (repeated submissions will not receive new/different injected bugs). You will not receive detailed feedback on which injected bugs you do or do not find.
The autograding script will impose a strict rate limit of 5 submissions per 24 hours. Submissions that fail to grade will not count against the quota. This limit exists to encourage you to start early on this assignment: students generally report that assignments like this take between 3-20 hours. If you start early, you will be able to take full advantage of the resources that we provide to help you succeed: office hours, discussion on Piazza — and the ability to have a greater total number of submission attempts.
Your code will be manually evaluated for conformance to our course style guide. This manual evaluation will account for 10% of your total grade on this assignment. We will manually evaluate your code for style on the following rubric:
To receive all 10 points:
- All new names (e.g. for local variables, methods, and properties) follow the naming conventions defined in our style guide
- There are no unused local variables
- All public properties and methods (other than getters, setters, and constructors) are documented with JSDoc-style comments that describes what the property/method does, as defined in our style guide
- The code and tests that you write generally follows the design principles discussed in week one. In particular, your design does not have duplicated code that could have been refactored into a shared method.
We will review your code and note each violation of this rubric. We will deduct two points for each violation, up to a maximum of deducting all 10 style points.
Overview of Relevant Classes
The UML class diagram below shows the three main classes that you will be implementing for this deliverable (TicTacToeGameArea
and TicTacToeGame
) along with several relevant classes for additional context. An InteractableArea
represents a region of the 2D map that the player can interact with - existing implementations of this interface include ConversationArea
and ViewingArea
.
The new GameArea
abstraction extends InteractableArea
, adding state to track the current Game
in the area and the history of past games using its GameResult
array. Subclasses of GameArea
must implement the handleCommand
method of InteractableArea
, which is how messages are passed from clients to the server.
The base Game
abstract class tracks the state of the game, including who is playing it. The abstract class includes the glue that allows the socket protocol to serialize the game state such that it can be sent from the server to clients. Implementors of the Game
abstract class implement the methods applyMove
, _join
and _leave
.
Implementation Tasks
This deliverable has four parts; each part will be graded on its own rubric. You should complete the assignment one part at a time, in the order presented here.
General Requirements: Implement your code only in the files specified: src/town/games/TicTacToeGame.ts
, src/town/games/TicTacToeGame.test.ts
and src/town/games/TicTacToeGameArea.ts
. You should not install any additional dependencies. The autograder will ignore any other files that you modify, and will not install any dependencies that you add to the project.
Task 1: Joining and Leaving the TicTacToeGame (24 points)
The TicTacToeGame
class extends the base Game
class, implementing the semantics of the game Tic-Tac-Toe. Avery has provided a definition for the types that will be used to represent the state of a TicTacToeGame
- TicTacToeGameState
. That type definition is reproduced below:
As a gentle introduction to this abstraction, your first task is to implement the _join
and _leave
methods of TicTacToeGame
. To implement these methods, you should not need to read any other parts of the codebase besides Game.ts
.
View the specification for these methods
Testing: Avery has provided you with some very simple (and incomplete) tests for _join
and _leave
. You can run these tests by running the command npx jest --watch TicTacToeGame.test
, which will automatically re-run the tests as you update the file (note that tests for applyMove
will also run - but you can ignore those at this point). You should improve the _join
and _leave
tests to check the entire specification. Please implement these additional tests in the file src/town/games/TicTacToeGame.test.ts
.
Grading for implementation tasks:
_join
: 6 points_leave
: 6 points
Grading for testing tasks:
_join
:- 6 points for detecting all 25 faults, or
- 3 points for detecting 24 faults
_leave
: 6 points
Task 2: Tic-Tac-Toe Game Semantics (50 points total)
The next (and largest) task for this deliverable is to implement the method TicTacToeGame.applyMove
, which applies a player’s move to the game. This method is responsible for validating the move, and updating the game state to reflect the move. Given the complexity of this method, you should anticipate creating (at least one) private, helper method to implement its logic.
View the specification for this method
Grading for implementation tasks:
- Applying moves: 8 points
- Checking for invalid moves: 9 points
- Handling game-ending moves: 11 points
Grading for testing tasks:
- Applying moves: 6 points
- Checking for invalid moves:
- 7 points for detecting all 35 faults
- 4 points for detecting 34 faults
- Handling game-ending moves: 9 points
Task 3: Implement the TicTacToeGameArea (16 points total)
The TicTacToeGameArea
receives InteractbleCommand
s from players who enter the area on their client. The main responsibility of this class is to interpet those commands, dispatching them as appropriate to the TicTacToeGame
instance that it manages. Your final task is to implement the handleCommand
method of TicTacToeGameArea
.
There are three types of commands that the TicTacToeGameArea
will receive, which map directly to the three methods of TicTacToeGame
that you implemented in the previous task.
Avery has provided a complete test suite for handleCommand
- you do not need to write any additional tests.
View the specification for this methods
Grading for implementation tasks:
- Handling JoinGame: 4 points
- Handling GameMove: 6 points
- Handling LeaveGame: 5 points
- Handling invalid commands: 1 point
Submission Instructions
Submit your assignment to the instance of Autograder.io running at neu.autograder.io. Navigate to neu.autograder.io in your web browser, click the “Sign in” button, and log in with your Northeastern account. You should then see the course listed on the neu.autograder.io home page. Please contact the instructors immediately if you have difficulty accessing the course on Autograder.io. If you haven’t been added to the course roster yet, you can access the assignment page at this direct link.
To submit your assignment: run the command npm run zip
in the top-level directory of the handout. This will produce a file called covey-town-townService.zip
. Submit that zip file on Autograder.io.
Autograder.io will provide you with feedback on your submission, but note that it will not include any marks that will be assigned after we manually grade your submission for code style (these marks will remain hidden until it is graded). It may take several minutes for the grading script to complete.
Autograder.io is configured to only provide feedback on at most 5 submissions per-24-hours per-student (submissions that fail to run or receive a grade of 0 are not counted in that limit). We strongly encourage you to lint and test your submission on your local development machine, and not rely on Autograder.io for providing grading feedback - relying on Autograder.io is a very slow feedback loop.
To check for linter errors, run the command npm run lint
from the terminal. The handout contains the same eslint configuration that is used by our grading script.
Submission limit resets at 11am EST.