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