bibelwissen/public/javascripts/i-am-not-a-robot.min.js

2 lines
7.3 KiB
JavaScript

// http://g14n.info/i-am-not-a-robot
require=function e(t,n,r){function o(c,u){if(!n[c]){if(!t[c]){var f="function"==typeof require&&require;if(!u&&f)return f(c,!0);if(i)return i(c,!0);var l=new Error("Cannot find module '"+c+"'");throw l.code="MODULE_NOT_FOUND",l}var a=n[c]={exports:{}};t[c][0].call(a.exports,function(e){var n=t[c][1][e];return o(n||e)},a,a.exports,e,t,n,r)}return n[c].exports}for(var i="function"==typeof require&&require,c=0;c<r.length;c++)o(r[c]);return o}({1:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=e("./Component"),f=function(e){function t(e,n,i){r(this,t);var c=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return c.index=i,e.style.float="left",e.style.width="40px",e.style.height="40px",e.style.margin="1px",e.style.borderRadius="3px",e.onclick=function(){n({type:"PLAYER_CHOOSES_CELL",index:i})},c}return i(t,u),c(t,[{key:"render",value:function(e){var t=this.element,n=this.index,r=-1===e.cells.indexOf(n),o=e.cells.indexOf(n)%2==0;r?t.style.backgroundColor="#fff":t.style.background=o?'url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="35" height="35"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g fill="#0194F7"><path d="M22.5335744,17.5 L33.9584004,6.07517407 C35.3398039,4.69377056 35.3458996,2.43406676 33.9559164,1.04408356 C32.5687616,-0.343071308 30.3134373,-0.347011737 28.9248259,1.04159963 L17.5,12.4664256 L6.07517407,1.04159963 C4.69377056,-0.339803881 2.43406676,-0.345899645 1.04408356,1.04408356 C-0.343071308,2.43123842 -0.347011737,4.6865627 1.04159963,6.07517407 L12.4664256,17.5 L1.04159963,28.9248259 C-0.339803881,30.3062294 -0.345899645,32.5659332 1.04408356,33.9559164 C2.43123842,35.3430713 4.6865627,35.3470117 6.07517407,33.9584004 L17.5,22.5335744 L28.9248259,33.9584004 C30.3062294,35.3398039 32.5659332,35.3458996 33.9559164,33.9559164 C35.3430713,32.5687616 35.3470117,30.3134373 33.9584004,28.9248259 L22.5335744,17.5 Z" stroke="none" fill="#0194F7" fill-rule="evenodd"></path></g></g></svg>\') #fff no-repeat center':'url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="35" height="35"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g fill="#e74522"><path d="M17.5,35 C27.1649831,35 35,27.1649831 35,17.5 C35,7.83501688 27.1649831,0 17.5,0 C7.83501688,0 0,7.83501688 0,17.5 C0,27.1649831 7.83501688,35 17.5,35 Z M17.5,27.6171875 C23.0875684,27.6171875 27.6171875,23.0875684 27.6171875,17.5 C27.6171875,11.9124316 23.0875684,7.3828125 17.5,7.3828125 C11.9124316,7.3828125 7.3828125,11.9124316 7.3828125,17.5 C7.3828125,23.0875684 11.9124316,27.6171875 17.5,27.6171875 Z"></path></g></g></svg>\') #fff no-repeat center'}}]),t}();t.exports=f},{"./Component":2}],2:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){r(this,e),this.element=t,this.dispatch=n,this.component={}}return o(e,[{key:"createDiv",value:function(){var e=document.createElement("div");return this.element.appendChild(e),e}},{key:"render",value:function(e,t){var n=this.component;Object.keys(n).forEach(function(r){n[r].render(e,t)})}}]),e}();t.exports=i},{}],3:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=e("./Component"),u=e("./Row"),f=function(e){function t(e,n){r(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),c=i.createDiv.bind(i);return i.component.row1=new u(c(),n,0),i.component.row2=new u(c(),n,3),i.component.row3=new u(c(),n,6),i}return i(t,c),t}();t.exports=f},{"./Component":2,"./Row":4}],4:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=e("./Component"),u=e("./Cell"),f=function(e){function t(e,n,i){r(this,t);var c=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));e.style.clear="both";var f=c.createDiv.bind(c);return c.component.cell1=new u(f(),n,i+0),c.component.cell2=new u(f(),n,i+1),c.component.cell3=new u(f(),n,i+2),c}return i(t,c),t}();t.exports=f},{"./Cell":1,"./Component":2}],5:[function(e,t,n){"use strict";var r=e("./components/Root"),o=e("./reducer");t.exports=function(e,t){function n(e){i=o(i,e,n,t),c(i,n)}var i={isMyTurn:!0,win:!1,cells:[]},c=Function.prototype,u=new r(e,n);c=u.render.bind(u),n({type:"INIT"})}},{"./components/Root":3,"./reducer":6}],6:[function(e,t,n){"use strict";function r(e){for(var t=[],n=e.length-1;n>=0;n-=2)t.push(e[n]);for(var r=0;r<t.length-2;r++)for(var o=r+1;o<t.length-1;o++)for(var c=o+1;c<t.length;c++){var u=[t[r],t[o],t[c]].sort().join("-");if(i.indexOf(u)>-1)return!0}return!1}function o(e){if(-1===e.indexOf(4))return 4;if(3===e.length)for(var t=0;t<9;t++)if(!(e.indexOf(t)>-1)){var n=[e[0],e[2],t].join("-");if(i.indexOf(n)>-1)return t}var r=Math.floor(8*Math.random());return-1===e.indexOf(r)?r:o(e)}var i=["0-1-2","3-4-5","6-7-8","0-3-6","1-4-7","2-5-8","0-4-8","2-4-6"];t.exports=function(e,t,n,i){var c=Object.assign({},e);switch(t.type){case"PLAYER_CHOOSES_CELL":-1===c.cells.indexOf(t.index)&&c.isMyTurn&&(c.cells.push(t.index),c.isMyTurn=!1,setTimeout(function(){n({type:"IS_COMPUTER_TURN"})},1e3));break;case"IS_COMPUTER_TURN":9===c.cells.length||r(c.cells)?i():(c.cells.push(o(c.cells)),c.isMyTurn=!0,r(c.cells)&&i())}return c}},{}],"i-am-not-a-robot":[function(e,t,n){"use strict";n.ticTacToe=e("./src/ticTacToe")},{"./src/ticTacToe":5}]},{},[]);