Make the unit tests given (Sort.h, utSort.h) to you pass.
- Implement Sort.h.
- According to #1, write five unit tests in utSort.h.
- Write the corresponding makefile to generate executable file which named
hw1
.
Each test is 10 points, total is 50 points.
-
Need to create a header file by youself naming
Number.h
. In this header, there will be three method you should define:symbol()
,value()
andmatch()
. As you define the Atom and implement it, thesymbol
andvalue
method should return value with string type. And formatch
, in this homework, please use the method way to define instead of operator. -
Also re-define and re-implement the
match()
in Atom via method way instead of operator. -
Implement all tests in utTerm.h. There are prompts in each test, follow the prompt to complete tests.
-
Write the corresponding makefile to generate executable file which named
hw2
. -
Make sure your CI jobs are both passed before deadline.
On your own tests, each test has 2 points, total is 30 points. On TA's tests, each test has 4 points, total is 60 points. The sum of this homework marks is 90.
Please use the files that were used in course and copy test header to your repository from this project.
And unfortunately, the theft of plagiarism occurred again and again, in order to protect the rights and interests of students, we decided to ask you to move your repository from Github to Gitlab. Please follow the steps below to change your repository host.
⚡ After we discussed with Professor, we decided to remain github host. So if you already created a new gitlab repository, sorry for that.
-
Need
number.h
and its class implementationNumber
, you can use the previous one(hw2). And the interface ofNumber
should follow the code block below:Number(double value); std::string symbol(); std::string value();
-
Implement all tests in
utStrcut.h
andutVariable.h
. The describe of test have been written on each test. -
Write the corresponding makefile to generate executable file which named
hw3
. Note that it is the executable name, not the test file name. -
Make sure your CI jobs are both passed before deadline.
You totally have 15 tests in your own, each one is 2 points. And TA's tests totally have 20 tests, each one is 3 points. The sum of this homework is 90 points.
Thus Oct 19 2017 23:59:59
Please use the files that were used in course and copy test header to your repository from this project.
⚡ Some people will place header files into include
folder, and it may cause the building of .ut job to fail. If so, just email to us and we will change the configuation for you.
-
Mon Oct 23 2017 09:54:36
-
Please check your ut job, if it's passed but there is no test report comes out (besides first time building), it means your progarm actually is crash. We are discussing about this cas and think about how to fix it or is there other solution.
-
And about test case X = [496, X, terence_tao]. In this weekend, we replied one student that this decision was a sample judgment that we made and it can be corrected if it's wrong truly. But it sounds pretty irresponsible(sorry for Mr. X), so we re-discuss this case today.
About this metter, we need to check the definition of matching. In the section 2.2 Matching of the book: PROLOG Programming for Artificial Intelligence (third version, Ivan Bratko, 0-201-40375-7), said if two terms match, it must: (1)They are identical, or (2) the variables in both terms can be instantiated to objects in such a way that after the substitution of variables by these objects the terms become identical. Rule (1) is easy to understand, but what is rule (2)? Rule (2) means that if it can get the any value which can make the equation holds, we said it match. For our case, if variable X could be instantiated by any value that make the equation holds, the #match() should return true, otherwise returns false. But it couldn't be, and also not yet.
We can't set true or false on this case utill the variable X can be instantiated. In SWI-Prolog you will get the string "X = [496, X, terence_tao]" as the result instead of false, but it doesn't mean that this matching actually returns true or false(in program). So, for this one, we just decided to make it not score. You can get the points but you still need to write the test, we don't care about the true or false it returns.
-
1. Implement `List` according to the `list.h`, and also all tests in `utList.h`.
2. Write the corresponding makefile to generate executable file which named `hw4`. Note that it is the executable name, not the test file name.
3. Make sure your CI jobs are both passed before deadline.
You totally have 19 tests in your own, each one is 2 points.
And TA's test also have 19 tests, each one is 3 points.
The sum of this homework is 95 points.
Friday Oct 27 2017 23:59:59
Please use the files that were used in course and copy test header to your repository from this project.
In this assignment, you are required to implement the more complete parser through each test. It will use the interface written in the course. And then, there are few tests will need some new methods of different term class, please follow the description of test, implement each method.
And from this week, we start to run Mob programming. There will be one or two group in every week until the end of semester, they are required to show the demonstration which how they run the mob programming and how to solve the problem that in the assignment. It needs to do rehearse and prior planning with us. See below to get more detail.
-
Fri Nov 03 2017 15:06:12
The method
args()
, it should returnTerm *
, notTerm &
. please correct it in your assignment.class Struct { public: int arity(); // return the number of args (terms) - Term & args(int index); // according to index return the term + Term * args(int index); // according to index return the term }
-
Fri Nov 03 2017 11:55:51
The description of test
TEST_F(ParserTest, ListAsStruct)
is wrong, please correct it in your assignment.// Then it should return a Struct which contains two terms. // And #arity() of the Struct should be 2. // And #symbol() of Struct should return ".(1, [])". - // And the first term should be number: "1", the second term should be another Strcut: "[]". + // And the first term should be number: "1", the second term should be another List: "[]". TEST_F(ParserTest, ListAsStruct) { }
-
Complete the parser with the description of each test
-
Implement the new method
arity()
,args()
inStruct
. -
Write the corresponding makefile to generate executable file which named hw5. Note that it is the executable name, not the test file name.
-
Make sure your CI jobs are both passed before deadline.
You totally have 20 tests in your own, each one is 2 points. And TA's test also have 20 tests, each one is 3 points. The sum of this homework is 90 points.
Thur Nov 9 2017 23:59:59
Please use the files that were used in course and copy test header to your repository from this project.
In this assignment, you are required to implement the complete matching like X=1.
through parser. And for test, you don't need to write the test by yourself, we will provide the test to you. Therefore on the CI server, you will only have one job. Please follow the test to implement the necessary class and its interface.
And for the coming Saturday(11/25), there will be two teams need to attend the mob programming. Some adjustment here, please check your name and time, reply to us if you cannot attend the activity on Saturday. And for the demonstration , there is a difference from the previous time, please check the demonstration part to get the more information.
- Fri Nov 24 2017 10:04:53
-
Complete the parser through the test.
There are some methods different from before, especially the
createTerms
is no longer public and we usematchings
to make term and pares sentence instead ofcreateTerms
. Basically it is the difference concept between parsing the complete sentence and parsing a part within the sentence. ThecreateTerms
should be responsible for getting the arguments if there is a list or structure, therefore it should be namedgetArgs
rather thencreateTerms
.We create a new method called
matchings
to parse the whole sentence. It take the sentence as the input, and generates all terms in the sentence and make the corresponding tree to ready to do the real matching. The matching will call thecreateTerm
method in serval times, and if it meets a list or structure, it will callcreateTerms
(getArgs) to get the arguments for that.After
matchings
, the client will get the root node of the tree byexpressionTree
, and do the real matching through theevaluate
method of the root node. And afterevaluate
the whole tree, client will get the final status of the matching. E.g.X=1.
, the X will be the number 1 after the process. -
Implement the new class
Node
and its interface. TheNode
class is used to create the expression tree, and the tree represents the structure of a sentence. Each node is an operator or an operand, so you need to visit the whole tree to do the real matching.The class has the
two constructors
to generate an node or connect two child nodes, and theevaluate
method is used to evaluate that when to do the matching. -
Write the corresponding makefile to generate executable file which named
hw6
. Note that it is the executable name, not the test file name. -
Make sure your CI job is passed before deadline.
You totally have 11 tests, each one is 9 points. And for easier calculating, the sum score of assignment is 100 points.
Wed Nov 29 2017 23:59:59
- Try to read building information in console log and fix the hw problem by yourself as possible as you can.
Please use the files that were used in course and copy test header to your repository from this project.
In this time, you have to design your tests for the iterator of Struct
and List
. A structure contains several terms, it can be expanded into a tree structure like the picture below. We will make two kinds of way to traverse the structure, the first is deep-first search, and the second is breadth-first search. When traversing the structure, iterator gets each item in structure orderly.
You need to design the tests to test your iterator, the function signature of iterator and its usage must follow the way that defined on the course. There is also ours tests to test your program on the CI server (.ut job).
For mob programming, there are some changes of schedule and its activity. We add a activity called Retrospective
in last step, which is the same as the retrospective in Scrum. In retrospective, team will discuss about some issue related to team's development process, and it will help you to review the way when you write code and give you some feedback so you can improve to yourself.
-
Thu Dec 07 2017 14:31:36
-
The deadline is extended to the next Monday(12/11 23:59:59)
-
There is no mob on this weekend, team#6 #7 will be on the next Saturday(12/16).
-
Few people got the Segmentation Fault on CI server but run test successfully on local. This is due to different compiler of different OS: mingw32-make, make. The problem cannot be addressed with a signle soluation, but it occurs on invoking the memory that cannot be accessed, e.g. use the nullptr or use the object that not initialized yet. So please check initialization before using, or delete object properly after test.
-
-
Sun Dec 03 2017 15:22:02
first() in our example should return bigmac not combo1.
-
Redo the creation of iterator, use aggregate(e.g.
Struct
) to create iterator instead of client, and re-write the test of that. -
As we can handle difference type on function through template<T>, make the template on
Iterator
so it can handle the type other thanTerm
. -
Design test for the iterator by yourself. The function signature and usage is not allow to change.
-
Two kind of way for traversing: Deep-first search, Breadth-first search, so there will be two methods on the aggregate:
createBFSIterator
,createDFSIterator
. -
You need to design 2 test data for each type,
Struct
andList
, and use BFS and DFS to traverse each test data. So it totally has 8 tests.
-
-
Write the corresponding makefile to generate executable file which named
hw7
. Note that it is the executable name, not the test file name. -
Make sure your CI job is passed before deadline.
You totally have 12 tests, include the test written on the course. Each one is 5 points. And we will have 8 tests, each one is also 5 points. The sum score of assignment is 100 points.
Fri Dec 8 2017 23:59:59
Please use the files that were used in course and copy test header to your repository from this project.
In this time, you need to make a Shell
to wrapper the program that we made before. It should handle user input and put the input into program, then show the corresponding result. And in some situation, you will need to improve your program to handle the exception if wrong expression.
And we re-assign the mob schedule, the remaining teams will be in the coming week, Tuesday for Team#6, 7 and Wednesday for Team#8, 9. The activity start at 7:00 PM, end at 9:00 PM, fill out the questionnaire, we will provide the free dinner.
If you can't attend, please email to us, thanks.
Team#6 (at 1622) | Team#7 (at 1321) |
---|---|
103590019 | 103590450 |
105598061 | 105598073 |
106598009 | 106598005 |
106598017 | 106598020 |
106598026 | 106598033 |
106598037 | 106598051 |
106598047 | 106598055 |
106598057 | 106598068 |
Team#8 (at 1622) | Team#9 (at 1321) |
---|---|
105598401 | 103590002 |
106598010 | 106598012 |
106598018 | 106598019 |
106598025 | 106598022 |
106598028 | 106598069 |
106598039 | 106598049 |
106598044 | 106598065 |
106598063 | 106598401 |
-
Tue Jan 02 2018 10:51:25
Test case
disjunctionMatching5
inexpression.h
, the result should be "X = 1; true; Y = 2.".
-
This assignment doesn't limit how you implement the shell, but you must ensure that your shell conforms to the following requirements.
-
The shell should provide some functions written in
shell.md
. -
Handle the expressions written in
expression.h
, and show corresponding result. -
Handle the exceptions written in
exception.h
, and show corresponding result. -
Shell shouldn't crash if something goes wrong.
-
-
Design suitable unit test for all implementations that you write for this assignment.
-
Write the corresponding makefile to generate executable file which named
hw8
. This is for executing the test on CI server. -
Write the corresponding makefile to generate executable file which named
shell
. This is for executing the shell. -
Make sure your CI job is passed before deadline.s
There are 29 tests in expression.h
and exception.h
, each one is 3 points; 3 functions written in shell.md
, each one is 4 points.
For easier calculating, the sum score of assignment is 100 points.
If Shell crash, total points deducted 10 points.
Fri Jan 05 2018 23:59:59
- Try to read building information in console log and fix the hw problem by yourself as possible as you can.