-
-
Save jfarmer/f0a6339d17e837444a09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actors = [Actor.new('Steve Johnson'), Actor.new('George Hamilton'), Actor.new('Rose Smith')] | |
coodinator = Coordinator.new('Sue Case') | |
play = Play.new :name => 'Hamlet', | |
:actors => actors, | |
:coordinator => coordinator | |
real_blocking = play.blocking | |
actors.each do |actor| | |
actor.give_blocking(real_blocking) | |
end | |
coordinator.give_blocking(real_blocking) | |
# We're not reading lines, we're just practicing our blocking. | |
# Everyone remembers the script perfectly, but some people misremember the blocking. | |
until play.finished? | |
play.each_line do |line| | |
play.actors.each do |actor| | |
# Actor moves to where he's supposed to be for the next line | |
actor.move_to_line_position(line) | |
if coordinator.sees_wrong_position_for?(actor, line) | |
coordinator.scramble_to_update_lights! | |
coordinator.yell_at(actor, line) | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Play | |
attr_reader :name, :actors, :coordinator | |
attr_reader :blocking | |
def initialize(opts = {}) | |
@name = opts[:name] | |
@actors = opts[:actors] | |
@coordinator = opts[:coordinator] | |
# The "real" blocking | |
@blocking = Blocking.new | |
end | |
def each_line | |
# iterates over the lines, blah blah | |
end | |
end | |
class Person | |
attr_reader :name, :blocking | |
def initialize(name) | |
@name = name | |
end | |
def give_blocking(blocking) | |
# A perhaps-misremembered version of the blocking | |
@blocking = BlockingMemory.new(blocking, self) | |
end | |
def give_feedback(feedback) | |
if feedback.about_blocking? | |
self.blocking.update_position_at feedback.line, feedback.expected_position | |
end | |
end | |
end | |
class Feedback | |
def initialize(opts = {}) | |
@positive = opts[:positive] | |
@topic = opts[:topic] | |
end | |
def positive? | |
@positive | |
end | |
def about_blocking? | |
@topic == 'Blocking' | |
end | |
end | |
class Actor < Person | |
attr_reader :position | |
def move_to!(position) | |
@position = position | |
end | |
def position_at(line) | |
self.blocking.position_at(line) | |
end | |
def move_to_line_position(line) | |
if self.position != self.position_at(line) | |
self.move_to! self.position_at(line) | |
end | |
end | |
end | |
class Coordinator < Person | |
def sees_wrong_position_for?(actor, line) | |
actor.position != self.blocking.expected_position_for(actor, line) | |
end | |
def scramble_to_update_lights! | |
end | |
def yell_at(person, line) | |
expected_position = self.blocking.expected_position_for(actor, line) | |
feedback = Feedback.new :positive => false, | |
:topic => 'Blocking', | |
:line => line, | |
:expected_position => expected_position | |
person.give_feedback(feedback) | |
end | |
end | |
class Blocking | |
def position_at(actor, line) | |
# return expected position for a particular actor at a particular line | |
end | |
end | |
class BlockingMemory | |
def initialize(actor, blocking) | |
@actor = actor | |
@blocking = blocking | |
end | |
# Where I remember myself to be at a particular line | |
def position_at(line) | |
expected_position_for(self.actor, line) | |
end | |
# Where I remember arbitrary people to be at a particular line | |
def expected_position_for(person, line) | |
expected_position = self.blocking.position_at(person, line) | |
# maybe add some noise here to simulate mis-remembering | |
return remembered_position | |
end | |
def update_position_at(line, expected_position) | |
# correct the memory for line/expected_position, for my associated person | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment