美文网首页
讲解:COMP30023、Computer Systems、C+

讲解:COMP30023、Computer Systems、C+

作者: zhetongmang | 来源:发表于2020-01-12 16:03 被阅读0次

    COMP30023 Computer Systems 2019Project 1: Image TaggerDue date: 11:59pm on 29 April (Monday), 2019Prepared by Junhao Gan and Lachlan AndrewBackground. Nowadays, search engines have been an essential part of our lives, e.g., Google andBing, which have significantly improved our productiveness. There are various types of searchingservices, among which keyword search is the dominant one, namely searching by keywords. Whilekeyword search works well for documents, pages and websites, it faces a big challenge when searchingfor images. This is because linking images with keywords is typically difficult for computers as itrequires understanding on the semantic of images. For this purpose, tagging images with keywordsis one of the most effective ways to help computers understand images’ semantic, and this isalso the first step to help machines learn (by telling them which is correct and which is wrong).Unfortunately, tagging a large number of images is boring and requires a substantial amount ofhuman power. In this project, you will make the boring tagging process more funny by implementinga network game server that tags images as people play. (The idea was invented by the inventorof re-Captcha and Duo-lingo; Google bought the company and shut down the game.)The Rules of the Game. The game consists of two players and one server, where each of theplayers can only communicate with the server (but the other player). At the beginning, when thetwo players log on to the server, the server sends both of them a same image. The game thenstarts; the players submit words or phrases to the server, one at a time, without being told whatthe other player has inputed. The goal for both the players is to enter a word or a phrase that hasbeen submitted by the other as soon as possible. Obviously, in order to maximise the chance ofgetting a match, the two players would better to enter words that describe the image well, since itis the only information shared by both of the two. (The image is, therefore, tagged.) Once the goalis achieved, the game ends; the server sends a web page indicating that the game is completed andprompting the players to play again. If both the players agree to play again, the process repeatswith a new image.Project Basic Functionalities. In this project, you are asked to write a program to implement(by socket programming in C) the aforementioned game server supporting two players fromtwo different browsers over HTTP. The program should allow users to configure both the server IPaddress and the port number. Specifically, you need to implement the following basic functionalitiesof the server, where the html source files of all the pages will be provided. The Welcome Page. The server should be able to accept persistent TCP connections from theplayers and return a Welcome Page (as shown in Figure 1) upon the establishment of theconnection. Specifically, the page consists of:– a title, i.e., Image Tagger Game,– a welcome image,– a welcome phrase,– a textbox for players to enter their name, and– a button with text “submit”, by pressing which the name entered in the textbox will besent to the server by the http POST method;1When a player name is submitted, the server should be able to record the name and return theMain Menu Page (see Figure 2).Figure 1: welcome.htmlFigure 2: start.html The Main Menu Page. The Main Menu Page (as shown in Figure 2) has two buttons right below2the image: (i) the “Start” button, and (ii) the “Quit” button.– When the “Start” button is clicked, an HTTP GET request is sent to the server. Uponreceiving the request, the server returns the Game Playing Page (see Figure 3).– When the “Quit” button is clicked, the current player quits the game and a POST requestis sent to the server. Upon receiving this POST request, the server returns the GameOver Page (i.e., Figure 7) to the current player, and to the other player when he/shesubmits their next keyword. The Game Playing Page. The Game Playing Page (as shown in Figure 3) contains a keywordtextbox which is for players to type keywords as their attempts. When the button “Guess” isclicked, the keyword in the textbox is sent to the server (by a POST request). The server shouldthen perform the following actions:Step 1. Check whether the other player is ready to play. If so, go to Step 2; otherwise, return theKeyword Discarded Page (i.e., Figure 4) to the current player indicating that the otherplayer is not ready yet and the keyword just inputed is discarded.Step 2. Check whether or not the submitted keyword has ever been submitted by the other player.If so, the server returns the Game Completed Page to the current player and to the otherplayer when he/she submits the next guess. Otherwise, the server returns the KeywordAccepted Page (i.e., Figure 5) to the current player and the game continues.Figure 3: first_turn.html The Keyword Discarded Page. In the Keyword Discarded Page (as shown in Figure 4), whenthe “Guess” button is clicked, the server performs exactly the same actions as what it does inthe Game Playing Page.3 The Keyword Accepted Page. In the Keyword Accepted Page (as shown in Figure 5), whenthe “Guess” button is clicked, the server performs the same actions as what it does in tCOMP30023作业代做、Computer Systems作业代做、代写C++实验验证、C++程序语言作业调试 代写留he GamePlaying Page, except that the server does not need to check whether the other player is readyor not. The Game Completed Page. For the Game Completed Page, the server performs the sameactions as what it does in the Main Menu Page. The Game Over Page. This page shows “Game Over!”. The server closes the TCP connection.Advanced Functionalities. In order to implement the following advanced functionalities, youwill need to “generate” the html files dynamically rather than simply using the static html filesprovided. More specifically, you will need to insert or change some contents in the html files suchthat it can show information dynamically according to what information the server has received. Advanced Functionality 1: Showing the Inputed Keyword List. In the Keyword Accepted Page,the page should show the list of keywords that have been successfully submitted by the playerso far. Advanced Functionality 2: Identifying Players by Cookie. When a player connects to the serverfor the first time, the server should be able to create a cookie for the player. Afterward, when aplayer tries to connect to the server for the second time with a cookie, the server should be ableto identify the player by cookie and return directly the Main Menu Page showing the player’sname (therefore, you will need an html file that can change dynamically) without asking theplayer to submit his/her name in the Welcome Page.Specific Requirements. Below are some specific requirements for the project: The game server must be implemented by socket programming in C. Programs in otherlanguages will not be accepted and will result in zero mark. The server must use HTTP protocol to communicate with the client browsers.A makefile must be provided along with your code for compilation, and the compiled executablebinary must be named as image_tagger. The image_tagger program must accept two parameters: (i) a specified server IP address,and (ii) a specified port number. When the program is started, it must print out the information of the IP address and theport number of the server, as shown in Figure 8.Hints. In this project, you can assume that everything in the test environment is friendly, namely,there are no adversaries aiming to break down your program, neither unexpected connection drops.In addition, below are some key knowledge that you may need to know to complete the project: communicating with a client over a persistent TCP connection by socket programming in C; sending an html file to the client browser;4Figure 4: discarded.htmlFigure 5: accepted.html5Figure 6: endgame.htmlFigure 7: gameover.html$ image_tagger image_tagger server is now running at IP: on port Figure 8: Example execution instance. Note: $ is the CLI prompt; and are input parameters. parsing an http message received from a client browser such that the server can extract thehttp method (whether it is a GET or a POST) and the contents in the message; supporting two connections with two client browsers simultaneously, namely, multiplexing &demultiplexing (some useful materials and good examples can be found here1).An important note: You will have a try on some of the above techniques in the labs in Week 5 andWeek 6. You may not want to miss them.Marking Scheme. This project worths 15% of the subject. The marking scheme is as follows:1http://www.beej.us/guide/bgnet/html/multi/advanced.html6Marks Task1 Configurable IP addresses and port numbers1 HTTP over Persistent TCP Connections1 Response to the player’s name submission2 Response to the clicking the “Start” button1 Response to the clicking the “Quit” button3 Response to the clicking the “Guess” button2 Displaying the keyword list1 Identifying player by cookie1 The use of Gitlab for version control1 Code Quality1 Build Quality (e.g., providing a makefile)Questions. Any questions or doubts should be raised in the LMS Discussion Forum — Project 1.Do not share implementation-specific source code on the discussion forum.Submitting Your Source Code. The due date is at 11:59pm on 29 April (Monday) 2019.You must submit, to both GitLab and LMS, your source code (with a makefile) in a .zip filewith a filename in the the format of _comp30023_2019_project-1, e.g., junhaog_comp30023_2019_project-1.Any failure to follow the filename format will result in a2-mark deduction. Any missing submission from either Gitlab or LMS or both will be considereda submission failure.Late Submissions. There will be heavy penalties on late submissions. Any late submission willbe deduced 20% from the total marks in the first day, and an extra 1-mark deduction appliesto each day passing the deadline.Zero Tolerance for Cheating. While you are allowed to discuss the project with your classmatesand search online to learn some related techniques to complete the project , you are required toimplement the program by your own. This means that every single line of the code must be writtenby yourself. All submissions will be checked for plagiarism. Any confirmed case will receivea 0 mark for the project outright, and be reported to the school for disciplinary actions.7转自:http://www.7daixie.com/2019050148151549.html

    相关文章

      网友评论

          本文标题:讲解:COMP30023、Computer Systems、C+

          本文链接:https://www.haomeiwen.com/subject/cstwactx.html