Created
April 4, 2011 12:50
-
-
Save mjansen401/901578 to your computer and use it in GitHub Desktop.
AI Abstract Factory
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 UnbeatableFactory | |
def self.create | |
Minimax.new | |
end | |
end | |
class EasyFactory | |
def self.create | |
Random.new | |
end | |
end | |
class AIFactory | |
def create_ai(ai_type) | |
if ai_type == :unbeatable | |
return UnbeatableFactory.create | |
elsif ai_type == :easy | |
return EasyFactory.create | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment