Created
October 22, 2012 16:12
-
-
Save timkg/3932288 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
function Paper() { | |
} | |
Paper.prototype.beats = function( o ) { | |
return o.beatenByPaper(); | |
}; | |
Paper.prototype.beatenByPaper = function() { | |
return false; | |
}; | |
Paper.prototype.beatenByRock = function() { | |
return false; | |
}; | |
Paper.prototype.beatenByScissors = function() { | |
return true; | |
}; | |
function Rock() { | |
} | |
Rock.prototype.beats = function( o ) { | |
return o.beatenByRock(); | |
}; | |
Rock.prototype.beatenByPaper = function() { | |
return true; | |
}; | |
Rock.prototype.beatenByRock = function() { | |
return false; | |
}; | |
Rock.prototype.beatenByScissors = function() { | |
return false; | |
}; | |
function Scissors() { | |
} | |
Scissors.prototype.beats = function( o ) { | |
return o.beatenByScissors(); | |
}; | |
Scissors.prototype.beatenByPaper = function() { | |
return false; | |
}; | |
Scissors.prototype.beatenByRock = function() { | |
return true; | |
}; | |
Scissors.prototype.beatenByScissors = function() { | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment