Created
October 28, 2013 15:25
-
-
Save meaganewaller/7198821 to your computer and use it in GitHub Desktop.
PlayerFactory-SOLID
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
module TicTacToe | |
class PlayerFactory | |
def self.create(input) | |
case input[:type] | |
when :ai | |
AI.new(input[:mark]) | |
when :human | |
Human.new(input[:mark]) | |
else | |
raise "Invalid Player Type" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment