I'm working on a checkers implementation. I have a class like (only relevant parts shown):
class Game
attr_accessor :current_player
def initialize
@gui = Gui.new
@current_player = :red
end
end
and I have:
class Gui
def move_request
"#{Game.current_player.to_s.upcase} make move(x1, y1, x2, y2): "
end
end
I am getting this error:
gui.rb:8:in `move_request': undefined method `current_player' for Game:Class (NoMethodError)
I don't want to instantiate a new Game object in the Gui class, but I want the Gui class to have access to the current_player instance variable state. Any thoughts on what I should do?