美文网首页
代写LP102留学生作业、代做C++程序语言作业、代写githu

代写LP102留学生作业、代做C++程序语言作业、代写githu

作者: nr53104 | 来源:发表于2019-04-21 15:25 被阅读0次

    LP102 2019 SpringHomework 1AbstractWrite a C [1] program that can play the games of Go and GoBan.1 Introduction of Go and GobanGo (called WeiQi in China) and Goban (called WuZiQi in China) are ancientboard games. The board is marked by horizontal and vertical lines. Stones,white or black, will be placed on the intersections of lines. Two players willuse different colors of stone, and put their stones in turn on the board. Goand Gomoku have different rules of winning. The rules of the two games aresimple. We can find online documents for their rules.Rules of Go:The picture above is from https://tromp.github.io/go/legal.html1 https://en.wikipedia.org/wiki/Rules_of_Go https://senseis.xmp.net/?BasicRulesOfGoRules of Goban: https://en.wikipedia.org/wiki/Gomoku2 Gaming data storage2.1 Board and stoneA 2–dimentional array of integers is used to record the stones on the board.If the board has 19 × 19 lines, then we can use an 19 × 19 board. At aline interscetion on the board, there are 3 possible stone occurrences there:Empty, Black, White. We can use 3 different integers of represent the 3stones, such as 0, 1, 2. Initially, the board is empty, which means each itemin the 2D arrary of the board is Empty. When a user pick a coordinate, sayE 6, to place a stone, say a black stone, if Black is represented as 1, thenthe corresponding update of the board can be represented as the followingassignment statement:board[4][5] = 12.2 Game play history recordWe can use a 3D integer array to record the history of a game, which isa sequence the positions where stones are put during the game. We don’tneed to remember which position is black or white in the history, since weassume a black stone is always put first. This history array will be saved toa file on a hard drive, or be loaded from a hard drive to memory.3 Display of gaming dataThe board and stones can be printed using ASCII characters at the commandline. Here is some screen record of playing GNU Go:White (O) has captured 0 piecesBlack (X) has captured 0 piecesA B C D E F G H J K L M N O P Q R S T Last move: White C519 . . . . . . . . . . . . . . . . . . . 19218 . . . . . . . . . . . . . . . . . . . 1817 . . . . . . . . . . . . . . . . O . . 1716 . . . + . . . . . + . . . . . O X . . 1615 . . . . . . . . . . . . . . . . O . . 1514 . . . . . . . . . . . . . . . X . . . 1413 . . . . . . . . . . . . . . . . . . . 1312 . . . . . . . . . . . . . . . . . . . 1211 . . . . . . . . . . . . . . . . . . . 1110 . . . + . . . . . + . . . . . X . . . 109 . . . . . . . . . . . . . . . . . . . 98 . . . . . . . . . . . . . . . . . . . 87 . . . . . . . . . . . . . . . . . . . 76 . . . . . . . . . . . . . . . . . . . 65 . .(O). . . . . . . . . . . . . . . . 54 . . . + . . . . . + . . . . . + . . . 43 . . . X . . . . . . . . . . . . . . . 32 . . . . . . . . . . . . . . . . . . . 21 . . . . . . . . . . . . . . . . . . . 1A B C D E F G H J K L M N O P Q R S Tblack(9): o2White (O) has captured 0 piecesBlack (X) has captured 0 piecesA B C D E F G H J K L M N O P Q R S T Last move: Black O219 . . . . . . . . . . . . . . . . . . . 1918 . . . . . . . . . . . . . . . . . . . 1817 . . . . . . . . . . . . . . . . O . . 1716 . . . + . . . . . + . . . . . O X . . 1615 . . . . . . . . . . . . . . . . O . . 1514 . . . . . . . . . . . . . . . X . . . 1413 . . . . . . . . . . . . . . . . . . . 1312 . . . . . . . . . . . . . . . . . . . 1211 . . . . . . . . . . . . . . . . . . . 1110 . . . + . . . . . + . . . . . X . . . 109 . . . . . . . . . . . . . . . . . . . 98 . . . . . . . . . . . . . . . . . . . 87 . . . . . . . . . . . . . . . . . . . 76 . . . . . . . . . . . . . . . . . . . 635 . . O . . . . . . . . . . . . . . . . 54 . . . + . . . . . + . . . . . + . . . 43 . . . X . . . . . . . . . . . . . . . 32 . . . . . . . . . . . . .(X). . . . . 21 . . . . . . . . . . . . . . . . . . . 1A B C D E F G H J K L M N O P Q R S TGNU Go is thinking...white(10): E4Here is the screen shot of playing Goban using with another board design:This the game setting:board-size: 13; win-size: 5; lines-on-board: YesEnter to continue!!!!!!! Welcome to Dragon Go !!!!!!A B C D E F G H J K L M N13 +---+---+---+---+---+---+---+---+---+---+---+---+ 13| | | | | | | | | | | | |12 +---+---+---+---+---+---+---+---+---+---+---+---+ 12| | | | | | | | | | | | |11 +---+---+---+---+---+---+---+---+---+---+---+---+ 11| | | | | | | | | | | | |10 +---+---+---+---+---+---+---+---+---+---+---+---+ 10| | | | | | | | | | | | |9 +---+---+---+---+---+---+---+---+---+---+---+---+ 9| | | | | | | | | | | | |8 +---+---+---+---+---+---+---+---+---+---+---+---+ 8| | | | | | | | | | | | |7 +---+---+---+---+---+---+---+---+---+---+---+---+ 7| | | | | | | | | | | | |6 +---+---+---+---+---+---+---+---+---+---+---+---+ 6| | | | | | | | | | | | |5 +---+---+---+---+---+---+---+---+---+---+---+---+ 5| | | | | | | | | | | | |44 +---+---+---+---+---+---+---+---+---+---+---+---+ 4| | | | | | | | | | | | |3 +---+---+---+---+---+---+---+---+---+---+---+---+ 3| | | | | | | | | | | | |2 +---+---+---+---+---+---+---+---+---+---+---+---+ 2| | | | | | | | | | | | |1 +---+---+---+---+---+---+---+---+---+---+---+---+ 1A B C D E F G H J K L M N-------------------------------------------------------------------It is now move of BLACKPlease give the coordinates (a letter and a digit) to put your stone, according to the board:d5A B C D E F G H J K L M N13 +---+---+---+---+---+---+---+---+---+---+---+---+ 13| | | | | | | | | | | | |12 +---+---+---+---+---+---+---+---+---+---+---+---+ 12| | | | | | | | | | | | |11 +---+---+---+---+---+---+---+---+---+---+---+---+ 11| | | | | | | | | | | | |10 +---+---+---+---+---+---+---+---+---+---+---+---+ 10| | | | | | | | | | | | |9 +---+---+---+---+---+---+---+---+---+---+---+---+ 9| | | | | | | | | | | | |8 +---+---+---+---+---+---+---+---+---+---+---+---+ 8| | | | | | | | | | | | |7 +---+---+---+---+---+---+---+---+---+---+---+---+ 7| | | | | | | | | | | | |6 +---+---+---+---+---+---+---+---+---+---+---+---+ 6| | | | | | | | | | | | |5 +---+---+---X---+---+---+---+---+---+---+---+---+ 5| | | | | | | | | | | | |4 +---+---+---+---+---+---+---+---+---+---+---+---+ 4| | | | | | | | | | | | |3 +---+---+---+---+---+---+---+---+---+---+---+---+ 3| | | | | | | | | | | | |2 +---+---+---+---+---+---+---+---+---+---+---+---+ 2| | | | | | | | | | | | |1 +---+---+---+---+---+---+---+---+---+---+---+---+ 1A B C D E F G H J K L M N5-------------------------------------------------------------------It is now move of WHITEPlease give the coordinates (a letter and a digit) to put your stone, according to the board:e5A B C D E F G H J K L M N13 +---+---+---+---+---+---+---+---+---+---+---+---+ 13| | | | | | | | | | | | |12 +---+---+---+---+---+---+---+---+---+---+---+---+ 12| | | | | | | | | | | | |11 +---+---+---+---+---+---+---+---+---+---+---+---+ 11| | | | | | | | | | | | |10 +---+---+---+---+---+---+---+---+---+---+---+---+ 10| | | | | | | | | | | | |9 +---+---+---+---+---+---+---+---+---+---+---+---+ 9| | | | | | | | | | | | |8 +---+---+---+---+---+---+---+---+---+---+---+---+ 8| | | | | | | | | | | | |7 +---+---+---+---+---+---+---+---+---+---+---+---+ 7| | | | | | | | | | | | |6 +---+---+---+---+---+---+---+---+---+---+---+---+ 6| | | | | | | | | | | | |5 +---+---+---X---0---+---+---+---+---+---+---+---+ 5| | | | | | | | | | | | |4 +---+---+---+---+---+---+---+---+---+---+---+---+ 4| | | | | | | | | | | | |3 +---+---+---+---+---+---+---+---+---+---+---+---+ 3| | | | | | | | | | | | |2 +---+---+---+---+---+---+---+---+---+---+---+---+ 2| | | | | | | | | | | | |1 +---+---+---+---+---+---+---+---+---+---+---+---+ 1A B C D E F G H J K L M NYou can design you own board and stone display. Notice that on theboard between marks of H and J, there is no I, since I is indistinguishableto the digit 1.6Figure 1: Overview of the calling relationship of different component.4 Program structure4.1 OverviewFig. 1 shows the calling relationship between different logical componentsof the program.For example, from the command line, the operations of loading a gameand playing a new game can be activated. Explanations of the calling relationshipsbetween different logcal components, as shown in the graph, areprovided in the next subsection.4.2 Logical components Command line: The game program should allow command–line argument.For example, suppose the name of the executable file is game,then the following are possible commands with their explanation.– game go 9 : Start a new Go game with a 9 × 9 board.– game goban 13 : Start a new Goban game with a 13× 13 board– game load game1.gm : Load the game that is saved as the filegame1.gm, which should be a file saved earlier by this program,then go to the main menu.7– game : Start a new game, then the user will be asked for thechoice of game of and the board size, or to load a game with givenfile name. Saving a game: Ask the user for the file name, then write the gameinformation (Go or Goban, board size, game history) to the file. Thiscan be implemented using the fwrite() function. This operation isreached after playing a game or continuing playing a game. Go to themain menu afterwords. Loading a game: Ask the user to provide the name of file of a savedgame, load the data items from the file to memory, following the orderwhen these data items are saved to the file. This can be implementedusing the fread() function. This operation can be triggered from thecommand line, or from the menu. Go to the menu afterwords. Playing a new game. Initially, no stone is on the board. A black stonewill be put on the board first. Repeat the following 2 steps until endof game is reached:1. Print the current game information: print the board, show thestones on the board, indicate what is the last move, and whoseturn to play now.2. Accept the user’s input of coordinate.– If the user’s input is not an allowed coordinate, ask the userto input again.– If the user’s input is quit, or any word start with q, go to theend of game.– If the user’s input is a valid coordinate, update the data ofthe board and the game history. If a winner can be decided,or no more stone can be placed on the board, show the gameresult and who is the winner (draw is possible), and go tothe end of game.End of game. Ask the user to save the game or not. If user says yes,activate the operation of saving the game. Go to the menu afterwords.Note that if user says no, the game data are still in the memory, andthe game can be possibly replayed or continued when the user chooseto do so at the menu; when a new game starts, the unsaved data willbe gone.8 Replaying a game: Assume that the game data are already in memory,play the game 0te0]p by step. The user can hit the enter to see thenext move of the game, or type quit to end the game replay. Continuing a game: Assume that the game data are already in memory.If an old game is just loaded, then continue to play the old game.If the current game is just ended (or quit by user), then the currentgame data is in memory and the user will continue to play the gamethat is jused quit (paused). Menu: When a user start the game at command line without argument,or finished playing a game, the (menu will appear. This is themain menu of the system; a programmer can design sub–menus forsmaller tasks. The menu will ask a user to choose from:– Play a new game. Do the operation of playing a new game.– Load a game. Do the operation of loading a game.– Replay a game. Do the operation of replaying a game. A usercan replay the current game whose data are already in memory.If a user want to replay an older and saved game, then the gameshould be loaded first.– Continue a game. Suppose the data of a game is in memory (anold game is loaded, or the current game is just quit by the user).– Quit. This will end the program.After the task of each choice is done, except the Quit choice, the usersees the main menu again.5 Requirements and BonusRequirements: The code should original and self–made. The code should be organized in several files. For example, one filefor showing board, one file for the main menu, one file for the gameoperations.The user’s input should be verified. When some wrong input is given,the program should respond some error message and ask the user totry again. The input queue should be cleared before the next input.9 For the Goban game, complete the full game implementation. For the Go game, only three rules need to be implemented:– The rule of capturing stones: When a block of connected stonesare dead (with 0 qi), they should be taken out from the boardimmediately.– The rule of no-entering: It is not allowed to put a stone in aposition, if that position is fully surrounded (has 0 qi), unlessputing stone can kill some neighboring opponent stones.– Then rule of game ending: When there is no position available toput a stone on the board, the game ends. An empty position thatare surrounded by white and the border belongs to white, otherwisebelongs to black. The player who occupies more positions isthe winner.Bonus You can choose to do some bonus work. Implement some other rules of playing Go to make it like a real game.For exmaple, allow the game to end without putting stones at allpossible positions. When both user agrees to end a game, the gameends.Add some time requirements to play the game. When a player runsout the player’s time, the player lose the game. Set up some user’s account. So that a player can load the game thatthe player played. Some advanced user interface, for example, display the names (or filenames) of all the games that recorded, so that the user can easilychoose one to replay. Implement some simple AI, so that the computer to play with human. Other possible and interesting design of the game.Write a readme.txt file to explain in details your work: your design, considerations,difficulties and solutions, experience of cooperation with teammembers.106 Grading of the ProgramYour program will be graded by its quality and style. Detailed policy ofgrading is included in the file HmkGradingPolicy.txt. At most 20 points canbe awarded for the optional operations, depending on the complexity anddesign quality.7 Submission Due time: Monday 22 April 2019, 10:00pm. Compile and debug and run your program. At most 2 students can form a group and do the work together. Your code should be pretty, i.e, you should indent and align your linesand code nicely and logically following some pretty-printing style. At the top of each of your source files (.c or .h files), write your name,last four digits of student id and date as comments. Attach all of your source code files to an email (.c, .h or .txt files). Donot attach binary files (.o, .obj, .exe or executable) files, since doing sowill make your email being considered as virus by the Gmail system.You are welcome to write a file (readme.txt) to explain your code anddiscuss the problems that you met in coding.� The title of your program should be like:[name][last 4 digits of student id][D1|D2][hmk1 Go]If there are 2 students do the homework together, put their names inthe title. Clear indicate in the email and the readme file the names,classes of the student, and the work load division between the students.References[1] Stephen Prata. C Primer Plus (6th Edition)(Developer’s Library).Addison-Wesley Professional, Indianapolis, IN, USA, 2013.11本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

    相关文章

      网友评论

          本文标题:代写LP102留学生作业、代做C++程序语言作业、代写githu

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