From: Dan __ Date: 2008-06-30T12:02:59+09:00 Subject: Re: Recursive Logic - Examples and Resources? Thanks Ian, Erik and Axel for your replies :) I'll get to giving them all the time they deserve next chance I get (probably tomorrow after work). However, since I was rather vague in my initial description of the problem (as Ian and Erik pointed out), I'll try to describe it better now, without writing a hugely long message. Basically, what I'm trying to do is design an app to help out with a game I play. Its a nation simulation game, where every player controls a nation, and each nation gets two resources (I used numbers to represent the resources in the example for simplicity). Each nation can trade with up to five other nations, and gain the effects of the resources of the other nations. In this game, there are a few ideal combinations of resources, which give much better effects than other combinations. So for my app, each User object would contain information about which two resources a player has. The app will check through all the stored User objects (in a database somewhere), and try and put together six User objects (I used five in the example, I know) whose resources make one of the ideal resource sets. The number of User objects in the app at one time should only be a couple hundred at most, and unless the game undergoes a huge boom in the player base, I shouldn't need to worry about expansion of that number. Ian is correct in that the number of users is finite and fixed, at least at any time during which a check for resource combinations is taking place, and that a user object can be removed from a set if a solution can't be reached with that user. The user's first number may not always be less than their second number the way things are set up now, but if that simplifies things, I can make it so that becomes the case. Thanks very much to everyone who's replied so far, and I'll make sure I give each solution a try after I get home from work tomorrow :) -- Posted via http://www.ruby-forum.com/.