From: Paul Smith Date: 2009-12-02T23:17:05+09:00 Subject: Re: Advice - Printing All Options On Wed, Dec 2, 2009 at 1:52 PM, Wood Yee wrote: > Hi! I've set a project for myself but I don't know where to begin > (newbie). Here's what I'm trying to do: > > I'm trying to come up with a drill for my martial arts class where I can > flow from position to position, from top to bottom, and to left and > right. Here's an example: Position 1/being on Top of opponent/Focus on > Left Side. Then go to, say, Position 2/being on Bottom of Opponent/Focus > on Right Side. In other words, I'd like a list of all different > combinations for these 3 areas (Position/Top-Bottom/Left-Right). I've > played around with rand with arrays but can't get what I'm looking for. > Thanks so much! a = [1,2,3] b = ["a","b","c"] c = [7,8,9] a.each {|x| b.each {|y| c.each {|z| puts "#{x}/#{y}/#{z}"}}} There's probably a better way. > -- > Posted via http://www.ruby-forum.com/. > > -- Paul Smith http://www.nomadicfun.co.uk paul@pollyandpaul.co.uk