- Notifications
You must be signed in to change notification settings - Fork53
Programming assignments for MSU CSCI 366
License
msu-netlab/CSCI_366_Programming_Assignments
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Complete the following assignment individually.Submit your work on D2L into the "Programming Assignment 3" folder.
In this programming assignment you will:
- Implement a Socket class for networked communications and Google Mock testing
- Modify your Client and Server implementations to transmit shots and results over the network, rather than throughfiles on disk
- Alternate the processing of shots from each player using threads and semaphores
Your objective is to extend your implementation of theBattleshipto transmit shot and result messages over the network.To do so you will implement theSocket
class that wraps TCP sockets into objects that send data, check if data onthe socket is available, and receive data.The advantage of using a separateSocket
class is that we can also mock it intests.cpp
.
To complete this assignment you will extend your current implementation of Battleship.You will extend yourClient
andServer
classes to use your implementation of sockets.I have also provided you with an updatedclient_main.cpp
andserver_main.cpp
that uses the new socket class andalso controls the processing of shots from the players using threads and semaphores.Theserver_main.cpp
sets up two semaphores and runs tworun_server
threads to process shots from each player.You should modify theServer.process_shot
function such that the tworun_server
threads alternate the processing ofshots from each player.
I have also modified the tests to used the Google Mock framework, which allows the testing of functions withoutactually opening TCP sockets.
To play Battleship you should first start the server by running therun-server
executable.Then start the player clients by running two instances of therun-client
executable.Unfortunately, the client and server executables will not do anything interesting until you implementClient.cpp
andServer.cpp
.As you progress in these implementations, your code will pass more and more tests intests.cpp
.When your code passes all the tests, you will be able to run the client and server executables to play the game.
Submit your work on D2L into the "Programming Assignment 3" folder.
A text file containing a link to a GitHub repository with your solution for the base assignment.Please not that your repository should be private, so that other students cannot see your solutions.You can create an unlimited number of private repositories by upgrading your github account to the pro version forfree using theacademic discount with your school email.In order for us to be able to see your solution, please add github users
cooperstrahan
andmwittie
ascollaborators through repository settings.A link to a YouTube video showing that your program forces the players to take alternate shots. In other words, thesame client should not be able to make two shots in a row.
We will grade your submissions based on how many test cases intests.cpp
your solution passes.You will also receive points based on whether your program forces the players to take alternating shots.
As in PA2, you have the opportunity to get working the tests that didn't work in the previous assignments to earncredit for those.
About
Programming assignments for MSU CSCI 366
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.