diff --git a/10.bootstrap.js b/10.bootstrap.js index 3a16db9..5ba9a7c 100644 --- a/10.bootstrap.js +++ b/10.bootstrap.js @@ -1,2 +1,2 @@ -(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,e,r)=>{"use strict";r.a(t,(async n=>{r.d(e,{wc:()=>x,SZ:()=>I,i0:()=>S,Tt:()=>E,rh:()=>B,lA:()=>O,Ck:()=>q,ug:()=>C,h4:()=>U,h9:()=>R,Dz:()=>$,kF:()=>D,U5:()=>M,r2:()=>P,iY:()=>z,mS:()=>F,XP:()=>J,yX:()=>Y,ae:()=>Z,Os:()=>L,DA:()=>N,s8:()=>Q,WB:()=>V,cP:()=>H,a:()=>X,l_:()=>K,U_:()=>G,EN:()=>tt,qu:()=>et,Wg:()=>rt,B3:()=>nt,I6:()=>_t,Qb:()=>at,cI:()=>ct,QK:()=>ot,Md:()=>it,ox:()=>st,ES:()=>ut,Ae:()=>lt,UL:()=>pt,qw:()=>dt,tS:()=>bt,R$:()=>gt,md:()=>ht,IF:()=>wt,zP:()=>ft,td:()=>mt,Ct:()=>vt,uQ:()=>yt,RV:()=>kt,sy:()=>xt,m_:()=>Tt,fY:()=>It,Or:()=>St,oH:()=>Et});var _=r(813);t=r.hmd(t);var a=n([_]);_=(a.then?await a:a)[0];const c=new Array(32).fill(void 0);function o(t){return c[t]}c.push(void 0,null,!0,!1);let i=c.length;let s=new("undefined"==typeof TextDecoder?(0,t.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});s.decode();let u=null;function l(){return null!==u&&u.buffer===_.memory.buffer||(u=new Uint8Array(_.memory.buffer)),u}function p(t,e){return s.decode(l().subarray(t,t+e))}function d(t){i===c.length&&c.push(c.length+1);const e=i;return i=c[e],c[e]=t,e}function b(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return`${t}`;if("string"==e)return`"${t}"`;if("symbol"==e){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==e){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const e=t.length;let r="[";e>0&&(r+=b(t[0]));for(let n=1;n1))return toString.call(t);if(n=r[1],"Object"==n)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:n}let g=0,h=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const w="function"==typeof h.encodeInto?function(t,e){return h.encodeInto(t,e)}:function(t,e){const r=h.encode(t);return e.set(r),{read:t.length,written:r.length}};function f(t,e,r){if(void 0===r){const r=h.encode(t),n=e(r.length);return l().subarray(n,n+r.length).set(r),g=r.length,n}let n=t.length,_=e(n);const a=l();let c=0;for(;c127)break;a[_+c]=e}if(c!==n){0!==c&&(t=t.slice(c)),_=r(_,n,n=c+3*t.length);const e=l().subarray(_+c,_+n);c+=w(t,e).written}return g=c,_}let m=null;function v(){return null!==m&&m.buffer===_.memory.buffer||(m=new Int32Array(_.memory.buffer)),m}function y(t){return null==t}function k(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`);return t.ptr}function x(){_.init_wasm()}function T(t,e){try{return t.apply(this,e)}catch(t){_.__wbindgen_exn_store(d(t))}}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"});const I=Object.freeze({Black:0,0:"Black",White:1,1:"White"}),S=(Object.freeze({Man:0,0:"Man",King:1,1:"King"}),Object.freeze({Empty:0,0:"Empty",Occupied:1,1:"Occupied",Unplayable:2,2:"Unplayable"})),E=Object.freeze({Allowed:0,0:"Allowed",UnoccupiedSrc:1,1:"UnoccupiedSrc",OccupiedDest:2,2:"OccupiedDest",OutOfBounds:3,3:"OutOfBounds",Unplayable:4,4:"Unplayable",WrongTeamSrc:5,5:"WrongTeamSrc",IllegalTrajectory:6,6:"IllegalTrajectory",NoJumpablePiece:7,7:"NoJumpablePiece",JumpingSameTeam:8,8:"JumpingSameTeam"});class j{static __wrap(t){const e=Object.create(j.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_board_free(t)}get width(){return _.__wbg_get_board_width(this.ptr)>>>0}set width(t){_.__wbg_set_board_width(this.ptr,t)}get height(){return _.__wbg_get_board_height(this.ptr)>>>0}set height(t){_.__wbg_set_board_height(this.ptr,t)}get current_turn(){return _.__wbg_get_board_current_turn(this.ptr)>>>0}set current_turn(t){_.__wbg_set_board_current_turn(this.ptr,t)}cell(t){var e=_.board_cell(this.ptr,t);return A.__wrap(e)}set_cell(t,e){k(e,A);var r=e.ptr;e.ptr=0,_.board_set_cell(this.ptr,t,r)}grid_cell(t){k(t,B);var e=t.ptr;t.ptr=0;var r=_.board_grid_cell(this.ptr,e);return A.__wrap(r)}cell_index(t,e){return _.board_cell_index(this.ptr,t,e)>>>0}cell_idx(t){k(t,B);var e=t.ptr;return t.ptr=0,_.board_cell_idx(this.ptr,e)>>>0}board_index(t){var e=_.board_board_index(this.ptr,t);return B.__wrap(e)}can_move(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;return e.ptr=0,_.board_can_move(this.ptr,r,n)>>>0}validate_man_move(t,e,r){k(t,B);var n=t.ptr;t.ptr=0,k(e,B);var a=e.ptr;e.ptr=0,k(r,W);var c=r.ptr;return r.ptr=0,_.board_validate_man_move(this.ptr,n,a,c)>>>0}validate_king_move(t,e,r){k(t,B);var n=t.ptr;t.ptr=0,k(e,B);var a=e.ptr;e.ptr=0,k(r,W);var c=r.ptr;return r.ptr=0,_.board_validate_king_move(this.ptr,n,a,c)>>>0}jumpee_idx(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;return e.ptr=0,_.board_jumpee_idx(this.ptr,r,n)>>>0}cells(){return _.board_cells(this.ptr)}num_cells(){return _.board_num_cells(this.ptr)>>>0}num_pieces(){return _.board_num_pieces(this.ptr)>>>0}num_player(t){return _.board_num_player(this.ptr,t)>>>0}score(){return _.board_score(this.ptr)}cell_state(t){return _.board_cell_state(this.ptr,t)>>>0}apply_move(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;e.ptr=0;var a=_.board_apply_move(this.ptr,r,n);return j.__wrap(a)}apply_jump(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;e.ptr=0;var a=_.board_apply_jump(this.ptr,r,n);return j.__wrap(a)}king_row_idx(){return _.board_king_row_idx(this.ptr)>>>0}static validate_jumpee(t,e){k(t,A);var r=t.ptr;t.ptr=0,k(e,W);var n=e.ptr;return e.ptr=0,_.board_validate_jumpee(r,n)>>>0}static check_jumpee_team(t,e){k(t,W);var r=t.ptr;t.ptr=0,k(e,W);var n=e.ptr;return e.ptr=0,0!==_.board_check_jumpee_team(r,n)}constructor(t,e,r){var n=_.board_new(t,e,r);return j.__wrap(n)}static init_game(t,e){k(t,j);var r=t.ptr;t.ptr=0;var n=_.board_init_game(r,e);return j.__wrap(n)}}class B{static __wrap(t){const e=Object.create(B.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_brdidx_free(t)}get row(){return _.__wbg_get_brdidx_row(this.ptr)>>>0}set row(t){_.__wbg_set_brdidx_row(this.ptr,t)}get col(){return _.__wbg_get_brdidx_col(this.ptr)>>>0}set col(t){_.__wbg_set_brdidx_col(this.ptr,t)}constructor(t,e){var r=_.brdidx_from(t,e);return B.__wrap(r)}eq(t){return k(t,B),0!==_.brdidx_eq(this.ptr,t.ptr)}}class O{static __wrap(t){const e=Object.create(O.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_game_free(t)}get last_node_count(){return _.__wbg_get_game_last_node_count(this.ptr)>>>0}set last_node_count(t){_.__wbg_set_game_last_node_count(this.ptr,t)}current_board_cells(){return _.game_current_board_cells(this.ptr)}current_board_len(){return _.game_current_board_len(this.ptr)>>>0}current_turn(){return _.game_current_turn(this.ptr)>>>0}score(){return _.game_score(this.ptr)}winning(){var t=_.game_winning(this.ptr);return 2===t?void 0:t}has_won(){var t=_.game_has_won(this.ptr);return 2===t?void 0:t}current_cell_state(t){k(t,B);var e=_.game_current_cell_state(this.ptr,t.ptr);return A.__wrap(e)}set_search_depth(t){_.game_set_search_depth(this.ptr,t)}set_selected(t){k(t,B),_.game_set_selected(this.ptr,t.ptr)}clear_selected(){_.game_clear_selected(this.ptr)}make_move(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;return e.ptr=0,_.game_make_move(this.ptr,r,n)>>>0}execute_move(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;e.ptr=0,_.game_execute_move(this.ptr,r,n)}execute_jump(t,e){k(t,B);var r=t.ptr;t.ptr=0,k(e,B);var n=e.ptr;e.ptr=0,_.game_execute_jump(this.ptr,r,n)}push_new_board(t){k(t,j);var e=t.ptr;t.ptr=0,_.game_push_new_board(this.ptr,e)}set_current(t){k(t,j);var e=t.ptr;t.ptr=0,_.game_set_current(this.ptr,e)}constructor(t,e,r,n,a){var c=_.game_new(t,e,r,n,a);return O.__wrap(c)}static new_with_canvas(t,e,r,n,a,c,o,i){var s=f(c,_.__wbindgen_malloc,_.__wbindgen_realloc),u=g,l=_.game_new_with_canvas(t,e,r,n,a,s,u,o,i);return O.__wrap(l)}set_painter(t){k(t,q);var e=t.ptr;t.ptr=0,_.game_set_painter(this.ptr,e)}draw(){_.game_draw(this.ptr)}ai_move(){_.game_ai_move(this.ptr)}}class q{static __wrap(t){const e=Object.create(q.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_painter_free(t)}constructor(t,e,r){var n=f(r,_.__wbindgen_malloc,_.__wbindgen_realloc),a=g,c=_.painter_new(t,e,n,a);return q.__wrap(c)}static new_with_canvas(t,e,r){var n=_.painter_new_with_canvas(t,e,d(r));return q.__wrap(n)}set_square_outline(t){_.painter_set_square_outline(this.ptr,d(t))}set_outline_width(t){_.painter_set_outline_width(this.ptr,t)}set_draw_outline(t){_.painter_set_draw_outline(this.ptr,t)}reset_dimensions(){_.painter_reset_dimensions(this.ptr)}validate_board_dim(t){return k(t,j),0!==_.painter_validate_board_dim(this.ptr,t.ptr)}draw(t){k(t,j),_.painter_draw(this.ptr,t.ptr)}}class W{static __wrap(t){const e=Object.create(W.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_piece_free(t)}get team(){return _.__wbg_get_piece_team(this.ptr)>>>0}set team(t){_.__wbg_set_piece_team(this.ptr,t)}get strength(){return _.__wbg_get_piece_strength(this.ptr)>>>0}set strength(t){_.__wbg_set_piece_strength(this.ptr,t)}constructor(t,e){var r=_.piece_new(t,e);return W.__wrap(r)}}class A{static __wrap(t){const e=Object.create(A.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_square_free(t)}get occupant(){var t=_.__wbg_get_square_occupant(this.ptr);return 0===t?void 0:W.__wrap(t)}set occupant(t){let e=0;y(t)||(k(t,W),e=t.ptr,t.ptr=0),_.__wbg_set_square_occupant(this.ptr,e)}get state(){return _.__wbg_get_square_state(this.ptr)>>>0}set state(t){_.__wbg_set_square_state(this.ptr,t)}constructor(t,e){let r=0;y(e)||(k(e,W),r=e.ptr,e.ptr=0);var n=_.square_new(t,r);return A.__wrap(n)}static pc(t,e){var r=_.square_pc(t,e);return A.__wrap(r)}static empty(){var t=_.square_empty();return A.__wrap(t)}static unplay(){var t=_.square_unplay();return A.__wrap(t)}}function C(t){!function(t){const e=o(t);(function(t){t<36||(c[t]=i,i=t)})(t)}(t)}function U(t,e){return d(p(t,e))}function R(){return d(new Error)}function $(t,e){var r=f(o(e).stack,_.__wbindgen_malloc,_.__wbindgen_realloc),n=g;v()[t/4+1]=n,v()[t/4+0]=r}function D(t,e){try{console.error(p(t,e))}finally{_.__wbindgen_free(t,e)}}function M(){return T((function(){return d(self.self)}),arguments)}function P(t,e,r){return d(o(t).require(p(e,r)))}function z(t){return d(o(t).crypto)}function F(t){return d(o(t).msCrypto)}function J(t){return void 0===o(t)}function Y(t){return d(o(t).getRandomValues)}function Z(t,e){o(t).getRandomValues(o(e))}function L(t,e,r){var n,_;o(t).randomFillSync((n=e,_=r,l().subarray(n/1,n/1+_)))}function N(){return d(t)}function Q(t){return o(t)instanceof Window}function V(t){var e=o(t).document;return y(e)?0:d(e)}function H(t,e,r){var n=o(t).getElementById(p(e,r));return y(n)?0:d(n)}function X(t){console.log(o(t))}function K(t){return o(t)instanceof CanvasRenderingContext2D}function G(t,e){o(t).strokeStyle=o(e)}function tt(t,e){o(t).fillStyle=o(e)}function et(t,e){o(t).lineWidth=e}function rt(t){o(t).beginPath()}function nt(t){o(t).fill()}function _t(t){o(t).stroke()}function at(){return T((function(t,e,r,n,_,a){o(t).arc(e,r,n,_,a)}),arguments)}function ct(t,e,r,n,_){o(t).fillRect(e,r,n,_)}function ot(t,e,r,n,_){o(t).strokeRect(e,r,n,_)}function it(t){return o(t)instanceof HTMLCanvasElement}function st(t,e){o(t).width=e>>>0}function ut(t,e){o(t).height=e>>>0}function lt(){return T((function(t,e,r){var n=o(t).getContext(p(e,r));return y(n)?0:d(n)}),arguments)}function pt(t,e){return d(new Function(p(t,e)))}function dt(){return T((function(t,e){return d(o(t).call(o(e)))}),arguments)}function bt(){return T((function(){return d(self.self)}),arguments)}function gt(){return T((function(){return d(window.window)}),arguments)}function ht(){return T((function(){return d(globalThis.globalThis)}),arguments)}function wt(){return T((function(){return d(r.g.global)}),arguments)}function ft(t){return d(o(t).buffer)}function mt(t){return d(new Uint8Array(o(t)))}function vt(t,e,r){o(t).set(o(e),r>>>0)}function yt(t){return o(t).length}function kt(t){return d(new Uint8Array(t>>>0))}function xt(t,e,r){return d(o(t).subarray(e>>>0,r>>>0))}function Tt(t){return d(o(t))}function It(t,e){var r=f(b(o(e)),_.__wbindgen_malloc,_.__wbindgen_realloc),n=g;v()[t/4+1]=n,v()[t/4+0]=r}function St(t,e){throw new Error(p(t,e))}function Et(){return d(_.memory)}}))},813:(t,e,r)=>{"use strict";var n=([n])=>r.v(e,t.id,"a9e080695052ab7978e6",{"./draught_bg.js":{__wbindgen_object_drop_ref:n.ug,__wbindgen_string_new:n.h4,__wbg_new_59cb74e423758ede:n.h9,__wbg_stack_558ba5917b466edd:n.Dz,__wbg_error_4bb6c2a97407129a:n.kF,__wbg_self_86b4b13392c7af56:n.U5,__wbg_require_f5521a5b85ad2542:n.r2,__wbg_crypto_b8c92eaac23d0d80:n.iY,__wbg_msCrypto_9ad6677321a08dd8:n.mS,__wbindgen_is_undefined:n.XP,__wbg_getRandomValues_dd27e6b0652b3236:n.yX,__wbg_getRandomValues_e57c9b75ddead065:n.ae,__wbg_randomFillSync_d2ba53160aec6aba:n.Os,__wbg_static_accessor_MODULE_452b4680e8614c81:n.DA,__wbg_instanceof_Window_11e25482011fc506:n.s8,__wbg_document_5aff8cd83ef968f5:n.WB,__wbg_getElementById_b180ea4ada06a837:n.cP,__wbg_log_9a99fb1af846153b:n.a,__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b:n.l_,__wbg_setstrokeStyle_2939ee453716e462:n.U_,__wbg_setfillStyle_af790b5baf4d3210:n.EN,__wbg_setlineWidth_3e6b1837ae38d099:n.qu,__wbg_beginPath_2378575e37027ad3:n.Wg,__wbg_fill_558339447ed6ad43:n.B3,__wbg_stroke_c1e0313c58997dcf:n.I6,__wbg_arc_fffd87d9113dce32:n.Qb,__wbg_fillRect_46ffc8d2cef7e298:n.cI,__wbg_strokeRect_7ea34fad8a7f0fe2:n.QK,__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792:n.Md,__wbg_setwidth_f3c88eb520ba8d47:n.ox,__wbg_setheight_5a1abba41e35c42a:n.ES,__wbg_getContext_813df131fcbd6e91:n.Ae,__wbg_newnoargs_9fdd8f3961dd1bee:n.UL,__wbg_call_ba36642bd901572b:n.qw,__wbg_self_bb69a836a72ec6e9:n.tS,__wbg_window_3304fc4b414c9693:n.R$,__wbg_globalThis_e0d21cabc6630763:n.md,__wbg_global_8463719227271676:n.IF,__wbg_buffer_9e184d6f785de5ed:n.zP,__wbg_new_e8101319e4cf95fc:n.td,__wbg_set_e8ae7b27314e8b98:n.Ct,__wbg_length_2d56cb37075fcfb1:n.uQ,__wbg_newwithlength_a8d1dbcbe703a5c6:n.RV,__wbg_subarray_901ede8318da52a6:n.sy,__wbindgen_object_clone_ref:n.m_,__wbindgen_debug_string:n.fY,__wbindgen_throw:n.Or,__wbindgen_memory:n.oH}});r.a(t,(t=>{var e=t([r(171)]);return e.then?e.then(n):n(e)}),1)},10:(t,e,r)=>{"use strict";r.a(t,(async t=>{r.r(e);var n=r(171),_=t([n]);n=(_.then?await _:_)[0];var a=8,c=8,o=3,i=4;const s="human_turn.thinking",u="human_turn.from_selected";(0,n.wc)(),document.getElementById("status-p");const l=document.getElementById("status-d"),p=document.getElementById("team-p"),d=document.getElementById("node-count"),b=document.getElementById("winning-p");document.getElementById("startBtn").onclick=x;let g=null,h=null,w=function(t,e="danger",r=!0){null!=h&&clearInterval(h),l.className=`alert alert-${e}`,l.innerText=t,l.hidden=!1,r&&(h=setTimeout((()=>{l.hidden=!0}),3e3))},f=s,m=null,v=null,y=[];x();const k=document.getElementById("game-canvas");function x(){m=new n.lA(a,c,o,n.SZ.Black,i),v=new n.Ck(720,720,"game-canvas"),m.set_painter(v),m.draw(),clearInterval(g),T(),I(),y=[],f=s}function T(){switch(m.current_turn()){case n.SZ.White:p.innerText="⚪ White ⚪";break;case n.SZ.Black:p.innerText="🔴 Black 🔴"}}function I(){switch(m.winning()){case void 0:b.innerText="";break;case n.SZ.White:b.innerText="👑 White 👑";break;case n.SZ.Black:b.innerText="👑 Black 👑"}}k.addEventListener("click",(t=>{var e=function(t,e){var r=t.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}}(k,t);!function(t){switch(f){case s:if(m.current_cell_state(t).state!=n.i0.Occupied)return;if(m.current_cell_state(t).occupant.team!=m.current_turn())return;y.push(t),f=u,m.set_selected(t),m.draw();break;case u:if(!y[0].eq(t)){if(m.current_cell_state(t).state!=n.i0.Empty)return;if(y.push(t),2!=y.length)return w(`Error: wrong number of clicks to process ${y.length}`),void console.error(`Error: wrong number of clicks to process ${y.length}`);switch(m.make_move(y[0],y[1])){case n.Tt.Allowed:O.checked&&(m.ai_move(),d.innerText=`searched ${m.last_node_count.toLocaleString("en-GB")} possible moves`);break;case n.Tt.IllegalTrajectory:w("You can't move like that!");break;case n.Tt.JumpingSameTeam:w("You can't jump your own piece!");break;case n.Tt.NoJumpablePiece:w("There's nothing to jump!");break;case n.Tt.OccupiedDest:w("There's a piece there!");break;case n.Tt.OutOfBounds:w("That square's not on the board! (how have you managed that?)");break;case n.Tt.UnoccupiedSrc:w("There's no piece to move!");break;case n.Tt.Unplayable:w("That's not a playable square!");break;case n.Tt.WrongTeamSrc:w("That's not your piece!")}}m.clear_selected(),m.draw(),y=[],f=s;break;case"ai_turn":console.log("It's the AI's turn!")}T(),I(),function(){switch(m.has_won()){case void 0:break;case n.SZ.White:w("You Lost!"),g=setInterval((()=>{x()}),3e3);break;case n.SZ.Black:w("You Won!","success"),g=setInterval((()=>{x()}),3e3)}}()}(new n.rh(Math.floor(e.y/k.clientHeight*c),Math.floor(e.x/k.clientWidth*a)))}));const S=document.getElementById("width");S.onchange=()=>{a=parseInt(S.value),x()},S.value=8;const E=document.getElementById("height");E.onchange=()=>{c=parseInt(E.value),j.max=c/2-1,x()},E.value=8;const j=document.getElementById("play_rows");j.onchange=()=>{o=parseInt(j.value),x()},j.value=3;const B=document.getElementById("ai_search_depth");B.onchange=()=>{i=parseInt(B.value),m.set_search_depth(i),i>4&&w("This increases thinking time exponentially, be careful (probably don't go past 6)","warning")},B.value=4;const O=document.getElementById("ai-checkbox");O.onchange=()=>{}}))}}]); +(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,e,r)=>{"use strict";r.a(t,(async n=>{r.d(e,{wc:()=>x,SZ:()=>I,i0:()=>E,Tt:()=>S,rh:()=>j,lA:()=>O,Ck:()=>q,ug:()=>C,h4:()=>U,h9:()=>R,Dz:()=>$,kF:()=>D,U5:()=>M,r2:()=>P,iY:()=>z,mS:()=>F,XP:()=>J,yX:()=>Y,ae:()=>Z,Os:()=>L,DA:()=>N,s8:()=>Q,WB:()=>V,cP:()=>H,ck:()=>X,a:()=>K,l_:()=>G,U_:()=>tt,EN:()=>et,qu:()=>rt,Wg:()=>nt,B3:()=>_t,I6:()=>at,Qb:()=>ct,cI:()=>ot,QK:()=>it,Md:()=>st,ox:()=>ut,ES:()=>lt,Ae:()=>pt,UL:()=>dt,qw:()=>gt,tS:()=>bt,R$:()=>ht,md:()=>ft,IF:()=>wt,zP:()=>mt,td:()=>vt,Ct:()=>yt,uQ:()=>kt,RV:()=>xt,sy:()=>Tt,m_:()=>It,fY:()=>Et,Or:()=>St,oH:()=>Bt});var _=r(813);t=r.hmd(t);var a=n([_]);_=(a.then?await a:a)[0];const c=new Array(32).fill(void 0);function o(t){return c[t]}c.push(void 0,null,!0,!1);let i=c.length;let s=new("undefined"==typeof TextDecoder?(0,t.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});s.decode();let u=null;function l(){return null!==u&&u.buffer===_.memory.buffer||(u=new Uint8Array(_.memory.buffer)),u}function p(t,e){return s.decode(l().subarray(t,t+e))}function d(t){i===c.length&&c.push(c.length+1);const e=i;return i=c[e],c[e]=t,e}function g(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return`${t}`;if("string"==e)return`"${t}"`;if("symbol"==e){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==e){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const e=t.length;let r="[";e>0&&(r+=g(t[0]));for(let n=1;n1))return toString.call(t);if(n=r[1],"Object"==n)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:n}let b=0,h=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const f="function"==typeof h.encodeInto?function(t,e){return h.encodeInto(t,e)}:function(t,e){const r=h.encode(t);return e.set(r),{read:t.length,written:r.length}};function w(t,e,r){if(void 0===r){const r=h.encode(t),n=e(r.length);return l().subarray(n,n+r.length).set(r),b=r.length,n}let n=t.length,_=e(n);const a=l();let c=0;for(;c127)break;a[_+c]=e}if(c!==n){0!==c&&(t=t.slice(c)),_=r(_,n,n=c+3*t.length);const e=l().subarray(_+c,_+n);c+=f(t,e).written}return b=c,_}let m=null;function v(){return null!==m&&m.buffer===_.memory.buffer||(m=new Int32Array(_.memory.buffer)),m}function y(t){return null==t}function k(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`);return t.ptr}function x(){_.init_wasm()}function T(t,e){try{return t.apply(this,e)}catch(t){_.__wbindgen_exn_store(d(t))}}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"});const I=Object.freeze({Black:0,0:"Black",White:1,1:"White"}),E=(Object.freeze({Man:0,0:"Man",King:1,1:"King"}),Object.freeze({Empty:0,0:"Empty",Occupied:1,1:"Occupied",Unplayable:2,2:"Unplayable"})),S=Object.freeze({Allowed:0,0:"Allowed",UnoccupiedSrc:1,1:"UnoccupiedSrc",OccupiedDest:2,2:"OccupiedDest",OutOfBounds:3,3:"OutOfBounds",Unplayable:4,4:"Unplayable",WrongTeamSrc:5,5:"WrongTeamSrc",IllegalTrajectory:6,6:"IllegalTrajectory",NoJumpablePiece:7,7:"NoJumpablePiece",JumpingSameTeam:8,8:"JumpingSameTeam"});class B{static __wrap(t){const e=Object.create(B.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_board_free(t)}get width(){return _.__wbg_get_board_width(this.ptr)>>>0}set width(t){_.__wbg_set_board_width(this.ptr,t)}get height(){return _.__wbg_get_board_height(this.ptr)>>>0}set height(t){_.__wbg_set_board_height(this.ptr,t)}get current_turn(){return _.__wbg_get_board_current_turn(this.ptr)>>>0}set current_turn(t){_.__wbg_set_board_current_turn(this.ptr,t)}cell(t){var e=_.board_cell(this.ptr,t);return A.__wrap(e)}set_cell(t,e){k(e,A);var r=e.ptr;e.ptr=0,_.board_set_cell(this.ptr,t,r)}grid_cell(t){k(t,j);var e=t.ptr;t.ptr=0;var r=_.board_grid_cell(this.ptr,e);return A.__wrap(r)}cell_index(t,e){return _.board_cell_index(this.ptr,t,e)>>>0}cell_idx(t){k(t,j);var e=t.ptr;return t.ptr=0,_.board_cell_idx(this.ptr,e)>>>0}board_index(t){var e=_.board_board_index(this.ptr,t);return j.__wrap(e)}can_move(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;return e.ptr=0,_.board_can_move(this.ptr,r,n)>>>0}validate_man_move(t,e,r){k(t,j);var n=t.ptr;t.ptr=0,k(e,j);var a=e.ptr;e.ptr=0,k(r,W);var c=r.ptr;return r.ptr=0,_.board_validate_man_move(this.ptr,n,a,c)>>>0}validate_king_move(t,e,r){k(t,j);var n=t.ptr;t.ptr=0,k(e,j);var a=e.ptr;e.ptr=0,k(r,W);var c=r.ptr;return r.ptr=0,_.board_validate_king_move(this.ptr,n,a,c)>>>0}jumpee_idx(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;return e.ptr=0,_.board_jumpee_idx(this.ptr,r,n)>>>0}cells(){return _.board_cells(this.ptr)}num_cells(){return _.board_num_cells(this.ptr)>>>0}num_pieces(){return _.board_num_pieces(this.ptr)>>>0}num_player(t){return _.board_num_player(this.ptr,t)>>>0}score(){return _.board_score(this.ptr)}cell_state(t){return _.board_cell_state(this.ptr,t)>>>0}apply_move(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;e.ptr=0;var a=_.board_apply_move(this.ptr,r,n);return B.__wrap(a)}apply_jump(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;e.ptr=0;var a=_.board_apply_jump(this.ptr,r,n);return B.__wrap(a)}king_row_idx(){return _.board_king_row_idx(this.ptr)>>>0}static validate_jumpee(t,e){k(t,A);var r=t.ptr;t.ptr=0,k(e,W);var n=e.ptr;return e.ptr=0,_.board_validate_jumpee(r,n)>>>0}static check_jumpee_team(t,e){k(t,W);var r=t.ptr;t.ptr=0,k(e,W);var n=e.ptr;return e.ptr=0,0!==_.board_check_jumpee_team(r,n)}constructor(t,e,r){var n=_.board_new(t,e,r);return B.__wrap(n)}static init_game(t,e){k(t,B);var r=t.ptr;t.ptr=0;var n=_.board_init_game(r,e);return B.__wrap(n)}}class j{static __wrap(t){const e=Object.create(j.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_brdidx_free(t)}get row(){return _.__wbg_get_brdidx_row(this.ptr)>>>0}set row(t){_.__wbg_set_brdidx_row(this.ptr,t)}get col(){return _.__wbg_get_brdidx_col(this.ptr)>>>0}set col(t){_.__wbg_set_brdidx_col(this.ptr,t)}constructor(t,e){var r=_.brdidx_from(t,e);return j.__wrap(r)}eq(t){return k(t,j),0!==_.brdidx_eq(this.ptr,t.ptr)}}class O{static __wrap(t){const e=Object.create(O.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_game_free(t)}get last_node_count(){return _.__wbg_get_game_last_node_count(this.ptr)>>>0}set last_node_count(t){_.__wbg_set_game_last_node_count(this.ptr,t)}get perfect_chance(){return _.__wbg_get_game_perfect_chance(this.ptr)}set perfect_chance(t){_.__wbg_set_game_perfect_chance(this.ptr,t)}current_board_cells(){return _.game_current_board_cells(this.ptr)}current_board_len(){return _.game_current_board_len(this.ptr)>>>0}current_turn(){return _.game_current_turn(this.ptr)>>>0}score(){return _.game_score(this.ptr)}winning(){var t=_.game_winning(this.ptr);return 2===t?void 0:t}has_won(){var t=_.game_has_won(this.ptr);return 2===t?void 0:t}current_cell_state(t){k(t,j);var e=_.game_current_cell_state(this.ptr,t.ptr);return A.__wrap(e)}set_search_depth(t){_.game_set_search_depth(this.ptr,t)}set_selected(t){k(t,j),_.game_set_selected(this.ptr,t.ptr)}set_perfect_chance(t){_.game_set_perfect_chance(this.ptr,t)}clear_selected(){_.game_clear_selected(this.ptr)}make_move(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;return e.ptr=0,_.game_make_move(this.ptr,r,n)>>>0}execute_move(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;e.ptr=0,_.game_execute_move(this.ptr,r,n)}execute_jump(t,e){k(t,j);var r=t.ptr;t.ptr=0,k(e,j);var n=e.ptr;e.ptr=0,_.game_execute_jump(this.ptr,r,n)}push_new_board(t){k(t,B);var e=t.ptr;t.ptr=0,_.game_push_new_board(this.ptr,e)}set_current(t){k(t,B);var e=t.ptr;t.ptr=0,_.game_set_current(this.ptr,e)}constructor(t,e,r,n,a){var c=_.game_new(t,e,r,n,a);return O.__wrap(c)}static new_with_canvas(t,e,r,n,a,c,o,i){var s=w(c,_.__wbindgen_malloc,_.__wbindgen_realloc),u=b,l=_.game_new_with_canvas(t,e,r,n,a,s,u,o,i);return O.__wrap(l)}set_painter(t){k(t,q);var e=t.ptr;t.ptr=0,_.game_set_painter(this.ptr,e)}draw(){_.game_draw(this.ptr)}ai_move(){_.game_ai_move(this.ptr)}}class q{static __wrap(t){const e=Object.create(q.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_painter_free(t)}constructor(t,e,r){var n=w(r,_.__wbindgen_malloc,_.__wbindgen_realloc),a=b,c=_.painter_new(t,e,n,a);return q.__wrap(c)}static new_with_canvas(t,e,r){var n=_.painter_new_with_canvas(t,e,d(r));return q.__wrap(n)}set_square_outline(t){_.painter_set_square_outline(this.ptr,d(t))}set_outline_width(t){_.painter_set_outline_width(this.ptr,t)}set_draw_outline(t){_.painter_set_draw_outline(this.ptr,t)}reset_dimensions(){_.painter_reset_dimensions(this.ptr)}validate_board_dim(t){return k(t,B),0!==_.painter_validate_board_dim(this.ptr,t.ptr)}draw(t){k(t,B),_.painter_draw(this.ptr,t.ptr)}}class W{static __wrap(t){const e=Object.create(W.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_piece_free(t)}get team(){return _.__wbg_get_piece_team(this.ptr)>>>0}set team(t){_.__wbg_set_piece_team(this.ptr,t)}get strength(){return _.__wbg_get_piece_strength(this.ptr)>>>0}set strength(t){_.__wbg_set_piece_strength(this.ptr,t)}constructor(t,e){var r=_.piece_new(t,e);return W.__wrap(r)}}class A{static __wrap(t){const e=Object.create(A.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_square_free(t)}get occupant(){var t=_.__wbg_get_square_occupant(this.ptr);return 0===t?void 0:W.__wrap(t)}set occupant(t){let e=0;y(t)||(k(t,W),e=t.ptr,t.ptr=0),_.__wbg_set_square_occupant(this.ptr,e)}get state(){return _.__wbg_get_square_state(this.ptr)>>>0}set state(t){_.__wbg_set_square_state(this.ptr,t)}constructor(t,e){let r=0;y(e)||(k(e,W),r=e.ptr,e.ptr=0);var n=_.square_new(t,r);return A.__wrap(n)}static pc(t,e){var r=_.square_pc(t,e);return A.__wrap(r)}static empty(){var t=_.square_empty();return A.__wrap(t)}static unplay(){var t=_.square_unplay();return A.__wrap(t)}}function C(t){!function(t){const e=o(t);(function(t){t<36||(c[t]=i,i=t)})(t)}(t)}function U(t,e){return d(p(t,e))}function R(){return d(new Error)}function $(t,e){var r=w(o(e).stack,_.__wbindgen_malloc,_.__wbindgen_realloc),n=b;v()[t/4+1]=n,v()[t/4+0]=r}function D(t,e){try{console.error(p(t,e))}finally{_.__wbindgen_free(t,e)}}function M(){return T((function(){return d(self.self)}),arguments)}function P(t,e,r){return d(o(t).require(p(e,r)))}function z(t){return d(o(t).crypto)}function F(t){return d(o(t).msCrypto)}function J(t){return void 0===o(t)}function Y(t){return d(o(t).getRandomValues)}function Z(t,e){o(t).getRandomValues(o(e))}function L(t,e,r){var n,_;o(t).randomFillSync((n=e,_=r,l().subarray(n/1,n/1+_)))}function N(){return d(t)}function Q(t){return o(t)instanceof Window}function V(t){var e=o(t).document;return y(e)?0:d(e)}function H(t,e,r){var n=o(t).getElementById(p(e,r));return y(n)?0:d(n)}function X(t){console.error(o(t))}function K(t){console.log(o(t))}function G(t){return o(t)instanceof CanvasRenderingContext2D}function tt(t,e){o(t).strokeStyle=o(e)}function et(t,e){o(t).fillStyle=o(e)}function rt(t,e){o(t).lineWidth=e}function nt(t){o(t).beginPath()}function _t(t){o(t).fill()}function at(t){o(t).stroke()}function ct(){return T((function(t,e,r,n,_,a){o(t).arc(e,r,n,_,a)}),arguments)}function ot(t,e,r,n,_){o(t).fillRect(e,r,n,_)}function it(t,e,r,n,_){o(t).strokeRect(e,r,n,_)}function st(t){return o(t)instanceof HTMLCanvasElement}function ut(t,e){o(t).width=e>>>0}function lt(t,e){o(t).height=e>>>0}function pt(){return T((function(t,e,r){var n=o(t).getContext(p(e,r));return y(n)?0:d(n)}),arguments)}function dt(t,e){return d(new Function(p(t,e)))}function gt(){return T((function(t,e){return d(o(t).call(o(e)))}),arguments)}function bt(){return T((function(){return d(self.self)}),arguments)}function ht(){return T((function(){return d(window.window)}),arguments)}function ft(){return T((function(){return d(globalThis.globalThis)}),arguments)}function wt(){return T((function(){return d(r.g.global)}),arguments)}function mt(t){return d(o(t).buffer)}function vt(t){return d(new Uint8Array(o(t)))}function yt(t,e,r){o(t).set(o(e),r>>>0)}function kt(t){return o(t).length}function xt(t){return d(new Uint8Array(t>>>0))}function Tt(t,e,r){return d(o(t).subarray(e>>>0,r>>>0))}function It(t){return d(o(t))}function Et(t,e){var r=w(g(o(e)),_.__wbindgen_malloc,_.__wbindgen_realloc),n=b;v()[t/4+1]=n,v()[t/4+0]=r}function St(t,e){throw new Error(p(t,e))}function Bt(){return d(_.memory)}}))},813:(t,e,r)=>{"use strict";var n=([n])=>r.v(e,t.id,"1f6adaf6c2dc4c9caead",{"./draught_bg.js":{__wbindgen_object_drop_ref:n.ug,__wbindgen_string_new:n.h4,__wbg_new_59cb74e423758ede:n.h9,__wbg_stack_558ba5917b466edd:n.Dz,__wbg_error_4bb6c2a97407129a:n.kF,__wbg_self_86b4b13392c7af56:n.U5,__wbg_require_f5521a5b85ad2542:n.r2,__wbg_crypto_b8c92eaac23d0d80:n.iY,__wbg_msCrypto_9ad6677321a08dd8:n.mS,__wbindgen_is_undefined:n.XP,__wbg_getRandomValues_dd27e6b0652b3236:n.yX,__wbg_getRandomValues_e57c9b75ddead065:n.ae,__wbg_randomFillSync_d2ba53160aec6aba:n.Os,__wbg_static_accessor_MODULE_452b4680e8614c81:n.DA,__wbg_instanceof_Window_11e25482011fc506:n.s8,__wbg_document_5aff8cd83ef968f5:n.WB,__wbg_getElementById_b180ea4ada06a837:n.cP,__wbg_error_d95afd6217cfd219:n.ck,__wbg_log_9a99fb1af846153b:n.a,__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b:n.l_,__wbg_setstrokeStyle_2939ee453716e462:n.U_,__wbg_setfillStyle_af790b5baf4d3210:n.EN,__wbg_setlineWidth_3e6b1837ae38d099:n.qu,__wbg_beginPath_2378575e37027ad3:n.Wg,__wbg_fill_558339447ed6ad43:n.B3,__wbg_stroke_c1e0313c58997dcf:n.I6,__wbg_arc_fffd87d9113dce32:n.Qb,__wbg_fillRect_46ffc8d2cef7e298:n.cI,__wbg_strokeRect_7ea34fad8a7f0fe2:n.QK,__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792:n.Md,__wbg_setwidth_f3c88eb520ba8d47:n.ox,__wbg_setheight_5a1abba41e35c42a:n.ES,__wbg_getContext_813df131fcbd6e91:n.Ae,__wbg_newnoargs_9fdd8f3961dd1bee:n.UL,__wbg_call_ba36642bd901572b:n.qw,__wbg_self_bb69a836a72ec6e9:n.tS,__wbg_window_3304fc4b414c9693:n.R$,__wbg_globalThis_e0d21cabc6630763:n.md,__wbg_global_8463719227271676:n.IF,__wbg_buffer_9e184d6f785de5ed:n.zP,__wbg_new_e8101319e4cf95fc:n.td,__wbg_set_e8ae7b27314e8b98:n.Ct,__wbg_length_2d56cb37075fcfb1:n.uQ,__wbg_newwithlength_a8d1dbcbe703a5c6:n.RV,__wbg_subarray_901ede8318da52a6:n.sy,__wbindgen_object_clone_ref:n.m_,__wbindgen_debug_string:n.fY,__wbindgen_throw:n.Or,__wbindgen_memory:n.oH}});r.a(t,(t=>{var e=t([r(171)]);return e.then?e.then(n):n(e)}),1)},10:(t,e,r)=>{"use strict";r.a(t,(async t=>{r.r(e);var n=r(171),_=t([n]);n=(_.then?await _:_)[0];var a=8,c=8,o=3,i=4,s=.5;const u="human_turn.thinking",l="human_turn.from_selected";(0,n.wc)(),document.getElementById("status-p");const p=document.getElementById("status-d"),d=document.getElementById("team-p"),g=document.getElementById("node-count"),b=document.getElementById("winning-p");document.getElementById("startBtn").onclick=T;let h=null,f=null,w=function(t,e="danger",r=!0){null!=f&&clearInterval(f),p.className=`alert alert-${e}`,p.innerText=t,p.hidden=!1,r&&(f=setTimeout((()=>{p.hidden=!0}),3e3))},m=u,v=null,y=null,k=[];T();const x=document.getElementById("game-canvas");function T(){v=new n.lA(a,c,o,n.SZ.Black,i),y=new n.Ck(720,720,"game-canvas"),v.set_painter(y),v.draw(),clearInterval(h),I(),E(),k=[],m=u}function I(){switch(v.current_turn()){case n.SZ.White:d.innerText="⚪ White ⚪";break;case n.SZ.Black:d.innerText="🔴 Black 🔴"}}function E(){switch(v.winning()){case void 0:b.innerText="";break;case n.SZ.White:b.innerText="👑 White 👑";break;case n.SZ.Black:b.innerText="👑 Black 👑"}}x.addEventListener("click",(t=>{var e=function(t,e){var r=t.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}}(x,t);!function(t){switch(m){case u:if(v.current_cell_state(t).state!=n.i0.Occupied)return;if(v.current_cell_state(t).occupant.team!=v.current_turn())return;k.push(t),m=l,v.set_selected(t),v.draw();break;case l:if(!k[0].eq(t)){if(v.current_cell_state(t).state!=n.i0.Empty)return;if(k.push(t),2!=k.length)return w(`Error: wrong number of clicks to process ${k.length}`),void console.error(`Error: wrong number of clicks to process ${k.length}`);switch(v.make_move(k[0],k[1])){case n.Tt.Allowed:q.checked&&void 0===v.has_won()&&(v.ai_move(),g.innerText=`searched ${v.last_node_count.toLocaleString("en-GB")} possible moves`);break;case n.Tt.IllegalTrajectory:w("You can't move like that!");break;case n.Tt.JumpingSameTeam:w("You can't jump your own piece!");break;case n.Tt.NoJumpablePiece:w("There's nothing to jump!");break;case n.Tt.OccupiedDest:w("There's a piece there!");break;case n.Tt.OutOfBounds:w("That square's not on the board! (how have you managed that?)");break;case n.Tt.UnoccupiedSrc:w("There's no piece to move!");break;case n.Tt.Unplayable:w("That's not a playable square!");break;case n.Tt.WrongTeamSrc:w("That's not your piece!")}}v.clear_selected(),v.draw(),k=[],m=u;break;case"ai_turn":console.log("It's the AI's turn!")}I(),E(),function(){switch(v.has_won()){case void 0:break;case n.SZ.White:w("You Lost!"),h=setInterval((()=>{T()}),3e3);break;case n.SZ.Black:w("You Won!","success"),h=setInterval((()=>{T()}),3e3)}}()}(new n.rh(Math.floor(e.y/x.clientHeight*c),Math.floor(e.x/x.clientWidth*a)))}));const S=document.getElementById("width");S.onchange=()=>{a=parseInt(S.value),T()},S.value=8;const B=document.getElementById("height");B.onchange=()=>{c=parseInt(B.value),j.max=c/2-1,T()},B.value=8;const j=document.getElementById("play_rows");j.onchange=()=>{o=parseInt(j.value),T()},j.value=3;const O=document.getElementById("ai_search_depth");O.onchange=()=>{i=parseInt(O.value),v.set_search_depth(i),i>4&&w("This increases thinking time exponentially, be careful (probably don't go past 6)","warning")},O.value=4;const q=document.getElementById("ai-checkbox");q.onchange=()=>{};const W=document.getElementById("ai_difficulty");W.onchange=()=>{s=parseInt(W.value)/100,v.set_perfect_chance(s)},W.value=50}))}}]); //# sourceMappingURL=10.bootstrap.js.map \ No newline at end of file diff --git a/10.bootstrap.js.map b/10.bootstrap.js.map index 0023030..2804a00 100644 --- a/10.bootstrap.js.map +++ b/10.bootstrap.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://draught/../pkg/draught_bg.js","webpack://draught/./index.js"],"names":["heap","Array","fill","undefined","getObject","idx","push","heap_next","length","cachedTextDecoder","TextDecoder","module","require","ignoreBOM","fatal","decode","cachegetUint8Memory0","getUint8Memory0","buffer","Uint8Array","getStringFromWasm0","ptr","len","subarray","addHeapObject","obj","debugString","val","type","description","name","isArray","debug","i","builtInMatches","exec","toString","call","className","JSON","stringify","_","Error","message","stack","WASM_VECTOR_LEN","cachedTextEncoder","TextEncoder","encodeString","encodeInto","arg","view","buf","encode","set","read","written","passStringToWasm0","malloc","realloc","mem","offset","code","charCodeAt","slice","cachegetInt32Memory0","getInt32Memory0","Int32Array","isLikeNone","x","_assertClass","instance","klass","init_wasm","handleError","f","args","apply","this","e","Object","freeze","Move","Jump","Team","Black","White","SquareState","Man","King","Empty","Occupied","Unplayable","Moveable","Allowed","UnoccupiedSrc","OccupiedDest","OutOfBounds","WrongTeamSrc","IllegalTrajectory","NoJumpablePiece","JumpingSameTeam","Board","create","prototype","__destroy_into_raw","arg0","ret","Square","__wrap","square","ptr0","BrdIdx","row","col","from","to","ptr1","from_square_occupant","Piece","ptr2","team","jumpee","from_occ","width","height","current_turn","board","piece_rows","other","Game","search_depth","first_turn","canvas_id","canvas_width","canvas_height","len0","value","Painter","canvas","strength","state","occupant","__wbindgen_object_drop_ref","dropObject","takeObject","__wbindgen_string_new","arg1","__wbg_new_59cb74e423758ede","__wbg_stack_558ba5917b466edd","__wbg_error_4bb6c2a97407129a","console","error","__wbg_self_86b4b13392c7af56","self","arguments","__wbg_require_f5521a5b85ad2542","arg2","__wbg_crypto_b8c92eaac23d0d80","crypto","__wbg_msCrypto_9ad6677321a08dd8","msCrypto","__wbindgen_is_undefined","__wbg_getRandomValues_dd27e6b0652b3236","getRandomValues","__wbg_getRandomValues_e57c9b75ddead065","__wbg_randomFillSync_d2ba53160aec6aba","randomFillSync","__wbg_static_accessor_MODULE_452b4680e8614c81","__wbg_instanceof_Window_11e25482011fc506","Window","__wbg_document_5aff8cd83ef968f5","document","__wbg_getElementById_b180ea4ada06a837","getElementById","__wbg_log_9a99fb1af846153b","log","__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b","CanvasRenderingContext2D","__wbg_setstrokeStyle_2939ee453716e462","strokeStyle","__wbg_setfillStyle_af790b5baf4d3210","fillStyle","__wbg_setlineWidth_3e6b1837ae38d099","lineWidth","__wbg_beginPath_2378575e37027ad3","beginPath","__wbg_fill_558339447ed6ad43","__wbg_stroke_c1e0313c58997dcf","stroke","__wbg_arc_fffd87d9113dce32","arg3","arg4","arg5","arc","__wbg_fillRect_46ffc8d2cef7e298","fillRect","__wbg_strokeRect_7ea34fad8a7f0fe2","strokeRect","__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792","HTMLCanvasElement","__wbg_setwidth_f3c88eb520ba8d47","__wbg_setheight_5a1abba41e35c42a","__wbg_getContext_813df131fcbd6e91","getContext","__wbg_newnoargs_9fdd8f3961dd1bee","Function","__wbg_call_ba36642bd901572b","__wbg_self_bb69a836a72ec6e9","__wbg_window_3304fc4b414c9693","window","__wbg_globalThis_e0d21cabc6630763","globalThis","__wbg_global_8463719227271676","g","global","__wbg_buffer_9e184d6f785de5ed","__wbg_new_e8101319e4cf95fc","__wbg_set_e8ae7b27314e8b98","__wbg_length_2d56cb37075fcfb1","__wbg_newwithlength_a8d1dbcbe703a5c6","__wbg_subarray_901ede8318da52a6","__wbindgen_object_clone_ref","__wbindgen_debug_string","__wbindgen_throw","__wbindgen_memory","BOARD_WIDTH","BOARD_HEIGHT","PIECE_ROWS","SEARCH_DEPTH","GameState","statusAlert","teamText","nodeCountText","winningText","onclick","start_game","wonTimeout","statusTimeout","setStatus","txt","alertType","hide","clearInterval","innerText","hidden","setTimeout","current_state","game","painter","clicks","set_painter","draw","updateTeamText","updateWinningText","winning","addEventListener","event","mousepos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","getMousePos","cell_coord","current_cell_state","set_selected","eq","make_move","aiCheckBox","checked","ai_move","last_node_count","toLocaleString","clear_selected","has_won","setInterval","checkWon","process_canvas_click","Math","floor","clientHeight","clientWidth","widthBox","onchange","parseInt","heightBox","pieceRowsBox","max","aiSearchDepthBox","set_search_depth"],"mappings":"gsBAEA,MAAMA,EAAO,IAAIC,MAAM,IAAIC,UAAKC,GAIhC,SAASC,EAAUC,GAAO,OAAOL,EAAKK,GAFtCL,EAAKM,UAAKH,EAAW,MAAM,GAAM,GAIjC,IAAII,EAAYP,EAAKQ,OAgBrB,IAAIC,EAAoB,IAFoB,oBAAhBC,aAA8B,EAAIC,EAAOC,SAAS,QAAQF,YAAcA,aAE3D,QAAS,CAAEG,WAAW,EAAMC,OAAO,IAE5EL,EAAkBM,SAElB,IAAIC,EAAuB,KAC3B,SAASC,IAIL,OAH6B,OAAzBD,GAAiCA,EAAqBE,SAAW,kBACjEF,EAAuB,IAAIG,WAAW,kBAEnCH,EAGX,SAASI,EAAmBC,EAAKC,GAC7B,OAAOb,EAAkBM,OAAOE,IAAkBM,SAASF,EAAKA,EAAMC,IAG1E,SAASE,EAAcC,GACflB,IAAcP,EAAKQ,QAAQR,EAAKM,KAAKN,EAAKQ,OAAS,GACvD,MAAMH,EAAME,EAIZ,OAHAA,EAAYP,EAAKK,GAEjBL,EAAKK,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BACV,MACJ,KAAK,gBACDA,EAAU,iCACV,MACJ,KAAK,kBACDA,EAAU,2BAMtBS,EAAK8B,iBACL9B,EAAKI,OACLF,EAAS,GACTH,EAAgBjB,EAEhB,MACJ,IA3JK,UA4JD/E,QAAQyB,IAAI,uBAIpB6E,IACAC,IAqEJ,WAEI,OAAON,EAAK+B,WACR,UAAKpR,EACD,MACJ,KAAK,WACD4O,EAAU,aACVF,EAAa2C,aAAY,KACrB5C,MArPI,KAuPR,MACJ,KAAK,WACDG,EAAU,WAAY,WACtBF,EAAa2C,aAAY,KACrB5C,MA3PI,MAyKhB6C,GApHAC,CALW,IAAI,KACXC,KAAKC,MAAO1B,EAASM,EAAI7H,EAAOkJ,aAAgB1D,GAChDwD,KAAKC,MAAO1B,EAAS7L,EAAIsE,EAAOmJ,YAAe5D,QAmNvD,MAAM6D,EAAWnH,SAASE,eAAe,SASzCiH,EAASC,SALO,KAEZ9D,EAAc+D,SAASF,EAAStJ,OAChCmG,KAGJmD,EAAStJ,MAAQ,EAEjB,MAAMyJ,EAAYtH,SAASE,eAAe,UAU1CoH,EAAUF,SANO,KAEb7D,EAAe8D,SAASC,EAAUzJ,OAClC0J,EAAaC,IAAQjE,EAAe,EAAK,EACzCS,KAGJsD,EAAUzJ,MAAQ,EAElB,MAAM0J,EAAevH,SAASE,eAAe,aAS7CqH,EAAaH,SALO,KAEhB5D,EAAa6D,SAASE,EAAa1J,OACnCmG,KAGJuD,EAAa1J,MAAQ,EAErB,MAAM4J,EAAmBzH,SAASE,eAAe,mBAajDuH,EAAiBL,SATO,KAEpB3D,EAAe4D,SAASI,EAAiB5J,OACzC+G,EAAK8C,iBAAiBjE,GAEnBA,EAAe,GACdU,EAAU,oFAAqF,YAIvGsD,EAAiB5J,MAAQ,EAEzB,MAAMwI,EAAarG,SAASE,eAAe,eAO3CmG,EAAWe,SAHO","file":"10.bootstrap.js","sourcesContent":["import * as wasm from './draught_bg.wasm';\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n return instance.ptr;\n}\n/**\n*/\nexport function init_wasm() {\n wasm.init_wasm();\n}\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_exn_store(addHeapObject(e));\n }\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* Move/Jump, for use in Move\n*/\nexport const MoveType = Object.freeze({ Move:0,\"0\":\"Move\",Jump:1,\"1\":\"Jump\", });\n/**\n* Black/White\n*/\nexport const Team = Object.freeze({ Black:0,\"0\":\"Black\",White:1,\"1\":\"White\", });\n/**\n* Man/King\n*/\nexport const Strength = Object.freeze({ Man:0,\"0\":\"Man\",King:1,\"1\":\"King\", });\n/**\n* Model board square as Empty/Occupied/Unplayable\n*/\nexport const SquareState = Object.freeze({ Empty:0,\"0\":\"Empty\",Occupied:1,\"1\":\"Occupied\",Unplayable:2,\"2\":\"Unplayable\", });\n/**\n* Possible outcomes of trying to move\n*/\nexport const Moveable = Object.freeze({ Allowed:0,\"0\":\"Allowed\",UnoccupiedSrc:1,\"1\":\"UnoccupiedSrc\",OccupiedDest:2,\"2\":\"OccupiedDest\",OutOfBounds:3,\"3\":\"OutOfBounds\",Unplayable:4,\"4\":\"Unplayable\",WrongTeamSrc:5,\"5\":\"WrongTeamSrc\",IllegalTrajectory:6,\"6\":\"IllegalTrajectory\",NoJumpablePiece:7,\"7\":\"NoJumpablePiece\",JumpingSameTeam:8,\"8\":\"JumpingSameTeam\", });\n/**\n* Single state of a checkers board\n*/\nexport class Board {\n\n static __wrap(ptr) {\n const obj = Object.create(Board.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_board_free(ptr);\n }\n /**\n * @returns {number}\n */\n get width() {\n var ret = wasm.__wbg_get_board_width(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set width(arg0) {\n wasm.__wbg_set_board_width(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get height() {\n var ret = wasm.__wbg_get_board_height(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set height(arg0) {\n wasm.__wbg_set_board_height(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get current_turn() {\n var ret = wasm.__wbg_get_board_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set current_turn(arg0) {\n wasm.__wbg_set_board_current_turn(this.ptr, arg0);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @returns {Square}\n */\n cell(idx) {\n var ret = wasm.board_cell(this.ptr, idx);\n return Square.__wrap(ret);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @param {Square} square\n */\n set_cell(idx, square) {\n _assertClass(square, Square);\n var ptr0 = square.ptr;\n square.ptr = 0;\n wasm.board_set_cell(this.ptr, idx, ptr0);\n }\n /**\n * Get a copy of a board square by 2D [`BrdIdx`] index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n grid_cell(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_grid_cell(this.ptr, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {number} row\n * @param {number} col\n * @returns {number}\n */\n cell_index(row, col) {\n var ret = wasm.board_cell_index(this.ptr, row, col);\n return ret >>> 0;\n }\n /**\n * Similar to [`Board::cell_index`] but with a [`BrdIdx`] instead of separate indices. Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {BrdIdx} idx\n * @returns {number}\n */\n cell_idx(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_cell_idx(this.ptr, ptr0);\n return ret >>> 0;\n }\n /**\n * Transform a 1D array index (for [`Board::cells`]) into a 2D game board index (by row/col)\n * @param {number} idx\n * @returns {BrdIdx}\n */\n board_index(idx) {\n var ret = wasm.board_board_index(this.ptr, idx);\n return BrdIdx.__wrap(ret);\n }\n /**\n * Check whether a move given by source and destination indices is legal\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n can_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_can_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Check that given move trajectory is valid for a man piece\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_man_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_man_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * Check that given move trajectory is valid for a king piece\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_king_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_king_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * Get cell index of jumpee square given from and to locations\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n jumpee_idx(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_jumpee_idx(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Get a pointer to the backing array of board squares, [`Board::cells`]\n * @returns {number}\n */\n cells() {\n var ret = wasm.board_cells(this.ptr);\n return ret;\n }\n /**\n * Get the number of board squares\n * @returns {number}\n */\n num_cells() {\n var ret = wasm.board_num_cells(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces\n * @returns {number}\n */\n num_pieces() {\n var ret = wasm.board_num_pieces(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces for a player\n * @param {number} team\n * @returns {number}\n */\n num_player(team) {\n var ret = wasm.board_num_player(this.ptr, team);\n return ret >>> 0;\n }\n /**\n * Get the score value, Black - White pieces\n * @returns {number}\n */\n score() {\n var ret = wasm.board_score(this.ptr);\n return ret;\n }\n /**\n * Get the state of a board square by 1D array index\n * @param {number} idx\n * @returns {number}\n */\n cell_state(idx) {\n var ret = wasm.board_cell_state(this.ptr, idx);\n return ret >>> 0;\n }\n /**\n * Get new board derived from current with given move applied\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_move(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * Get new board derived from current with given jump applied\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_jump(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * Get row index for current team, top row for black, bottom row for white\n * @returns {number}\n */\n king_row_idx() {\n var ret = wasm.board_king_row_idx(this.ptr);\n return ret >>> 0;\n }\n /**\n * Unwrap the jumpee piece from the square and [`Board::check_jumpee_team`] with [`Moveable`] response\n * @param {Square} jumpee\n * @param {Piece} from_occ\n * @returns {number}\n */\n static validate_jumpee(jumpee, from_occ) {\n _assertClass(jumpee, Square);\n var ptr0 = jumpee.ptr;\n jumpee.ptr = 0;\n _assertClass(from_occ, Piece);\n var ptr1 = from_occ.ptr;\n from_occ.ptr = 0;\n var ret = wasm.board_validate_jumpee(ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Check that the source piece and the jumpee are of opposing teams\n * @param {Piece} from\n * @param {Piece} jumpee\n * @returns {boolean}\n */\n static check_jumpee_team(from, jumpee) {\n _assertClass(from, Piece);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(jumpee, Piece);\n var ptr1 = jumpee.ptr;\n jumpee.ptr = 0;\n var ret = wasm.board_check_jumpee_team(ptr0, ptr1);\n return ret !== 0;\n }\n /**\n * Initialise a game board without game pieces\n * @param {number} width\n * @param {number} height\n * @param {number} current_turn\n */\n constructor(width, height, current_turn) {\n var ret = wasm.board_new(width, height, current_turn);\n return Board.__wrap(ret);\n }\n /**\n * Reset the given board to a starting layout with 3 rows of opposing pieces\n * @param {Board} board\n * @param {number} piece_rows\n * @returns {Board}\n */\n static init_game(board, piece_rows) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n var ret = wasm.board_init_game(ptr0, piece_rows);\n return Board.__wrap(ret);\n }\n}\n/**\n* Rank 2 tensor index to identify a board square by row and column\n*/\nexport class BrdIdx {\n\n static __wrap(ptr) {\n const obj = Object.create(BrdIdx.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_brdidx_free(ptr);\n }\n /**\n * @returns {number}\n */\n get row() {\n var ret = wasm.__wbg_get_brdidx_row(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set row(arg0) {\n wasm.__wbg_set_brdidx_row(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get col() {\n var ret = wasm.__wbg_get_brdidx_col(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set col(arg0) {\n wasm.__wbg_set_brdidx_col(this.ptr, arg0);\n }\n /**\n * @param {number} row\n * @param {number} col\n */\n constructor(row, col) {\n var ret = wasm.brdidx_from(row, col);\n return BrdIdx.__wrap(ret);\n }\n /**\n * @param {BrdIdx} other\n * @returns {boolean}\n */\n eq(other) {\n _assertClass(other, BrdIdx);\n var ret = wasm.brdidx_eq(this.ptr, other.ptr);\n return ret !== 0;\n }\n}\n/**\n* Root-level structure for managing the game as a collection of board states\n*/\nexport class Game {\n\n static __wrap(ptr) {\n const obj = Object.create(Game.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_game_free(ptr);\n }\n /**\n * @returns {number}\n */\n get last_node_count() {\n var ret = wasm.__wbg_get_game_last_node_count(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set last_node_count(arg0) {\n wasm.__wbg_set_game_last_node_count(this.ptr, arg0);\n }\n /**\n * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_cells() {\n var ret = wasm.game_current_board_cells(this.ptr);\n return ret;\n }\n /**\n * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_len() {\n var ret = wasm.game_current_board_len(this.ptr);\n return ret >>> 0;\n }\n /**\n * Current turn's team\n * @returns {number}\n */\n current_turn() {\n var ret = wasm.game_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * Current board's score\n * @returns {number}\n */\n score() {\n var ret = wasm.game_score(this.ptr);\n return ret;\n }\n /**\n * Get currently winning player\n * @returns {number | undefined}\n */\n winning() {\n var ret = wasm.game_winning(this.ptr);\n return ret === 2 ? undefined : ret;\n }\n /**\n * Check if a player has won\n * @returns {number | undefined}\n */\n has_won() {\n var ret = wasm.game_has_won(this.ptr);\n return ret === 2 ? undefined : ret;\n }\n /**\n * Get square on current board for given index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n current_cell_state(idx) {\n _assertClass(idx, BrdIdx);\n var ret = wasm.game_current_cell_state(this.ptr, idx.ptr);\n return Square.__wrap(ret);\n }\n /**\n * @param {number} search_depth\n */\n set_search_depth(search_depth) {\n wasm.game_set_search_depth(this.ptr, search_depth);\n }\n /**\n * Set given index as selected piece\n * TODO: Check whether valid square?\n * @param {BrdIdx} idx\n */\n set_selected(idx) {\n _assertClass(idx, BrdIdx);\n wasm.game_set_selected(this.ptr, idx.ptr);\n }\n /**\n * Clear currently selected piece\n */\n clear_selected() {\n wasm.game_clear_selected(this.ptr);\n }\n /**\n * Attempt to make a move given a source and destination index\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n make_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.game_make_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Update board state with given move and push new board into current state\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n */\n execute_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n wasm.game_execute_move(this.ptr, ptr0, ptr1);\n }\n /**\n * Update board state with given jump move and push new board into current state\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n */\n execute_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n wasm.game_execute_jump(this.ptr, ptr0, ptr1);\n }\n /**\n * Push current board into the previous turns and set given board to current\n * @param {Board} board\n */\n push_new_board(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n wasm.game_push_new_board(this.ptr, ptr0);\n }\n /**\n * Set current board to given\n * @param {Board} board\n */\n set_current(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n wasm.game_set_current(this.ptr, ptr0);\n }\n /**\n * Get new game without board renderer\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\n * @param {number} search_depth\n */\n constructor(width, height, piece_rows, first_turn, search_depth) {\n var ret = wasm.game_new(width, height, piece_rows, first_turn, search_depth);\n return Game.__wrap(ret);\n }\n /**\n * Get a new game with canvas ID and dimensions\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\n * @param {number} search_depth\n * @param {string} canvas_id\n * @param {number} canvas_width\n * @param {number} canvas_height\n * @returns {Game}\n */\n static new_with_canvas(width, height, piece_rows, first_turn, search_depth, canvas_id, canvas_width, canvas_height) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.game_new_with_canvas(width, height, piece_rows, first_turn, search_depth, ptr0, len0, canvas_width, canvas_height);\n return Game.__wrap(ret);\n }\n /**\n * Set painter for rendering boards\n * @param {Painter} value\n */\n set_painter(value) {\n _assertClass(value, Painter);\n var ptr0 = value.ptr;\n value.ptr = 0;\n wasm.game_set_painter(this.ptr, ptr0);\n }\n /**\n * Draw current board using painter if exists\n */\n draw() {\n wasm.game_draw(this.ptr);\n }\n /**\n * Create computer, get move from current board and update current board\n */\n ai_move() {\n wasm.game_ai_move(this.ptr);\n }\n}\n/**\n* Used to paint boards onto HTML canvases\n*/\nexport class Painter {\n\n static __wrap(ptr) {\n const obj = Object.create(Painter.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_painter_free(ptr);\n }\n /**\n * Default constructor which queries for canvas by ID\n * @param {number} width\n * @param {number} height\n * @param {string} canvas_id\n */\n constructor(width, height, canvas_id) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.painter_new(width, height, ptr0, len0);\n return Painter.__wrap(ret);\n }\n /**\n * Constructor with given canvas element\n * @param {number} width\n * @param {number} height\n * @param {HTMLCanvasElement} canvas\n * @returns {Painter}\n */\n static new_with_canvas(width, height, canvas) {\n var ret = wasm.painter_new_with_canvas(width, height, addHeapObject(canvas));\n return Painter.__wrap(ret);\n }\n /**\n * Set new square outline colour value\n * @param {any} value\n */\n set_square_outline(value) {\n wasm.painter_set_square_outline(this.ptr, addHeapObject(value));\n }\n /**\n * Set new line width for outlining squares\n * @param {number} value\n */\n set_outline_width(value) {\n wasm.painter_set_outline_width(this.ptr, value);\n }\n /**\n * Set whether squares are outlined\n * @param {boolean} value\n */\n set_draw_outline(value) {\n wasm.painter_set_draw_outline(this.ptr, value);\n }\n /**\n * Reset the canvas dimensions to the given width and height\n */\n reset_dimensions() {\n wasm.painter_reset_dimensions(this.ptr);\n }\n /**\n * Check whether given canvas dimensions divide evenly by given board dimenions\n * @param {Board} board\n * @returns {boolean}\n */\n validate_board_dim(board) {\n _assertClass(board, Board);\n var ret = wasm.painter_validate_board_dim(this.ptr, board.ptr);\n return ret !== 0;\n }\n /**\n * Draw a board onto the canvas\n * @param {Board} board\n */\n draw(board) {\n _assertClass(board, Board);\n wasm.painter_draw(this.ptr, board.ptr);\n }\n}\n/**\n* Game piece given by its team and strength (normal or kinged)\n*/\nexport class Piece {\n\n static __wrap(ptr) {\n const obj = Object.create(Piece.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_piece_free(ptr);\n }\n /**\n * @returns {number}\n */\n get team() {\n var ret = wasm.__wbg_get_piece_team(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set team(arg0) {\n wasm.__wbg_set_piece_team(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get strength() {\n var ret = wasm.__wbg_get_piece_strength(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set strength(arg0) {\n wasm.__wbg_set_piece_strength(this.ptr, arg0);\n }\n /**\n * @param {number} team\n * @param {number} strength\n */\n constructor(team, strength) {\n var ret = wasm.piece_new(team, strength);\n return Piece.__wrap(ret);\n }\n}\n/**\n* Board squares given by a state and a possible occupying game piece\n*/\nexport class Square {\n\n static __wrap(ptr) {\n const obj = Object.create(Square.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_square_free(ptr);\n }\n /**\n * Game piece if square is occupied\n * @returns {Piece | undefined}\n */\n get occupant() {\n var ret = wasm.__wbg_get_square_occupant(this.ptr);\n return ret === 0 ? undefined : Piece.__wrap(ret);\n }\n /**\n * Game piece if square is occupied\n * @param {Piece | undefined} arg0\n */\n set occupant(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Piece);\n ptr0 = arg0.ptr;\n arg0.ptr = 0;\n }\n wasm.__wbg_set_square_occupant(this.ptr, ptr0);\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @returns {number}\n */\n get state() {\n var ret = wasm.__wbg_get_square_state(this.ptr);\n return ret >>> 0;\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @param {number} arg0\n */\n set state(arg0) {\n wasm.__wbg_set_square_state(this.ptr, arg0);\n }\n /**\n * Standard constructor function to form square from state and occupant\n * @param {number} state\n * @param {Piece | undefined} occupant\n */\n constructor(state, occupant) {\n let ptr0 = 0;\n if (!isLikeNone(occupant)) {\n _assertClass(occupant, Piece);\n ptr0 = occupant.ptr;\n occupant.ptr = 0;\n }\n var ret = wasm.square_new(state, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed piece square by team and strength\n * @param {number} team\n * @param {number} strength\n * @returns {Square}\n */\n static pc(team, strength) {\n var ret = wasm.square_pc(team, strength);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed empty square\n * @returns {Square}\n */\n static empty() {\n var ret = wasm.square_empty();\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed unplayable square\n * @returns {Square}\n */\n static unplay() {\n var ret = wasm.square_unplay();\n return Square.__wrap(ret);\n }\n}\n\nexport function __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nexport function __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nexport function __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(arg0, arg1);\n }\n};\n\nexport function __wbg_self_86b4b13392c7af56() { return handleError(function () {\n var ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_require_f5521a5b85ad2542(arg0, arg1, arg2) {\n var ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));\n return addHeapObject(ret);\n};\n\nexport function __wbg_crypto_b8c92eaac23d0d80(arg0) {\n var ret = getObject(arg0).crypto;\n return addHeapObject(ret);\n};\n\nexport function __wbg_msCrypto_9ad6677321a08dd8(arg0) {\n var ret = getObject(arg0).msCrypto;\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_is_undefined(arg0) {\n var ret = getObject(arg0) === undefined;\n return ret;\n};\n\nexport function __wbg_getRandomValues_dd27e6b0652b3236(arg0) {\n var ret = getObject(arg0).getRandomValues;\n return addHeapObject(ret);\n};\n\nexport function __wbg_getRandomValues_e57c9b75ddead065(arg0, arg1) {\n getObject(arg0).getRandomValues(getObject(arg1));\n};\n\nexport function __wbg_randomFillSync_d2ba53160aec6aba(arg0, arg1, arg2) {\n getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));\n};\n\nexport function __wbg_static_accessor_MODULE_452b4680e8614c81() {\n var ret = module;\n return addHeapObject(ret);\n};\n\nexport function __wbg_instanceof_Window_11e25482011fc506(arg0) {\n var ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nexport function __wbg_document_5aff8cd83ef968f5(arg0) {\n var ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_getElementById_b180ea4ada06a837(arg0, arg1, arg2) {\n var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nexport function __wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b(arg0) {\n var ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n return ret;\n};\n\nexport function __wbg_setstrokeStyle_2939ee453716e462(arg0, arg1) {\n getObject(arg0).strokeStyle = getObject(arg1);\n};\n\nexport function __wbg_setfillStyle_af790b5baf4d3210(arg0, arg1) {\n getObject(arg0).fillStyle = getObject(arg1);\n};\n\nexport function __wbg_setlineWidth_3e6b1837ae38d099(arg0, arg1) {\n getObject(arg0).lineWidth = arg1;\n};\n\nexport function __wbg_beginPath_2378575e37027ad3(arg0) {\n getObject(arg0).beginPath();\n};\n\nexport function __wbg_fill_558339447ed6ad43(arg0) {\n getObject(arg0).fill();\n};\n\nexport function __wbg_stroke_c1e0313c58997dcf(arg0) {\n getObject(arg0).stroke();\n};\n\nexport function __wbg_arc_fffd87d9113dce32() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {\n getObject(arg0).arc(arg1, arg2, arg3, arg4, arg5);\n}, arguments) };\n\nexport function __wbg_fillRect_46ffc8d2cef7e298(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).fillRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_strokeRect_7ea34fad8a7f0fe2(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792(arg0) {\n var ret = getObject(arg0) instanceof HTMLCanvasElement;\n return ret;\n};\n\nexport function __wbg_setwidth_f3c88eb520ba8d47(arg0, arg1) {\n getObject(arg0).width = arg1 >>> 0;\n};\n\nexport function __wbg_setheight_5a1abba41e35c42a(arg0, arg1) {\n getObject(arg0).height = arg1 >>> 0;\n};\n\nexport function __wbg_getContext_813df131fcbd6e91() { return handleError(function (arg0, arg1, arg2) {\n var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_newnoargs_9fdd8f3961dd1bee(arg0, arg1) {\n var ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nexport function __wbg_call_ba36642bd901572b() { return handleError(function (arg0, arg1) {\n var ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_self_bb69a836a72ec6e9() { return handleError(function () {\n var ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_window_3304fc4b414c9693() { return handleError(function () {\n var ret = window.window;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_globalThis_e0d21cabc6630763() { return handleError(function () {\n var ret = globalThis.globalThis;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_global_8463719227271676() { return handleError(function () {\n var ret = global.global;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_buffer_9e184d6f785de5ed(arg0) {\n var ret = getObject(arg0).buffer;\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_e8101319e4cf95fc(arg0) {\n var ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n};\n\nexport function __wbg_set_e8ae7b27314e8b98(arg0, arg1, arg2) {\n getObject(arg0).set(getObject(arg1), arg2 >>> 0);\n};\n\nexport function __wbg_length_2d56cb37075fcfb1(arg0) {\n var ret = getObject(arg0).length;\n return ret;\n};\n\nexport function __wbg_newwithlength_a8d1dbcbe703a5c6(arg0) {\n var ret = new Uint8Array(arg0 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbg_subarray_901ede8318da52a6(arg0, arg1, arg2) {\n var ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_object_clone_ref(arg0) {\n var ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n var ret = debugString(getObject(arg1));\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\nexport function __wbindgen_memory() {\n var ret = wasm.memory;\n return addHeapObject(ret);\n};\n\n","import { Game, Board, BrdIdx, Painter, Team, init_wasm, Moveable, SquareState, Square } from \"draught\";\n// import { memory } from \"draught/draught_bg.wasm\";\n\n///////////////////\n// CONSTS\n///////////////////\n\nconst CANVAS_WIDTH = 720;\nconst CANVAS_HEIGHT = 720;\n\nvar BOARD_WIDTH = 8;\nvar BOARD_HEIGHT = 8;\n\nvar PIECE_ROWS = 3;\nvar SEARCH_DEPTH = 4;\n\nconst STATUS_TIMEOUT = 3000;\nconst WON_TIMEOUT = 3000;\n\nconst GameState = {\n HUMAN_TURN: {\n THINKING: \"human_turn.thinking\",\n FROM_SELECTED: \"human_turn.from_selected\"\n },\n AI_TURN: \"ai_turn\"\n}\n\n//////////////////\n// GAME STUFF\n//////////////////\n\ninit_wasm();\n\n// let board = new Board(BOARD_WIDTH, BOARD_HEIGHT, Team.Black);\n\nconst statusText = document.getElementById(\"status-p\");\nconst statusAlert = document.getElementById(\"status-d\");\nconst teamText = document.getElementById(\"team-p\");\nconst nodeCountText = document.getElementById(\"node-count\");\nconst winningText = document.getElementById(\"winning-p\");\n\nconst startBtn = document.getElementById(\"startBtn\");\nstartBtn.onclick = start_game;\n\nlet wonTimeout = null;\nlet statusTimeout = null;\nlet setStatus = setStatusAlert;\n\nlet current_state = GameState.HUMAN_TURN.THINKING;\n\nlet game = null;\nlet painter = null;\n\nlet clicks = [];\n\nstart_game();\n\n/////////////////\n// CANVAS\n/////////////////\n\nconst canvas = document.getElementById(\"game-canvas\");\ncanvas.addEventListener(\"click\", (event) => {\n var mousepos = getMousePos(canvas, event);\n // console.log(mousepos);\n var cell = new BrdIdx(\n Math.floor((mousepos.y / canvas.clientHeight) * BOARD_HEIGHT),\n Math.floor((mousepos.x / canvas.clientWidth) * BOARD_WIDTH),\n );\n // console.log(cell);\n process_canvas_click(cell);\n});\n\n////////////////\n// FUNCS\n////////////////\n\nfunction start_game() {\n game = new Game(BOARD_WIDTH, BOARD_HEIGHT, PIECE_ROWS, Team.Black, SEARCH_DEPTH);\n painter = new Painter(CANVAS_WIDTH, CANVAS_HEIGHT, \"game-canvas\");\n game.set_painter(painter);\n game.draw();\n\n clearInterval(wonTimeout);\n updateTeamText();\n updateWinningText();\n clicks = [];\n current_state = GameState.HUMAN_TURN.THINKING;\n}\n\nfunction process_canvas_click(cell_coord) {\n\n switch(current_state) {\n // first click of a move\n case GameState.HUMAN_TURN.THINKING:\n if (game.current_cell_state(cell_coord).state != SquareState.Occupied ) {\n return;\n }\n\n if (game.current_cell_state(cell_coord).occupant.team != game.current_turn() ) {\n return;\n }\n\n // console.log(\"Your turn, first piece picked\");\n\n clicks.push(cell_coord);\n current_state = GameState.HUMAN_TURN.FROM_SELECTED;\n game.set_selected(cell_coord);\n game.draw();\n \n break;\n \n // second click of a move\n case GameState.HUMAN_TURN.FROM_SELECTED:\n\n // second click is different to first, process as move\n // otherwise, will skip straight to clean up (clear selected and clicks) \n if (!clicks[0].eq(cell_coord)) {\n\n if (game.current_cell_state(cell_coord).state != SquareState.Empty ) {\n return;\n }\n \n // console.log(\"Your turn, first piece already picked, picking second\");\n \n clicks.push(cell_coord);\n \n if (clicks.length != 2) {\n setStatus(`Error: wrong number of clicks to process ${clicks.length}`);\n console.error(`Error: wrong number of clicks to process ${clicks.length}`);\n \n return;\n }\n\n let status = game.make_move(clicks[0], clicks[1]);\n\n switch(status) {\n case Moveable.Allowed:\n\n if (aiCheckBox.checked) {\n game.ai_move();\n nodeCountText.innerText = `searched ${game.last_node_count.toLocaleString(\"en-GB\")} possible moves`;\n }\n\n break;\n case Moveable.IllegalTrajectory:\n setStatus(\"You can't move like that!\");\n break;\n case Moveable.JumpingSameTeam:\n setStatus(\"You can't jump your own piece!\");\n break;\n case Moveable.NoJumpablePiece:\n setStatus(\"There's nothing to jump!\");\n break;\n case Moveable.OccupiedDest:\n setStatus(\"There's a piece there!\");\n break;\n case Moveable.OutOfBounds:\n setStatus(\"That square's not on the board! (how have you managed that?)\");\n break;\n case Moveable.UnoccupiedSrc:\n setStatus(\"There's no piece to move!\");\n break;\n case Moveable.Unplayable:\n setStatus(\"That's not a playable square!\");\n break;\n case Moveable.WrongTeamSrc:\n setStatus(\"That's not your piece!\");\n break;\n }\n \n }\n\n game.clear_selected();\n game.draw();\n clicks = [];\n current_state = GameState.HUMAN_TURN.THINKING;\n \n break;\n case GameState.AI_TURN:\n console.log(\"It's the AI's turn!\");\n break;\n }\n\n updateTeamText();\n updateWinningText();\n checkWon();\n}\n\nfunction getMousePos(canvas, evt) {\n var rect = canvas.getBoundingClientRect();\n return {\n x: evt.clientX - rect.left,\n y: evt.clientY - rect.top\n };\n}\n\nfunction setStatusText(txt, hide = true) {\n if(statusTimeout != null) {\n clearInterval(statusTimeout);\n }\n\n statusText.innerText = txt;\n\n if(hide) {\n statusTimeout = setTimeout(() => {\n statusText.innerText = \"\";\n }, STATUS_TIMEOUT);\n }\n}\n\nfunction setStatusAlert(txt, alertType = \"danger\", hide = true) {\n if(statusTimeout != null) {\n clearInterval(statusTimeout);\n }\n\n statusAlert.className = `alert alert-${alertType}`;\n statusAlert.innerText = txt;\n statusAlert.hidden = false;\n\n if(hide) {\n statusTimeout = setTimeout(() => {\n statusAlert.hidden = true;\n }, STATUS_TIMEOUT);\n }\n}\n\nfunction updateTeamText(){\n let team = game.current_turn();\n switch(team) {\n case Team.White:\n teamText.innerText = \"⚪ White ⚪\";\n break;\n case Team.Black:\n teamText.innerText = \"🔴 Black 🔴\";\n break;\n }\n}\n\nfunction updateWinningText(){\n \n switch(game.winning()) {\n case undefined:\n winningText.innerText = \"\";\n break;\n case Team.White:\n winningText.innerText = \"👑 White 👑\";\n break;\n case Team.Black:\n winningText.innerText = \"👑 Black 👑\";\n break;\n }\n}\n\nfunction checkWon() {\n\n switch(game.has_won()) {\n case undefined:\n break;\n case Team.White:\n setStatus(\"You Lost!\");\n wonTimeout = setInterval(() => {\n start_game();\n }, WON_TIMEOUT);\n break;\n case Team.Black:\n setStatus(\"You Won!\", \"success\");\n wonTimeout = setInterval(() => {\n start_game();\n }, WON_TIMEOUT);\n break;\n }\n}\n\n////////////////\n// UI\n////////////////\n\nconst widthBox = document.getElementById(\"width\");\n/**\n * Handler for width input box change, start a new game\n */\nconst onWidth = () => {\n\n BOARD_WIDTH = parseInt(widthBox.value);\n start_game();\n}\nwidthBox.onchange = onWidth;\nwidthBox.value = 8;\n\nconst heightBox = document.getElementById(\"height\");\n/**\n * Handler for height input box change, start a new game\n */\nconst onHeight = () => {\n\n BOARD_HEIGHT = parseInt(heightBox.value);\n pieceRowsBox.max = (BOARD_HEIGHT / 2) - 1;\n start_game();\n}\nheightBox.onchange = onHeight;\nheightBox.value = 8;\n\nconst pieceRowsBox = document.getElementById(\"play_rows\");\n/**\n * Handler for piece rows input box change, start a new game\n */\nconst onPieceRows = () => {\n\n PIECE_ROWS = parseInt(pieceRowsBox.value);\n start_game();\n}\npieceRowsBox.onchange = onPieceRows;\npieceRowsBox.value = 3;\n\nconst aiSearchDepthBox = document.getElementById(\"ai_search_depth\");\n/**\n * Handler for AI search depth input box change, start a new game\n */\nconst onAISearchDepth = () => {\n\n SEARCH_DEPTH = parseInt(aiSearchDepthBox.value);\n game.set_search_depth(SEARCH_DEPTH);\n\n if(SEARCH_DEPTH > 4) {\n setStatus(\"This increases thinking time exponentially, be careful (probably don't go past 6)\", \"warning\");\n }\n}\naiSearchDepthBox.onchange = onAISearchDepth;\naiSearchDepthBox.value = 4;\n\nconst aiCheckBox = document.getElementById(\"ai-checkbox\");\n/**\n * Handler for height input box change, get a new universe of given size\n */\nconst onAICheck = () => {\n \n}\naiCheckBox.onchange = onAICheck;\n// aiCheckBox.checked = true;"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://draught/../pkg/draught_bg.js","webpack://draught/./index.js"],"names":["heap","Array","fill","undefined","getObject","idx","push","heap_next","length","cachedTextDecoder","TextDecoder","module","require","ignoreBOM","fatal","decode","cachegetUint8Memory0","getUint8Memory0","buffer","Uint8Array","getStringFromWasm0","ptr","len","subarray","addHeapObject","obj","debugString","val","type","description","name","isArray","debug","i","builtInMatches","exec","toString","call","className","JSON","stringify","_","Error","message","stack","WASM_VECTOR_LEN","cachedTextEncoder","TextEncoder","encodeString","encodeInto","arg","view","buf","encode","set","read","written","passStringToWasm0","malloc","realloc","mem","offset","code","charCodeAt","slice","cachegetInt32Memory0","getInt32Memory0","Int32Array","isLikeNone","x","_assertClass","instance","klass","init_wasm","handleError","f","args","apply","this","e","Object","freeze","Move","Jump","Team","Black","White","SquareState","Man","King","Empty","Occupied","Unplayable","Moveable","Allowed","UnoccupiedSrc","OccupiedDest","OutOfBounds","WrongTeamSrc","IllegalTrajectory","NoJumpablePiece","JumpingSameTeam","Board","create","prototype","__destroy_into_raw","arg0","ret","Square","__wrap","square","ptr0","BrdIdx","row","col","from","to","ptr1","from_square_occupant","Piece","ptr2","team","jumpee","from_occ","width","height","current_turn","board","piece_rows","other","Game","search_depth","new_chance","first_turn","canvas_id","canvas_width","canvas_height","len0","value","Painter","canvas","strength","state","occupant","__wbindgen_object_drop_ref","dropObject","takeObject","__wbindgen_string_new","arg1","__wbg_new_59cb74e423758ede","__wbg_stack_558ba5917b466edd","__wbg_error_4bb6c2a97407129a","console","error","__wbg_self_86b4b13392c7af56","self","arguments","__wbg_require_f5521a5b85ad2542","arg2","__wbg_crypto_b8c92eaac23d0d80","crypto","__wbg_msCrypto_9ad6677321a08dd8","msCrypto","__wbindgen_is_undefined","__wbg_getRandomValues_dd27e6b0652b3236","getRandomValues","__wbg_getRandomValues_e57c9b75ddead065","__wbg_randomFillSync_d2ba53160aec6aba","randomFillSync","__wbg_static_accessor_MODULE_452b4680e8614c81","__wbg_instanceof_Window_11e25482011fc506","Window","__wbg_document_5aff8cd83ef968f5","document","__wbg_getElementById_b180ea4ada06a837","getElementById","__wbg_error_d95afd6217cfd219","__wbg_log_9a99fb1af846153b","log","__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b","CanvasRenderingContext2D","__wbg_setstrokeStyle_2939ee453716e462","strokeStyle","__wbg_setfillStyle_af790b5baf4d3210","fillStyle","__wbg_setlineWidth_3e6b1837ae38d099","lineWidth","__wbg_beginPath_2378575e37027ad3","beginPath","__wbg_fill_558339447ed6ad43","__wbg_stroke_c1e0313c58997dcf","stroke","__wbg_arc_fffd87d9113dce32","arg3","arg4","arg5","arc","__wbg_fillRect_46ffc8d2cef7e298","fillRect","__wbg_strokeRect_7ea34fad8a7f0fe2","strokeRect","__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792","HTMLCanvasElement","__wbg_setwidth_f3c88eb520ba8d47","__wbg_setheight_5a1abba41e35c42a","__wbg_getContext_813df131fcbd6e91","getContext","__wbg_newnoargs_9fdd8f3961dd1bee","Function","__wbg_call_ba36642bd901572b","__wbg_self_bb69a836a72ec6e9","__wbg_window_3304fc4b414c9693","window","__wbg_globalThis_e0d21cabc6630763","globalThis","__wbg_global_8463719227271676","g","global","__wbg_buffer_9e184d6f785de5ed","__wbg_new_e8101319e4cf95fc","__wbg_set_e8ae7b27314e8b98","__wbg_length_2d56cb37075fcfb1","__wbg_newwithlength_a8d1dbcbe703a5c6","__wbg_subarray_901ede8318da52a6","__wbindgen_object_clone_ref","__wbindgen_debug_string","__wbindgen_throw","__wbindgen_memory","BOARD_WIDTH","BOARD_HEIGHT","PIECE_ROWS","SEARCH_DEPTH","PERFECT_CHANCE","GameState","statusAlert","teamText","nodeCountText","winningText","onclick","start_game","wonTimeout","statusTimeout","setStatus","txt","alertType","hide","clearInterval","innerText","hidden","setTimeout","current_state","game","painter","clicks","set_painter","draw","updateTeamText","updateWinningText","winning","addEventListener","event","mousepos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","getMousePos","cell_coord","current_cell_state","set_selected","eq","make_move","aiCheckBox","checked","has_won","ai_move","last_node_count","toLocaleString","clear_selected","setInterval","checkWon","process_canvas_click","Math","floor","clientHeight","clientWidth","widthBox","onchange","parseInt","heightBox","pieceRowsBox","max","aiSearchDepthBox","set_search_depth","aiPerfectChance","set_perfect_chance"],"mappings":"0sBAEA,MAAMA,EAAO,IAAIC,MAAM,IAAIC,UAAKC,GAIhC,SAASC,EAAUC,GAAO,OAAOL,EAAKK,GAFtCL,EAAKM,UAAKH,EAAW,MAAM,GAAM,GAIjC,IAAII,EAAYP,EAAKQ,OAgBrB,IAAIC,EAAoB,IAFoB,oBAAhBC,aAA8B,EAAIC,EAAOC,SAAS,QAAQF,YAAcA,aAE3D,QAAS,CAAEG,WAAW,EAAMC,OAAO,IAE5EL,EAAkBM,SAElB,IAAIC,EAAuB,KAC3B,SAASC,IAIL,OAH6B,OAAzBD,GAAiCA,EAAqBE,SAAW,kBACjEF,EAAuB,IAAIG,WAAW,kBAEnCH,EAGX,SAASI,EAAmBC,EAAKC,GAC7B,OAAOb,EAAkBM,OAAOE,IAAkBM,SAASF,EAAKA,EAAMC,IAG1E,SAASE,EAAcC,GACflB,IAAcP,EAAKQ,QAAQR,EAAKM,KAAKN,EAAKQ,OAAS,GACvD,MAAMH,EAAME,EAIZ,OAHAA,EAAYP,EAAKK,GAEjBL,EAAKK,GAAOoB,EACLpB,EAGX,SAASqB,EAAYC,GAEjB,MAAMC,SAAcD,EACpB,GAAY,UAARC,GAA4B,WAARA,GAA4B,MAAPD,EACzC,MAAQ,GAAGA,IAEf,GAAY,UAARC,EACA,MAAO,IAAID,KAEf,GAAY,UAARC,EAAkB,CAClB,MAAMC,EAAcF,EAAIE,YACxB,OAAmB,MAAfA,EACO,SAEA,UAAUA,KAGzB,GAAY,YAARD,EAAoB,CACpB,MAAME,EAAOH,EAAIG,KACjB,MAAmB,iBAARA,GAAoBA,EAAKtB,OAA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["import * as wasm from './draught_bg.wasm';\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n return instance.ptr;\n}\n/**\n*/\nexport function init_wasm() {\n wasm.init_wasm();\n}\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_exn_store(addHeapObject(e));\n }\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* Move/Jump, for use in Move\n*/\nexport const MoveType = Object.freeze({ Move:0,\"0\":\"Move\",Jump:1,\"1\":\"Jump\", });\n/**\n* Black/White\n*/\nexport const Team = Object.freeze({ Black:0,\"0\":\"Black\",White:1,\"1\":\"White\", });\n/**\n* Man/King\n*/\nexport const Strength = Object.freeze({ Man:0,\"0\":\"Man\",King:1,\"1\":\"King\", });\n/**\n* Model board square as Empty/Occupied/Unplayable\n*/\nexport const SquareState = Object.freeze({ Empty:0,\"0\":\"Empty\",Occupied:1,\"1\":\"Occupied\",Unplayable:2,\"2\":\"Unplayable\", });\n/**\n* Possible outcomes of trying to move\n*/\nexport const Moveable = Object.freeze({ Allowed:0,\"0\":\"Allowed\",UnoccupiedSrc:1,\"1\":\"UnoccupiedSrc\",OccupiedDest:2,\"2\":\"OccupiedDest\",OutOfBounds:3,\"3\":\"OutOfBounds\",Unplayable:4,\"4\":\"Unplayable\",WrongTeamSrc:5,\"5\":\"WrongTeamSrc\",IllegalTrajectory:6,\"6\":\"IllegalTrajectory\",NoJumpablePiece:7,\"7\":\"NoJumpablePiece\",JumpingSameTeam:8,\"8\":\"JumpingSameTeam\", });\n/**\n* Single state of a checkers board\n*/\nexport class Board {\n\n static __wrap(ptr) {\n const obj = Object.create(Board.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_board_free(ptr);\n }\n /**\n * @returns {number}\n */\n get width() {\n var ret = wasm.__wbg_get_board_width(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set width(arg0) {\n wasm.__wbg_set_board_width(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get height() {\n var ret = wasm.__wbg_get_board_height(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set height(arg0) {\n wasm.__wbg_set_board_height(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get current_turn() {\n var ret = wasm.__wbg_get_board_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set current_turn(arg0) {\n wasm.__wbg_set_board_current_turn(this.ptr, arg0);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @returns {Square}\n */\n cell(idx) {\n var ret = wasm.board_cell(this.ptr, idx);\n return Square.__wrap(ret);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @param {Square} square\n */\n set_cell(idx, square) {\n _assertClass(square, Square);\n var ptr0 = square.ptr;\n square.ptr = 0;\n wasm.board_set_cell(this.ptr, idx, ptr0);\n }\n /**\n * Get a copy of a board square by 2D [`BrdIdx`] index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n grid_cell(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_grid_cell(this.ptr, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {number} row\n * @param {number} col\n * @returns {number}\n */\n cell_index(row, col) {\n var ret = wasm.board_cell_index(this.ptr, row, col);\n return ret >>> 0;\n }\n /**\n * Similar to [`Board::cell_index`] but with a [`BrdIdx`] instead of separate indices. Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {BrdIdx} idx\n * @returns {number}\n */\n cell_idx(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_cell_idx(this.ptr, ptr0);\n return ret >>> 0;\n }\n /**\n * Transform a 1D array index (for [`Board::cells`]) into a 2D game board index (by row/col)\n * @param {number} idx\n * @returns {BrdIdx}\n */\n board_index(idx) {\n var ret = wasm.board_board_index(this.ptr, idx);\n return BrdIdx.__wrap(ret);\n }\n /**\n * Check whether a move given by source and destination indices is legal\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n can_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_can_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Check that given move trajectory is valid for a man piece\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_man_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_man_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * Check that given move trajectory is valid for a king piece\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_king_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_king_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * Get cell index of jumpee square given from and to locations\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n jumpee_idx(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_jumpee_idx(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Get a pointer to the backing array of board squares, [`Board::cells`]\n * @returns {number}\n */\n cells() {\n var ret = wasm.board_cells(this.ptr);\n return ret;\n }\n /**\n * Get the number of board squares\n * @returns {number}\n */\n num_cells() {\n var ret = wasm.board_num_cells(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces\n * @returns {number}\n */\n num_pieces() {\n var ret = wasm.board_num_pieces(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces for a player\n * @param {number} team\n * @returns {number}\n */\n num_player(team) {\n var ret = wasm.board_num_player(this.ptr, team);\n return ret >>> 0;\n }\n /**\n * Get the score value, Black - White pieces\n * @returns {number}\n */\n score() {\n var ret = wasm.board_score(this.ptr);\n return ret;\n }\n /**\n * Get the state of a board square by 1D array index\n * @param {number} idx\n * @returns {number}\n */\n cell_state(idx) {\n var ret = wasm.board_cell_state(this.ptr, idx);\n return ret >>> 0;\n }\n /**\n * Get new board derived from current with given move applied\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_move(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * Get new board derived from current with given jump applied\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_jump(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * Get row index for current team, top row for black, bottom row for white\n * @returns {number}\n */\n king_row_idx() {\n var ret = wasm.board_king_row_idx(this.ptr);\n return ret >>> 0;\n }\n /**\n * Unwrap the jumpee piece from the square and [`Board::check_jumpee_team`] with [`Moveable`] response\n * @param {Square} jumpee\n * @param {Piece} from_occ\n * @returns {number}\n */\n static validate_jumpee(jumpee, from_occ) {\n _assertClass(jumpee, Square);\n var ptr0 = jumpee.ptr;\n jumpee.ptr = 0;\n _assertClass(from_occ, Piece);\n var ptr1 = from_occ.ptr;\n from_occ.ptr = 0;\n var ret = wasm.board_validate_jumpee(ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Check that the source piece and the jumpee are of opposing teams\n * @param {Piece} from\n * @param {Piece} jumpee\n * @returns {boolean}\n */\n static check_jumpee_team(from, jumpee) {\n _assertClass(from, Piece);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(jumpee, Piece);\n var ptr1 = jumpee.ptr;\n jumpee.ptr = 0;\n var ret = wasm.board_check_jumpee_team(ptr0, ptr1);\n return ret !== 0;\n }\n /**\n * Initialise a game board without game pieces\n * @param {number} width\n * @param {number} height\n * @param {number} current_turn\n */\n constructor(width, height, current_turn) {\n var ret = wasm.board_new(width, height, current_turn);\n return Board.__wrap(ret);\n }\n /**\n * Reset the given board to a starting layout with 3 rows of opposing pieces\n * @param {Board} board\n * @param {number} piece_rows\n * @returns {Board}\n */\n static init_game(board, piece_rows) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n var ret = wasm.board_init_game(ptr0, piece_rows);\n return Board.__wrap(ret);\n }\n}\n/**\n* Rank 2 tensor index to identify a board square by row and column\n*/\nexport class BrdIdx {\n\n static __wrap(ptr) {\n const obj = Object.create(BrdIdx.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_brdidx_free(ptr);\n }\n /**\n * @returns {number}\n */\n get row() {\n var ret = wasm.__wbg_get_brdidx_row(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set row(arg0) {\n wasm.__wbg_set_brdidx_row(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get col() {\n var ret = wasm.__wbg_get_brdidx_col(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set col(arg0) {\n wasm.__wbg_set_brdidx_col(this.ptr, arg0);\n }\n /**\n * @param {number} row\n * @param {number} col\n */\n constructor(row, col) {\n var ret = wasm.brdidx_from(row, col);\n return BrdIdx.__wrap(ret);\n }\n /**\n * @param {BrdIdx} other\n * @returns {boolean}\n */\n eq(other) {\n _assertClass(other, BrdIdx);\n var ret = wasm.brdidx_eq(this.ptr, other.ptr);\n return ret !== 0;\n }\n}\n/**\n* Root-level structure for managing the game as a collection of board states\n*/\nexport class Game {\n\n static __wrap(ptr) {\n const obj = Object.create(Game.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_game_free(ptr);\n }\n /**\n * @returns {number}\n */\n get last_node_count() {\n var ret = wasm.__wbg_get_game_last_node_count(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set last_node_count(arg0) {\n wasm.__wbg_set_game_last_node_count(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get perfect_chance() {\n var ret = wasm.__wbg_get_game_perfect_chance(this.ptr);\n return ret;\n }\n /**\n * @param {number} arg0\n */\n set perfect_chance(arg0) {\n wasm.__wbg_set_game_perfect_chance(this.ptr, arg0);\n }\n /**\n * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_cells() {\n var ret = wasm.game_current_board_cells(this.ptr);\n return ret;\n }\n /**\n * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_len() {\n var ret = wasm.game_current_board_len(this.ptr);\n return ret >>> 0;\n }\n /**\n * Current turn's team\n * @returns {number}\n */\n current_turn() {\n var ret = wasm.game_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * Current board's score\n * @returns {number}\n */\n score() {\n var ret = wasm.game_score(this.ptr);\n return ret;\n }\n /**\n * Get currently winning player\n * @returns {number | undefined}\n */\n winning() {\n var ret = wasm.game_winning(this.ptr);\n return ret === 2 ? undefined : ret;\n }\n /**\n * Check if a player has won\n * @returns {number | undefined}\n */\n has_won() {\n var ret = wasm.game_has_won(this.ptr);\n return ret === 2 ? undefined : ret;\n }\n /**\n * Get square on current board for given index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n current_cell_state(idx) {\n _assertClass(idx, BrdIdx);\n var ret = wasm.game_current_cell_state(this.ptr, idx.ptr);\n return Square.__wrap(ret);\n }\n /**\n * Set tree depth for AI to search to\n * @param {number} search_depth\n */\n set_search_depth(search_depth) {\n wasm.game_set_search_depth(this.ptr, search_depth);\n }\n /**\n * Set given index as selected piece\n * TODO: Check whether valid square?\n * @param {BrdIdx} idx\n */\n set_selected(idx) {\n _assertClass(idx, BrdIdx);\n wasm.game_set_selected(this.ptr, idx.ptr);\n }\n /**\n * Set proportion of perfect moves from AI\n * @param {number} new_chance\n */\n set_perfect_chance(new_chance) {\n wasm.game_set_perfect_chance(this.ptr, new_chance);\n }\n /**\n * Clear currently selected piece\n */\n clear_selected() {\n wasm.game_clear_selected(this.ptr);\n }\n /**\n * Attempt to make a move given a source and destination index\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n make_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.game_make_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Update board state with given move and push new board into current state\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n */\n execute_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n wasm.game_execute_move(this.ptr, ptr0, ptr1);\n }\n /**\n * Update board state with given jump move and push new board into current state\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n */\n execute_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n wasm.game_execute_jump(this.ptr, ptr0, ptr1);\n }\n /**\n * Push current board into the previous turns and set given board to current\n * @param {Board} board\n */\n push_new_board(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n wasm.game_push_new_board(this.ptr, ptr0);\n }\n /**\n * Set current board to given\n * @param {Board} board\n */\n set_current(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n wasm.game_set_current(this.ptr, ptr0);\n }\n /**\n * Get new game without board renderer\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\n * @param {number} search_depth\n */\n constructor(width, height, piece_rows, first_turn, search_depth) {\n var ret = wasm.game_new(width, height, piece_rows, first_turn, search_depth);\n return Game.__wrap(ret);\n }\n /**\n * Get a new game with canvas ID and dimensions\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\n * @param {number} search_depth\n * @param {string} canvas_id\n * @param {number} canvas_width\n * @param {number} canvas_height\n * @returns {Game}\n */\n static new_with_canvas(width, height, piece_rows, first_turn, search_depth, canvas_id, canvas_width, canvas_height) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.game_new_with_canvas(width, height, piece_rows, first_turn, search_depth, ptr0, len0, canvas_width, canvas_height);\n return Game.__wrap(ret);\n }\n /**\n * Set painter for rendering boards\n * @param {Painter} value\n */\n set_painter(value) {\n _assertClass(value, Painter);\n var ptr0 = value.ptr;\n value.ptr = 0;\n wasm.game_set_painter(this.ptr, ptr0);\n }\n /**\n * Draw current board using painter if exists\n */\n draw() {\n wasm.game_draw(this.ptr);\n }\n /**\n * Create computer, get move from current board and update current board\n */\n ai_move() {\n wasm.game_ai_move(this.ptr);\n }\n}\n/**\n* Used to paint boards onto HTML canvases\n*/\nexport class Painter {\n\n static __wrap(ptr) {\n const obj = Object.create(Painter.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_painter_free(ptr);\n }\n /**\n * Default constructor which queries for canvas by ID\n * @param {number} width\n * @param {number} height\n * @param {string} canvas_id\n */\n constructor(width, height, canvas_id) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.painter_new(width, height, ptr0, len0);\n return Painter.__wrap(ret);\n }\n /**\n * Constructor with given canvas element\n * @param {number} width\n * @param {number} height\n * @param {HTMLCanvasElement} canvas\n * @returns {Painter}\n */\n static new_with_canvas(width, height, canvas) {\n var ret = wasm.painter_new_with_canvas(width, height, addHeapObject(canvas));\n return Painter.__wrap(ret);\n }\n /**\n * Set new square outline colour value\n * @param {any} value\n */\n set_square_outline(value) {\n wasm.painter_set_square_outline(this.ptr, addHeapObject(value));\n }\n /**\n * Set new line width for outlining squares\n * @param {number} value\n */\n set_outline_width(value) {\n wasm.painter_set_outline_width(this.ptr, value);\n }\n /**\n * Set whether squares are outlined\n * @param {boolean} value\n */\n set_draw_outline(value) {\n wasm.painter_set_draw_outline(this.ptr, value);\n }\n /**\n * Reset the canvas dimensions to the given width and height\n */\n reset_dimensions() {\n wasm.painter_reset_dimensions(this.ptr);\n }\n /**\n * Check whether given canvas dimensions divide evenly by given board dimenions\n * @param {Board} board\n * @returns {boolean}\n */\n validate_board_dim(board) {\n _assertClass(board, Board);\n var ret = wasm.painter_validate_board_dim(this.ptr, board.ptr);\n return ret !== 0;\n }\n /**\n * Draw a board onto the canvas\n * @param {Board} board\n */\n draw(board) {\n _assertClass(board, Board);\n wasm.painter_draw(this.ptr, board.ptr);\n }\n}\n/**\n* Game piece given by its team and strength (normal or kinged)\n*/\nexport class Piece {\n\n static __wrap(ptr) {\n const obj = Object.create(Piece.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_piece_free(ptr);\n }\n /**\n * @returns {number}\n */\n get team() {\n var ret = wasm.__wbg_get_piece_team(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set team(arg0) {\n wasm.__wbg_set_piece_team(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get strength() {\n var ret = wasm.__wbg_get_piece_strength(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set strength(arg0) {\n wasm.__wbg_set_piece_strength(this.ptr, arg0);\n }\n /**\n * @param {number} team\n * @param {number} strength\n */\n constructor(team, strength) {\n var ret = wasm.piece_new(team, strength);\n return Piece.__wrap(ret);\n }\n}\n/**\n* Board squares given by a state and a possible occupying game piece\n*/\nexport class Square {\n\n static __wrap(ptr) {\n const obj = Object.create(Square.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_square_free(ptr);\n }\n /**\n * Game piece if square is occupied\n * @returns {Piece | undefined}\n */\n get occupant() {\n var ret = wasm.__wbg_get_square_occupant(this.ptr);\n return ret === 0 ? undefined : Piece.__wrap(ret);\n }\n /**\n * Game piece if square is occupied\n * @param {Piece | undefined} arg0\n */\n set occupant(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Piece);\n ptr0 = arg0.ptr;\n arg0.ptr = 0;\n }\n wasm.__wbg_set_square_occupant(this.ptr, ptr0);\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @returns {number}\n */\n get state() {\n var ret = wasm.__wbg_get_square_state(this.ptr);\n return ret >>> 0;\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @param {number} arg0\n */\n set state(arg0) {\n wasm.__wbg_set_square_state(this.ptr, arg0);\n }\n /**\n * Standard constructor function to form square from state and occupant\n * @param {number} state\n * @param {Piece | undefined} occupant\n */\n constructor(state, occupant) {\n let ptr0 = 0;\n if (!isLikeNone(occupant)) {\n _assertClass(occupant, Piece);\n ptr0 = occupant.ptr;\n occupant.ptr = 0;\n }\n var ret = wasm.square_new(state, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed piece square by team and strength\n * @param {number} team\n * @param {number} strength\n * @returns {Square}\n */\n static pc(team, strength) {\n var ret = wasm.square_pc(team, strength);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed empty square\n * @returns {Square}\n */\n static empty() {\n var ret = wasm.square_empty();\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed unplayable square\n * @returns {Square}\n */\n static unplay() {\n var ret = wasm.square_unplay();\n return Square.__wrap(ret);\n }\n}\n\nexport function __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nexport function __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nexport function __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(arg0, arg1);\n }\n};\n\nexport function __wbg_self_86b4b13392c7af56() { return handleError(function () {\n var ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_require_f5521a5b85ad2542(arg0, arg1, arg2) {\n var ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));\n return addHeapObject(ret);\n};\n\nexport function __wbg_crypto_b8c92eaac23d0d80(arg0) {\n var ret = getObject(arg0).crypto;\n return addHeapObject(ret);\n};\n\nexport function __wbg_msCrypto_9ad6677321a08dd8(arg0) {\n var ret = getObject(arg0).msCrypto;\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_is_undefined(arg0) {\n var ret = getObject(arg0) === undefined;\n return ret;\n};\n\nexport function __wbg_getRandomValues_dd27e6b0652b3236(arg0) {\n var ret = getObject(arg0).getRandomValues;\n return addHeapObject(ret);\n};\n\nexport function __wbg_getRandomValues_e57c9b75ddead065(arg0, arg1) {\n getObject(arg0).getRandomValues(getObject(arg1));\n};\n\nexport function __wbg_randomFillSync_d2ba53160aec6aba(arg0, arg1, arg2) {\n getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));\n};\n\nexport function __wbg_static_accessor_MODULE_452b4680e8614c81() {\n var ret = module;\n return addHeapObject(ret);\n};\n\nexport function __wbg_instanceof_Window_11e25482011fc506(arg0) {\n var ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nexport function __wbg_document_5aff8cd83ef968f5(arg0) {\n var ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_getElementById_b180ea4ada06a837(arg0, arg1, arg2) {\n var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_error_d95afd6217cfd219(arg0) {\n console.error(getObject(arg0));\n};\n\nexport function __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nexport function __wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b(arg0) {\n var ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n return ret;\n};\n\nexport function __wbg_setstrokeStyle_2939ee453716e462(arg0, arg1) {\n getObject(arg0).strokeStyle = getObject(arg1);\n};\n\nexport function __wbg_setfillStyle_af790b5baf4d3210(arg0, arg1) {\n getObject(arg0).fillStyle = getObject(arg1);\n};\n\nexport function __wbg_setlineWidth_3e6b1837ae38d099(arg0, arg1) {\n getObject(arg0).lineWidth = arg1;\n};\n\nexport function __wbg_beginPath_2378575e37027ad3(arg0) {\n getObject(arg0).beginPath();\n};\n\nexport function __wbg_fill_558339447ed6ad43(arg0) {\n getObject(arg0).fill();\n};\n\nexport function __wbg_stroke_c1e0313c58997dcf(arg0) {\n getObject(arg0).stroke();\n};\n\nexport function __wbg_arc_fffd87d9113dce32() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {\n getObject(arg0).arc(arg1, arg2, arg3, arg4, arg5);\n}, arguments) };\n\nexport function __wbg_fillRect_46ffc8d2cef7e298(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).fillRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_strokeRect_7ea34fad8a7f0fe2(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792(arg0) {\n var ret = getObject(arg0) instanceof HTMLCanvasElement;\n return ret;\n};\n\nexport function __wbg_setwidth_f3c88eb520ba8d47(arg0, arg1) {\n getObject(arg0).width = arg1 >>> 0;\n};\n\nexport function __wbg_setheight_5a1abba41e35c42a(arg0, arg1) {\n getObject(arg0).height = arg1 >>> 0;\n};\n\nexport function __wbg_getContext_813df131fcbd6e91() { return handleError(function (arg0, arg1, arg2) {\n var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_newnoargs_9fdd8f3961dd1bee(arg0, arg1) {\n var ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nexport function __wbg_call_ba36642bd901572b() { return handleError(function (arg0, arg1) {\n var ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_self_bb69a836a72ec6e9() { return handleError(function () {\n var ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_window_3304fc4b414c9693() { return handleError(function () {\n var ret = window.window;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_globalThis_e0d21cabc6630763() { return handleError(function () {\n var ret = globalThis.globalThis;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_global_8463719227271676() { return handleError(function () {\n var ret = global.global;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_buffer_9e184d6f785de5ed(arg0) {\n var ret = getObject(arg0).buffer;\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_e8101319e4cf95fc(arg0) {\n var ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n};\n\nexport function __wbg_set_e8ae7b27314e8b98(arg0, arg1, arg2) {\n getObject(arg0).set(getObject(arg1), arg2 >>> 0);\n};\n\nexport function __wbg_length_2d56cb37075fcfb1(arg0) {\n var ret = getObject(arg0).length;\n return ret;\n};\n\nexport function __wbg_newwithlength_a8d1dbcbe703a5c6(arg0) {\n var ret = new Uint8Array(arg0 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbg_subarray_901ede8318da52a6(arg0, arg1, arg2) {\n var ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_object_clone_ref(arg0) {\n var ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n var ret = debugString(getObject(arg1));\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\nexport function __wbindgen_memory() {\n var ret = wasm.memory;\n return addHeapObject(ret);\n};\n\n","import { Game, Board, BrdIdx, Painter, Team, init_wasm, Moveable, SquareState, Square } from \"draught\";\n// import { memory } from \"draught/draught_bg.wasm\";\n\n///////////////////\n// CONSTS\n///////////////////\n\nconst CANVAS_WIDTH = 720;\nconst CANVAS_HEIGHT = 720;\n\nvar BOARD_WIDTH = 8;\nvar BOARD_HEIGHT = 8;\n\nvar PIECE_ROWS = 3;\nvar SEARCH_DEPTH = 4;\nvar PERFECT_CHANCE = 0.5;\n\nconst STATUS_TIMEOUT = 3000;\nconst WON_TIMEOUT = 3000;\n\nconst GameState = {\n HUMAN_TURN: {\n THINKING: \"human_turn.thinking\",\n FROM_SELECTED: \"human_turn.from_selected\"\n },\n AI_TURN: \"ai_turn\"\n}\n\n//////////////////\n// GAME STUFF\n//////////////////\n\ninit_wasm();\n\n// let board = new Board(BOARD_WIDTH, BOARD_HEIGHT, Team.Black);\n\nconst statusText = document.getElementById(\"status-p\");\nconst statusAlert = document.getElementById(\"status-d\");\nconst teamText = document.getElementById(\"team-p\");\nconst nodeCountText = document.getElementById(\"node-count\");\nconst winningText = document.getElementById(\"winning-p\");\n\nconst startBtn = document.getElementById(\"startBtn\");\nstartBtn.onclick = start_game;\n\nlet wonTimeout = null;\nlet statusTimeout = null;\nlet setStatus = setStatusAlert;\n\nlet current_state = GameState.HUMAN_TURN.THINKING;\n\nlet game = null;\nlet painter = null;\n\nlet clicks = [];\n\nstart_game();\n\n/////////////////\n// CANVAS\n/////////////////\n\nconst canvas = document.getElementById(\"game-canvas\");\ncanvas.addEventListener(\"click\", (event) => {\n var mousepos = getMousePos(canvas, event);\n // console.log(mousepos);\n var cell = new BrdIdx(\n Math.floor((mousepos.y / canvas.clientHeight) * BOARD_HEIGHT),\n Math.floor((mousepos.x / canvas.clientWidth) * BOARD_WIDTH),\n );\n // console.log(cell);\n process_canvas_click(cell);\n});\n\n////////////////\n// FUNCS\n////////////////\n\nfunction start_game() {\n game = new Game(BOARD_WIDTH, BOARD_HEIGHT, PIECE_ROWS, Team.Black, SEARCH_DEPTH);\n painter = new Painter(CANVAS_WIDTH, CANVAS_HEIGHT, \"game-canvas\");\n game.set_painter(painter);\n game.draw();\n\n clearInterval(wonTimeout);\n updateTeamText();\n updateWinningText();\n clicks = [];\n current_state = GameState.HUMAN_TURN.THINKING;\n}\n\nfunction process_canvas_click(cell_coord) {\n\n switch(current_state) {\n // first click of a move\n case GameState.HUMAN_TURN.THINKING:\n if (game.current_cell_state(cell_coord).state != SquareState.Occupied ) {\n return;\n }\n\n if (game.current_cell_state(cell_coord).occupant.team != game.current_turn() ) {\n return;\n }\n\n // console.log(\"Your turn, first piece picked\");\n\n clicks.push(cell_coord);\n current_state = GameState.HUMAN_TURN.FROM_SELECTED;\n game.set_selected(cell_coord);\n game.draw();\n \n break;\n \n // second click of a move\n case GameState.HUMAN_TURN.FROM_SELECTED:\n\n // second click is different to first, process as move\n // otherwise, will skip straight to clean up (clear selected and clicks) \n if (!clicks[0].eq(cell_coord)) {\n\n if (game.current_cell_state(cell_coord).state != SquareState.Empty ) {\n return;\n }\n \n // console.log(\"Your turn, first piece already picked, picking second\");\n \n clicks.push(cell_coord);\n \n if (clicks.length != 2) {\n setStatus(`Error: wrong number of clicks to process ${clicks.length}`);\n console.error(`Error: wrong number of clicks to process ${clicks.length}`);\n \n return;\n }\n\n let status = game.make_move(clicks[0], clicks[1]);\n\n switch(status) {\n case Moveable.Allowed:\n\n if (aiCheckBox.checked && game.has_won() === undefined) {\n game.ai_move();\n nodeCountText.innerText = `searched ${game.last_node_count.toLocaleString(\"en-GB\")} possible moves`;\n }\n\n break;\n case Moveable.IllegalTrajectory:\n setStatus(\"You can't move like that!\");\n break;\n case Moveable.JumpingSameTeam:\n setStatus(\"You can't jump your own piece!\");\n break;\n case Moveable.NoJumpablePiece:\n setStatus(\"There's nothing to jump!\");\n break;\n case Moveable.OccupiedDest:\n setStatus(\"There's a piece there!\");\n break;\n case Moveable.OutOfBounds:\n setStatus(\"That square's not on the board! (how have you managed that?)\");\n break;\n case Moveable.UnoccupiedSrc:\n setStatus(\"There's no piece to move!\");\n break;\n case Moveable.Unplayable:\n setStatus(\"That's not a playable square!\");\n break;\n case Moveable.WrongTeamSrc:\n setStatus(\"That's not your piece!\");\n break;\n }\n \n }\n\n game.clear_selected();\n game.draw();\n clicks = [];\n current_state = GameState.HUMAN_TURN.THINKING;\n \n break;\n case GameState.AI_TURN:\n console.log(\"It's the AI's turn!\");\n break;\n }\n\n updateTeamText();\n updateWinningText();\n checkWon();\n}\n\nfunction getMousePos(canvas, evt) {\n var rect = canvas.getBoundingClientRect();\n return {\n x: evt.clientX - rect.left,\n y: evt.clientY - rect.top\n };\n}\n\nfunction setStatusText(txt, hide = true) {\n if(statusTimeout != null) {\n clearInterval(statusTimeout);\n }\n\n statusText.innerText = txt;\n\n if(hide) {\n statusTimeout = setTimeout(() => {\n statusText.innerText = \"\";\n }, STATUS_TIMEOUT);\n }\n}\n\nfunction setStatusAlert(txt, alertType = \"danger\", hide = true) {\n if(statusTimeout != null) {\n clearInterval(statusTimeout);\n }\n\n statusAlert.className = `alert alert-${alertType}`;\n statusAlert.innerText = txt;\n statusAlert.hidden = false;\n\n if(hide) {\n statusTimeout = setTimeout(() => {\n statusAlert.hidden = true;\n }, STATUS_TIMEOUT);\n }\n}\n\nfunction updateTeamText(){\n let team = game.current_turn();\n switch(team) {\n case Team.White:\n teamText.innerText = \"⚪ White ⚪\";\n break;\n case Team.Black:\n teamText.innerText = \"🔴 Black 🔴\";\n break;\n }\n}\n\nfunction updateWinningText(){\n \n switch(game.winning()) {\n case undefined:\n winningText.innerText = \"\";\n break;\n case Team.White:\n winningText.innerText = \"👑 White 👑\";\n break;\n case Team.Black:\n winningText.innerText = \"👑 Black 👑\";\n break;\n }\n}\n\nfunction checkWon() {\n\n switch(game.has_won()) {\n case undefined:\n break;\n case Team.White:\n setStatus(\"You Lost!\");\n wonTimeout = setInterval(() => {\n start_game();\n }, WON_TIMEOUT);\n break;\n case Team.Black:\n setStatus(\"You Won!\", \"success\");\n wonTimeout = setInterval(() => {\n start_game();\n }, WON_TIMEOUT);\n break;\n }\n}\n\n////////////////\n// UI\n////////////////\n\nconst widthBox = document.getElementById(\"width\");\n/**\n * Handler for width input box change, start a new game\n */\nconst onWidth = () => {\n\n BOARD_WIDTH = parseInt(widthBox.value);\n start_game();\n}\nwidthBox.onchange = onWidth;\nwidthBox.value = 8;\n\nconst heightBox = document.getElementById(\"height\");\n/**\n * Handler for height input box change, start a new game\n */\nconst onHeight = () => {\n\n BOARD_HEIGHT = parseInt(heightBox.value);\n pieceRowsBox.max = (BOARD_HEIGHT / 2) - 1;\n start_game();\n}\nheightBox.onchange = onHeight;\nheightBox.value = 8;\n\nconst pieceRowsBox = document.getElementById(\"play_rows\");\n/**\n * Handler for piece rows input box change, start a new game\n */\nconst onPieceRows = () => {\n\n PIECE_ROWS = parseInt(pieceRowsBox.value);\n start_game();\n}\npieceRowsBox.onchange = onPieceRows;\npieceRowsBox.value = 3;\n\nconst aiSearchDepthBox = document.getElementById(\"ai_search_depth\");\n/**\n * Handler for AI search depth input box change, start a new game\n */\nconst onAISearchDepth = () => {\n\n SEARCH_DEPTH = parseInt(aiSearchDepthBox.value);\n game.set_search_depth(SEARCH_DEPTH);\n\n if(SEARCH_DEPTH > 4) {\n setStatus(\"This increases thinking time exponentially, be careful (probably don't go past 6)\", \"warning\");\n }\n}\naiSearchDepthBox.onchange = onAISearchDepth;\naiSearchDepthBox.value = 4;\n\nconst aiCheckBox = document.getElementById(\"ai-checkbox\");\n/**\n * Handler for height input box change, get a new universe of given size\n */\nconst onAICheck = () => {\n \n}\naiCheckBox.onchange = onAICheck;\n// aiCheckBox.checked = true;\n\nconst aiPerfectChance = document.getElementById(\"ai_difficulty\");\n/**\n * Handler for piece rows input box change, start a new game\n */\nconst onPerfectChance = () => {\n\n PERFECT_CHANCE = parseInt(aiPerfectChance.value) / 100;\n game.set_perfect_chance(PERFECT_CHANCE);\n}\naiPerfectChance.onchange = onPerfectChance;\naiPerfectChance.value = 50;"],"sourceRoot":""} \ No newline at end of file diff --git a/1f6adaf6c2dc4c9caead.module.wasm b/1f6adaf6c2dc4c9caead.module.wasm new file mode 100644 index 0000000..e51c5ac Binary files /dev/null and b/1f6adaf6c2dc4c9caead.module.wasm differ diff --git a/a9e080695052ab7978e6.module.wasm b/a9e080695052ab7978e6.module.wasm deleted file mode 100644 index 2c6bc44..0000000 Binary files a/a9e080695052ab7978e6.module.wasm and /dev/null differ diff --git a/doc/draught/all.html b/doc/draught/all.html index cbfd5df..c46f42b 100644 --- a/doc/draught/all.html +++ b/doc/draught/all.html @@ -3,5 +3,5 @@

List of all items[] -

Structs

Enums

Macros

Functions

Constants

+

Structs

Enums

Macros

Functions

Constants

\ No newline at end of file diff --git a/doc/draught/comp/index.html b/doc/draught/comp/index.html index e3540fa..e39fd3c 100644 --- a/doc/draught/comp/index.html +++ b/doc/draught/comp/index.html @@ -1,7 +1,7 @@ draught::comp - Rust

Module draught::comp[][src]

AI player logic

+ Change settings

Module draught::comp[][src]

AI player logic

Structs

BoardNode

For storing boards in the AI tree, stores board with score for comparisons

Computer

Root-level structure for managing the game as a collection of board states

diff --git a/doc/draught/comp/struct.BoardNode.html b/doc/draught/comp/struct.BoardNode.html index 48dbcb4..1909936 100644 --- a/doc/draught/comp/struct.BoardNode.html +++ b/doc/draught/comp/struct.BoardNode.html @@ -1,18 +1,18 @@ BoardNode in draught::comp - Rust

Struct draught::comp::BoardNode[][src]

pub struct BoardNode {
+                Change settings

Struct draught::comp::BoardNode[][src]

pub struct BoardNode {
     pub board: Board,
     pub score: isize,
 }

For storing boards in the AI tree, stores board with score for comparisons

- Fields

board: Boardscore: isize

Implementations

impl BoardNode[src]

pub fn new(board: Board, score: isize) -> BoardNode[src]

pub fn brd(board: Board) -> BoardNode[src]

Trait Implementations

impl Clone for BoardNode[src]

paint

Components for painting board states onto HTML canvases

utils

Macros

log

Wrap the web_sys access to the browser console in a macro for easy logging

-

Functions

+log_error

Functions

__wasm_bindgen_generated_init_wasm
init_wasm
\ No newline at end of file diff --git a/doc/draught/macro.log_error!.html b/doc/draught/macro.log_error!.html new file mode 100644 index 0000000..9c19de2 --- /dev/null +++ b/doc/draught/macro.log_error!.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to macro.log_error.html...

+ + + \ No newline at end of file diff --git a/doc/draught/macro.log_error.html b/doc/draught/macro.log_error.html new file mode 100644 index 0000000..1942507 --- /dev/null +++ b/doc/draught/macro.log_error.html @@ -0,0 +1,9 @@ +log_error in draught - Rust + +

Macro draught::log_error[][src]

+macro_rules! log_error {
+    ( $( $t:tt )* ) => { ... };
+}
+
+ \ No newline at end of file diff --git a/doc/draught/paint/constant.OUTLINE_WIDTH.html b/doc/draught/paint/constant.OUTLINE_WIDTH.html index 27b0b9f..900c588 100644 --- a/doc/draught/paint/constant.OUTLINE_WIDTH.html +++ b/doc/draught/paint/constant.OUTLINE_WIDTH.html @@ -1,6 +1,6 @@ -OUTLINE_WIDTH in draught::paint - Rust +OUTLINE_WIDTH in draught::paint - Rust

Constant draught::paint::OUTLINE_WIDTH[][src]

const OUTLINE_WIDTH: f64 = 3.0;

Line width when outlining black squares

+ Change settings

Constant draught::paint::OUTLINE_WIDTH[][src]

const OUTLINE_WIDTH: f64 = 0.05;

Line width when outlining black squares as proportion of min cell dimension

\ No newline at end of file diff --git a/doc/draught/paint/constant.PIECE_MARGIN.html b/doc/draught/paint/constant.PIECE_MARGIN.html deleted file mode 100644 index 16dacc3..0000000 --- a/doc/draught/paint/constant.PIECE_MARGIN.html +++ /dev/null @@ -1,6 +0,0 @@ -PIECE_MARGIN in draught::paint - Rust - -

Constant draught::paint::PIECE_MARGIN[][src]

const PIECE_MARGIN: f64 = 14.0;

Margin from square to define piece radius

-
- \ No newline at end of file diff --git a/doc/draught/paint/constant.PIECE_OUTLINE_PROPORTION.html b/doc/draught/paint/constant.PIECE_OUTLINE_PROPORTION.html new file mode 100644 index 0000000..f25071f --- /dev/null +++ b/doc/draught/paint/constant.PIECE_OUTLINE_PROPORTION.html @@ -0,0 +1,6 @@ +PIECE_OUTLINE_PROPORTION in draught::paint - Rust + +

Constant draught::paint::PIECE_OUTLINE_PROPORTION[][src]

const PIECE_OUTLINE_PROPORTION: f64 = 0.25;

Line width for outlining pieces as proportion of piece radius

+
+ \ No newline at end of file diff --git a/doc/draught/paint/constant.PIECE_OUTLINE_WIDTH.html b/doc/draught/paint/constant.PIECE_OUTLINE_WIDTH.html deleted file mode 100644 index ff14cbf..0000000 --- a/doc/draught/paint/constant.PIECE_OUTLINE_WIDTH.html +++ /dev/null @@ -1,6 +0,0 @@ -PIECE_OUTLINE_WIDTH in draught::paint - Rust - -

Constant draught::paint::PIECE_OUTLINE_WIDTH[][src]

const PIECE_OUTLINE_WIDTH: f64 = 6.0;

Line width for outlining pieces

-
- \ No newline at end of file diff --git a/doc/draught/paint/constant.PIECE_PROPORTION.html b/doc/draught/paint/constant.PIECE_PROPORTION.html new file mode 100644 index 0000000..eed5ea9 --- /dev/null +++ b/doc/draught/paint/constant.PIECE_PROPORTION.html @@ -0,0 +1,6 @@ +PIECE_PROPORTION in draught::paint - Rust + +

Constant draught::paint::PIECE_PROPORTION[][src]

const PIECE_PROPORTION: f64 = 0.6;

Proportion of square that piece fills as proportion of min cell dimension

+
+ \ No newline at end of file diff --git a/doc/draught/paint/index.html b/doc/draught/paint/index.html index 10064b5..98c0054 100644 --- a/doc/draught/paint/index.html +++ b/doc/draught/paint/index.html @@ -1,7 +1,7 @@ draught::paint - Rust

Module draught::paint[][src]

Components for painting board states onto HTML canvases

+ Change settings

Module draught::paint[][src]

Components for painting board states onto HTML canvases

Structs

Painter

Used to paint boards onto HTML canvases

Constants

@@ -11,9 +11,9 @@ DRAW_OUTLINE

Whether to outline black squares

DRAW_PIECE_OUTLINES

Whether to outline pieces

KING_OUTLINE

Default hex colour value for black piece outline

-OUTLINE_WIDTH

Line width when outlining black squares

-PIECE_MARGIN

Margin from square to define piece radius

-PIECE_OUTLINE_WIDTH

Line width for outlining pieces

+OUTLINE_WIDTH

Line width when outlining black squares as proportion of min cell dimension

+PIECE_OUTLINE_PROPORTION

Line width for outlining pieces as proportion of piece radius

+PIECE_PROPORTION

Proportion of square that piece fills as proportion of min cell dimension

SELECTED_PIECE

Default hex colour value for selected piece

SELECTED_PIECE_OUTLINE

Default hex colour value for selected piece outline

SQUARE_OUTLINE

Default hex colour value for outline of black squares

diff --git a/doc/draught/paint/sidebar-items.js b/doc/draught/paint/sidebar-items.js index 0c761e8..dc59e1f 100644 --- a/doc/draught/paint/sidebar-items.js +++ b/doc/draught/paint/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"constant":[["BLACK_PIECE","Default hex colour value for black pieces"],["BLACK_PIECE_OUTLINE","Default hex colour value for black piece outline"],["BLACK_SQUARE","Default hex colour value for black square background"],["DRAW_OUTLINE","Whether to outline black squares"],["DRAW_PIECE_OUTLINES","Whether to outline pieces"],["KING_OUTLINE","Default hex colour value for black piece outline"],["OUTLINE_WIDTH","Line width when outlining black squares"],["PIECE_MARGIN","Margin from square to define piece radius"],["PIECE_OUTLINE_WIDTH","Line width for outlining pieces"],["SELECTED_PIECE","Default hex colour value for selected piece"],["SELECTED_PIECE_OUTLINE","Default hex colour value for selected piece outline"],["SQUARE_OUTLINE","Default hex colour value for outline of black squares"],["WHITE_PIECE","Default hex colour value for white pieces"],["WHITE_PIECE_OUTLINE","Default hex colour value for white piece outline"],["WHITE_SQUARE","Default hex colour value for white square background"]],"struct":[["Painter","Used to paint boards onto HTML canvases"]]}); \ No newline at end of file +initSidebarItems({"constant":[["BLACK_PIECE","Default hex colour value for black pieces"],["BLACK_PIECE_OUTLINE","Default hex colour value for black piece outline"],["BLACK_SQUARE","Default hex colour value for black square background"],["DRAW_OUTLINE","Whether to outline black squares"],["DRAW_PIECE_OUTLINES","Whether to outline pieces"],["KING_OUTLINE","Default hex colour value for black piece outline"],["OUTLINE_WIDTH","Line width when outlining black squares as proportion of min cell dimension"],["PIECE_OUTLINE_PROPORTION","Line width for outlining pieces as proportion of piece radius"],["PIECE_PROPORTION","Proportion of square that piece fills as proportion of min cell dimension"],["SELECTED_PIECE","Default hex colour value for selected piece"],["SELECTED_PIECE_OUTLINE","Default hex colour value for selected piece outline"],["SQUARE_OUTLINE","Default hex colour value for outline of black squares"],["WHITE_PIECE","Default hex colour value for white pieces"],["WHITE_PIECE_OUTLINE","Default hex colour value for white piece outline"],["WHITE_SQUARE","Default hex colour value for white square background"]],"struct":[["Painter","Used to paint boards onto HTML canvases"]]}); \ No newline at end of file diff --git a/doc/draught/paint/struct.Painter.html b/doc/draught/paint/struct.Painter.html index 30c4f87..8e9a187 100644 --- a/doc/draught/paint/struct.Painter.html +++ b/doc/draught/paint/struct.Painter.html @@ -1,6 +1,6 @@ Painter in draught::paint - Rust -