From: James Rasmussen Date: 2010-07-19T12:32:15+09:00 Subject: Re: Infinite Loop in Code -- Logic Error Hi, Thanks everyone who's helped out with this. I finally got my original code working, simply by making a rand_array at the same time I was making my original array, thus duplicating the array without duplicating the references to the objects. It seems fascinating to me that (I've looked this up on other people's blogs for reference) http://thingsaaronmade.com/blog/ruby-shallow-copy-surprise.html that duplicating an array of objects using array.dup STILL copies the references to the objects over. There's no such as a "C++" shallow copy in Ruby, because there are no primitive datatypes, and everything is an object. That's why when I changed the boolean value "found" that is a member variable in my persons class, that is found in my original spies array, it changed it in rand_spies as well. In short, I'm slowly learning how to use ruby to solve problems, and learning how to not work against it. It really has some beautiful features and syntax that make me smile whilst sitting at my computer. "wow, did I just do that in one line?" I just need to get used to the nature of the animal. It's different than other languages I've worked in (Java, C++, PHP), and it's actually, in the short time I've been learning it, made me a better programmer in these other languages, because I approach everything in a much more elegant, OO way. Thanks again, James Rasmussen -- Posted via http://www.ruby-forum.com/.