Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Created April 17, 2012 21:29
Show Gist options
  • Save poemdexter/2409178 to your computer and use it in GitHub Desktop.
Save poemdexter/2409178 to your computer and use it in GitHub Desktop.
class FSMBuild
state_machine :initial => :searching_mat do
event :path_found do
transition :searching_mat => :walking_mat, :searching_buildspot => :walking_buildspot
end
event :path_not_found do
transition :searching_mat => same, :searching_buildspot => same
end
event :arrived do
transition :walking_mat => :taking_mat, :walking_buildspot => :placing_mat
end
event :need_more_mats do
transition :placing_mat => :searching_mat
end
event :have_all_mats do
transition :placing_mat => :building
end
event :building_done
transition :building => :done
end
end
def initialize
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment