ai-for-shogi-like-games
Version:
javascript library of A.I. algorithms for Shogi-like games
43 lines (33 loc) • 1.52 kB
JavaScript
;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Side = function () {
function Side() {
_classCallCheck(this, Side);
Object.freeze(this);
}
_createClass(Side, [{
key: 'theOther',
value: function theOther() {
if (this === Side.A) return Side.B;
if (this === Side.B) return Side.A;
throw new Error();
}
}, {
key: 'isSideA',
value: function isSideA() {
return this === Side.A;
}
}], [{
key: 'fromWhetherIsSideA',
value: function fromWhetherIsSideA(isSideA) {
if (isSideA) return Side.A;else return Side.B;
}
}]);
return Side;
}();
Side.A = new Side();
Side.B = new Side();
Object.freeze(Side);
exports.Side = Side;
//# sourceMappingURL=side.js.map