RE: weights of nested containers
- Posted by "Elliott S. de Andrade" <quantum_analyst at hotmail.com> Feb 16, 2004
- 531 views
>From: Michelle Rogers <michellerogers at bellsouth.net> >Subject: weights of nested containers > >I am writing a mud progam in Euphoria. Currently I have each character >with >a certain amount of strength. Depending on their strength, they can pick >up >a certain amount of weight. They can even pick up other characters, if >they >are strong enough to pick up the weight of the other character. > >The way I currently do this is that the weight of the person being picked >up >is evaluated. If they are too heavy, a message is given. If they are not >too heavy, the person picks them up. > <snip> I think what you can do is, when a person picks up something, its weight increases by the weight of the picked up thing. That way, you don't even need check any other objects. When you stop carrying the object, you just decrease the carrier's weight by the object's weight. >But, how do I tell the code to keep checking until I've gotten to the end >of >everyone who's being carried (i.e. the "last generation" of people being >carried)? > Well, you could possibly do some recursive thing, but some people find it somewhat confusing. >hmm...as I actually typed out an explanation..I'm getting a sort of a hazy >idea..so I may figure this out..but I'm still going to post the message, >just in case. > >Michelle Rogers >