Skip to content

Instantly share code, notes, and snippets.

@timkg
Created October 22, 2012 15:56
Show Gist options
  • Save timkg/3932217 to your computer and use it in GitHub Desktop.
Save timkg/3932217 to your computer and use it in GitHub Desktop.
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