Skip to content

Instantly share code, notes, and snippets.

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