Hey guys,

I'm a newbie to programming and Ruby. I'm just learning about Classes
and wondering about instance variables inside classes.

I'm in the process of making a trading card game and I have a class
called FieldController. Now each player has at least two fields so I
have a total of 4 different instances? of this class.
For example:
class FieldController
  @@space1 = []
  @@space2 = []
  @@space3 = []
  @@space4 = []
  @@space5 = []
  def addcard(para)
    ...
  end
  def removecard
  def list
  etc
end

Problem: Having them as class variables doesn't work when there is
multiple FieldControllers... Instance variables don't seem to work
because I can't access them from within the methods such as addcard.
Normal variables are the same.
Questions:
1. How do I create variables that are specific to that particular
instance of FieldController and can be accessed inside the methods.
2. How can I access the variables from within an object without making a
method as an interface, such as:
$field1 = FieldController.new
puts $field1.space1

The answer is going to be super obvious but I'm a newb so..

Thanks for your time
Joshua

-- 
Posted via http://www.ruby-forum.com/.