Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Programming assignments for MSU CSCI 366

License

NotificationsYou must be signed in to change notification settings

msu-netlab/CSCI_366_Programming_Assignments

 
 

Repository files navigation

Instructions

Complete the following assignment individually.Submit your work on D2L into the "Programming Assignment 3" folder.

Learning Objectives

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

Overview

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.

Program Invocation

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.cppandServer.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.

What to Submit

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 userscooperstrahan 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.

Grading

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp