Skip to content

Commit

Permalink
inline unnecessary method.
Browse files Browse the repository at this point in the history
  • Loading branch information
artasparks committed Jun 8, 2016
1 parent 1d31f96 commit e463993
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/rules/goban.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ glift.rules.Goban.prototype = {
* the placement was successful.
*/
addStone: function(pt, color) {
if (!glift.util.colors.isLegalColor(color)) throw "Unknown color: " + color;
if (!(color === glift.enums.states.BLACK ||
color === glift.enums.states.WHITE ||
color === glift.enums.states.EMPTY)) {
throw "Unknown color: " + color;
}

// Add stone fail. Return a failed StoneResult.
if (!this.placeable(pt)) {
Expand Down
10 changes: 4 additions & 6 deletions src/util/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ goog.require('glift.util');
goog.require('glift.enums');

glift.util.colors = {
isLegalColor: function(color) {
return color === glift.enums.states.BLACK ||
color === glift.enums.states.WHITE ||
color === glift.enums.states.EMPTY;
},

/**
* @param {glift.enums.states} color
* @return {glift.enums.states} The opposite color
*/
oppositeColor: function(color) {
if (color === glift.enums.states.BLACK) return glift.enums.states.WHITE;
if (color === glift.enums.states.WHITE) return glift.enums.states.BLACK;
Expand Down

0 comments on commit e463993

Please sign in to comment.