This file contains questions asked by students along with the answers provided. (The identity of the students will not be included) New Q&A will be added at the top of this file as they arrive -- it's a stack. ----------------------------------------------------- Question 21: March 19 I changed a typo in mysample.out PrettyPut puts the left subtree before the right subtree. Hence the left subtree is above the right subtree. Hence you rotate the page, the left subtree is on the right. If you like you can modify this in PrettyPut. Document this change. ----------------------------------------------------- Question 20: March 17 In part 7, your proof should also prove that your program correctly gives an error message, when the input tree is faulty. When breaking the proof into cases, you basically need a case for each different thing that the program does. In part 8, for each stack frame give the input and the complete output for the stack frame. Present it in a way that helps to indicate the relationship between the input and the output. In part 9, note that my testing lacks test on () for - and /. In part 10, InitVal has been changed to Operand and Sum(f,g) has been changed to Operator(f,"+",g). This cannot test put, because this outputs more than "Example demonstrations are true". ----------------------------------------------------- Question 19: March 14 The code for every routine is quite short. Each routine should fit on a single screen. If the same code would work for two different cases, then the code should not be copied. Set up the if structure so that both cases exicute the same code. ----------------------------------------------------- Question 18: March 14 rundemo is a unix script. It contains a sequence of unix commands. It is exicuted by the following two methods. 1) chmod a+x rundemo (this changes the mode to "exicutable". Actually, it may already have this mode because mine does and you copied mine. ls -l lists the modes. rundemo 2) source rundemo ----------------------------------------------------- Question 17: March 11 I clicked on the link for recPic.dem and recPic.tu saved the file and then couldn't execute this. The reason for this is that the link is to a POSTSCRIPT file that is simply a listing of the code for those programs. Postscript is a special language that can only be understood by postscript interpreters. The lazer printers in the labs and the program ghostview contain postscript interpreters. It is unlikely that your printer at home does (postscript compatable laser printers start at around $1,200. Postscript is designed for printing and page layout. In order to execute recPic.dem you MUST be logged into Ariel in the lab and you MUST follow the instructions in the tutorial precisely. ----------------------------------------------------- Question 16: March 11 Reading the purposed text for 1090, I found the following quote: In mathimatics, 1/bc stands for 1/(bc). However, in most imperative rogramming languages (eg Turing) 1/b*c means (1/b)*c. ----------------------------------------------------- Question 15: March 10 I fixed two bugs in recPic. 1) Hidden buttons being clicked. The bug was in the OOT Widget routines. I found and fixed it. 2) Ear falling off (arcs) My rotation program was producing angles of 520. I changed the code to "ang mod 360" and now it works fine. OOT on ariel handles the following differently. Draw.Arc (maxx div 3, maxy div 2, 100, 100, 520, 290, 1) Draw.Arc (maxx*2 div 3, maxy div 2, 100, 100, 520 mod 360, 290, 1) ----------------------------------------------------- Question 14: March 10 For those who are intersted you can find the closed form for Fib under extra reading in the homepage. ----------------------------------------------------- Question 13: March 10 Oops (x/y)*z does not need brackets. x/y*z I suppose it could go either way. ----------------------------------------------------- Question 12: March 7 People seem to be having a hard time with putting the minimal brackets into Put. I think it is a useful exercise and I would like everyone to get it (Lets not have any more copying from other people), hence I am going to attempt to give you a hint. First lets do examples. x+y+z+7 does not need brackets. (x+y)*7 does. (x-y)*(x+y) does. 4+x-(y+x) does need brackets. x-y*z does not x-y/z does not x/y*z x/(y*z) What is the pattern? If you are multiplying two things, you need brackets around the first thing if it is a sum, a subtract, or a div, but not if it is a mult eg (y+z) * x, (y-z) * x, y*z * x, y/z * x you need brackets around the second thing if it is a sum or a subtract but not if it is a mult or a div eg x * (y+z), x * (y-z), x * y*z, x * y/z I leave it to you to do the same if you are adding, subtracting, or dividing two things. *** NOTE: IMPORTANT!!!! I added - and / as an after thought to the program and these cause there are lot more cases to consider than I first thought of. They are not so hard. But they should be tested. For full marks on the testing, describe what the cases are and test them. *** NOTE: IMPORTANT!!!! Now for the coding. _*_ / \ + + produces (x+y)*(z+5) / \ / \ x y z 5 When calling Put on the above tree, PutRec gets called recursively many times. Trace out the stack frames that get called. What is the subtree that is passed to each stack frame? Which of these stack frames prints the x, the y, the *, .... ? Which should print the ( )? The stack frame that prints the ( ) must know enough information about the case to know that it needs to be printed. Have fun. ----------------------------------------------------- Question 11: March 6 When proving the correctness of EvalRec for k=0, it is sufficient to show that your program does what it is supposed to do, ie give an error message. ----------------------------------------------------- Question 10: March 5 When you reproduce the triangle, you don't need exactly 60 triangles going around. We just need to see that you have the idea. ----------------------------------------------------- Question 9: March 5 For Eval, you need to check to see whether the string input is a real number. See page 28 if the book. strrealok tells you whether the string is a real. If it is, then strreal converts it into a string. ----------------------------------------------------- Question 8: March 5 > The bug I reported in my last message is apparently specific to using > MacX to remotely log on to Ariel and run OOT. I recommend running recPic from the Ariel lab. ----------------------------------------------------- Question 7: March 5 > After the initial draft, I much prefer fiddling with the numbers. (Jeff) I too was disappointed in how hard it is to accurately place a point. That is why I added the grid points and the X for the mouse. Triangle - I did produce this example last term (before writing the interface) by editing the numbers. Your drawings require only enough accuracy to show you have the idea. (Drawing a circle first and later deleting it helps.) FaceS - I drew this with this interface. (On some versions of oot there is still one ear in the wrong place. Oh well.) SquareC - All the points can be on grid points. This should make the drawing easy. On the other hand, people are free to edit their files. The format is quite straight forward. They are saved in your home directory at the root or (if you create the directory) in the directory recPic. ----------------------------------------------------- Question 6: March 4, 7:30pm For the triangle I cannot get the recurse line to align properly with the other lines -- my hand is not steady enough, my eye not keen enough at the pixel level, and the mouse too erratic. How can I overcome this? Answer: The way I resolved the hand/eye/mouse corrdination problem, was to edit the saved base/nobase file. The file is in ASCII format so I was able to fiddle the numbers to make all the end points align correctly. Further computation/estimation and I was able to adjust the "difficult" triangle vertex to be at a suitable point in the plane. I found this much easier than drawing, once the draft was produced. The coordinates for the lines are stored as for drawline in OOT (surprise :-) -- x1,y1,x2,y2. ----------------------------------------------------- Question 5: March 4, 7:30pm updated March 5, 9:00am The following occurs when remotely logging in to Ariel using MacX. When I am in Edit mode and click the mouse on the upper half of the vertical grid line rising from the right hand end of the handle in the "recurse" side I get the circles from the iteration counts seen in draw mode (in fact if I click on the right handle point the circle for 60 iterations appears). How can I avoid them? Answer: This is a bug in the program apparently recPic does not correctly distinguish modes when the button pressed and detects the button is over an "iteration count" circle. This does not affect the faces reproduction. It affects the square reproduction at the top right hand recursion point. Using align to grid submode and a bit of trial and error and I got the recursion line to draw. For the triangle case see question 6. ----------------------------------------------------- Question 4: March 4, 7:30pm How does one draw an arc in recPic? Answer: The open end of the arc forms a chord of a circle. First click and drag with the left mouse button for the chord. Release the button. Move to the middle of the chord, click and drag the left mouse button to pull the "chord" into an arc. ----------------------------------------------------- Question 3: February 27, 4:30pm Are we supposed to use those debug flags? If so, I don't think we can use without importing the file "Debug.tu" in polyTree.tu which are not to be modified by us. Answer: You do not have to use debug flags for the assignment. It is suggested you may find them useful. You can modify poly.tu by adding an import statment for the Debug module. This is an insignificant change from the perspective of the assignment. Be sure to document such changes. ----------------------------------------------------- Question 2: Has the save a file bug been fixed? Answer: It should be able to save a file now. It will save it either in your home directory or in home/recPic ----------------------------------------------------- Question 1: Where is recPic? I could not find %oot/1030. Answer: The program recPic is now installed in %oot/1030. The oot people fixed their main bug and created two more bugs. - Currently it cannot save a file. - Adding arcs is odd. hold down button move curser lift button --> get a line hold down button move curser lift button --> get an arc Most of the assignment does not depend on recPic. The oot people promise to fix their bug by Monday.