” 写作CSC 3002程序、 辅导c++课程CSC 3002 (Spring 2021) Assignment 4Problem 1If you search the web for fractal designs, you will find many intricate wonders beyond the Kochsnowflake illustrated in this chapter. H-fractal, in which the repeated pattern is shaped like anelongated letter H in which the horizontal bar and vertical lines on the sides have the same length.Thus, the order-0 H-fractal looks like this:To create the order-1 fractal, all you do is add four new H-fractalseach one half of the originalsizeat each open end of the order-0 fractal, like this:To create the order-2 fractal, all you have to do is add even smaller H-fractals (again half thesize of the fractal to which they connect) to each of the open endpoints. This process gives rise tothe following order-2 fractal:Write a recursive functionwhere x and y are the coordinates of the Center of the H-fractal, size specifies the width andthe height, and order indicates the order of the fractal. As an example, the main programwould draw an order-3 H-fractal at the center of the graphics window, like this:Requirments Hints:Please fill in the TODO part of the function drawHFractal() in P1HFractal.cpp.Problem 2The game of tic-tac-toe is played by two players who take turns placing Xs and Os in a 3 3grid that looks like this:The object of the game is to line up three of your own symbols in a row, horizontally, vertically,or diagonally. In the following game, for example, X has won the game by completing three in arow across the top:If the board fills up without anyone completing a row, the game is a draw, which is called a catsgame in tic-tac-toe. Write a program that uses the minimax algorithm to play a perfect game oftic-tac-toe. Figure shows a sample run against a particularly inept player.Requirments Hints:Please fill in the TODO part of the Functions in P2TicTacToe.cpp.Problem 3Rewrite the implementation of the merge sort algorithm from Figure 10-3 so that it sorts anarray rather than a vector. As in the reimplementation of the selection sort algorithm on page 499,your function should use the prototypeRequirments Hints: Do not use other sort algorithms! Do not modify the header file andthe implementation should be in the .cpp file. We will check your implementation and make sureit uses exactly the merge and sort strategy.Please fill in the TODO part of function sort() in P3MergeSort.cpp.Problem 4Implement the EditorBuffer class using the strategy described in the section entitled Doublylinked lists (Page 606). Be sure to test your implementation as thoroughly as you can. In particular,make sure that you can move the cursor in both directions across parts of the buffer where youhave recently made insertions and deletions.In this implementation, the ends of the linked list are joined to form a ring, with the dummycell at both the beginning and the end. This representation makes it possible to implement themoveCursorToEnd method in constant time, and reduces the number of special cases in thecode. The constructor is already given. Methods need to be implemented: The destructor that delete all cells Methods move the cursor A insertCharacter method that inserts one character into the buffer on the cursor A deleteCharacter method that deletes one character after the cursor A getText method that returns the content in buffer A getCursor method that returns the index of the cursorImplement the EditorBuffer class using this representation (which is, in fact, the design strategyused in many editors today). Make sure that your program continues to have the samecomputational efficiency as the two-stack implementation in the text and that the buffer spaceexpands dynamically as needed.Requirments Hints:Please fill in the TODO part of the methods in buffer.cpp.Requirements for Assignment 4Ive provided a project named as Assignment4.pro. You should write TODO part in each .cppfile according to the problem requirements. Finally, please pack your whole project files into asingle .zip file, name it using your Student ID (e.g. if your student ID is 123456, hereby the fileshould be named as 123456. zip ), and then submit the .zip file via BB system. The zip file shouldbe less than 8 MB.Please note that, the teaching assistant may ask you to explain the meaning of your program, toensure that the codes are indeed written by yourself. Please also note that we may check whetheryour program is too similar to your fellow students code using BB.Please refer to the BB system for the assignment deadline April 18, 2021. For each day of latesubmission, you will obtain late penalty in the assignment marks. If you submit more than 3 dayslater than the deadline, you will receive 0 in this assignment.Marking scheme: 1.5 + 3.5 + 1.5 + 3.5 = 10 grades for each problem and the whole Assignment 4 25% Marks will be Given to students who have submitted the program on time. 25% Marks will be given to students who wrote the program that meet all the requirementsof the questions 25% Marks will be given to Students who programs that can be compiled without errors. 25% Marks will be given to students whose programs produce the correct output if theirprograms can be compiled.Reminder: For windows users, Please switch your input language to English before interactingin Stanford console. Or, you will get no response.请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。