Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW5-Fall2005

Trying to figure out how to manipulate your lists of pictures?
This is the figuring-out spot!

Just ask a question, and have a seat. That's right – there is fine.
Good.
Hit Refresh every few minutes. We'll be with you shortly.

Note: In order to do this assignment you need to know how to make copies of nodes. In my case I used the PositionedSceneElement class, and I added this method to it in order to facilitate this:
/* Returns a copy of this PositionedSceneElement */
public PositionedSceneElement makeCopy() {
    return new PositionedSceneElement(this.getPicture());
}
#4

What's tiling? Take a look at http://www.csd.uwo.ca/~morey/CogEng/ You don't have to fill all available space, but make an interesting pattern for the extra credit. Mark Guzdial

Yeah, time to get together and put this hw away... Post the times that'd be good for you. Right now, I'm thinking Tuesday afternoon, anytime after 1:30p at the student center. For info, contact Student157.

it's now 9am and my classes are over for tuesday, so if ya'll wanna go all out and work on it today sometime i'm available whenever. student center works like always.
Student165

i can't meet till like 9pm at teh student center today and then tomorrow i can meet anytime after 12, well 1 so i can eat lunch. Removed at KS request

I'm in the process of making my weave method, and I was using the example in the slides with the trees and dog and house to test it. But, whenever I tried tree1.weave(doggy, 2); I would get an OutOf Bounds error. I decided to try just playing around with some of the other methods to see if maybe something I was typing in the interactions pane was incorrect rather than the actual method, and when I did tree1.insertAfter(doggy); I still got an OutOfBounds error. What could my problem be? Do I need to be trying these things out on longer lists or larger backgrounds or could it be something else I am entering? Student161
An OutOfBounds error is really quite weird to get when doing REMOVEDked Lists! What line was your error at? I'm wondering if something's going wrong with your Pictures, not the nodes. Mark Guzdial

Also, is there a way to get the length of a list? Like is there a method already or anything that will count the number of nodes or something like that? Student161
Good question! The only way to do it is to traverse the entire list, and increment a counter as you go. Something like this: Mark Guzdial
    public int count() {
    LayeredSceneElement current;
    
    current = this;
    int count = 1;
    while (current.getNext() != null)
    {
      count++;
      current = current.getNext();
    };
    return count;
  }


We can use setMedia path right? And also to Summer's question, I would think that it would be because one of the pictures is going outside the frame, but on your slides you have the house going off of the edge so it can't be that.....
Kyle DuPont
Good guess, Kyle! Yes, you can use setMediaPath. Mark Guzdial

I think Kyle was almost right, the house was only partially off screen, but the insertion point was stil on the canvas. If you insert at a number greater than what exists, it'll probably give the out of bounds error.
Student165
Eli could be right – it might be that the starting position has to be within the window boundary. Mark Guzdial

After working on this and looking at what's required, doesn't the weave method need 3 inputs?
Student165
Bwa ha ha! Yes, the one I gave you had three inputs, but for this assignment, you only get two! Mark Guzdial

Is it alright to inherit from picture so that we can access some of those methods?
Kyle DuPont
Yes, you could inherit from picture, but no, that won't help you at all. If you have a picture, you can ask it to perform any of those methods. So why would it help you to inherit from Picture? Mark Guzdial


Umm i sort of got my weave working. but i'm kinda stuck. It works when i want to weave in every 3 or 4 or whatever above 2, but when i weave in every 2 i get an out of memory error. everything else works though!
Kyle DuPont

Out of Memory?!? Wow, that's pretty weird. I'm wondering if you might be accidentally creating a loop? If node1 points to node2 that points to node1 that points to node2, etc., you can imagine some traversals running out of memory before finishing. That's my best guess – feel free to send me your code to look at or come see me at office hours (where I sit here...by myself...nobody visiting...) Mark Guzdial


FYI – I saw Kyle's code. Don't try to weave in a node that's already in your list. You may recall that we talked through that problem in class in response to a question. If the node is already in the list, weaving in a bunch of copies of it creates all kinds of odd loops, which will lead to out of memory errors when you try to get to last(). Mark Guzdial

thanks All finished! yay! that homework was tough
Kyle DuPont

If anyone was looking for me 1-1:30 Friday, I'm sorry. I was late. Here now (1:5 pm Friday). Mark Guzdial


do we need to turn in our pictures that we use?

Yes, please! Makes it easy for Sebastian to test. Mark Guzdial

Did anybody make any cool tilings? Mark Guzdial




Link to this Page