diff --git a/10.bootstrap.js b/10.bootstrap.js index c6cf891..cec9183 100644 --- a/10.bootstrap.js +++ b/10.bootstrap.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,e,r)=>{r.a(t,(async(n,_)=>{try{r.d(e,{C4:()=>V,Ck:()=>q,DA:()=>G,EF:()=>Tt,HS:()=>Q,Ih:()=>W,In:()=>ot,Ip:()=>xt,KK:()=>pt,KQ:()=>yt,M9:()=>it,OF:()=>wt,Oo:()=>It,Or:()=>Nt,Os:()=>P,SZ:()=>S,T8:()=>_t,TL:()=>ht,Tt:()=>N,U5:()=>F,U7:()=>at,Ws:()=>nt,XP:()=>L,YN:()=>Ot,_3:()=>ft,ae:()=>z,bx:()=>bt,cb:()=>kt,fO:()=>X,fY:()=>jt,fi:()=>gt,gk:()=>K,h4:()=>H,hx:()=>ut,i0:()=>j,iY:()=>$,k4:()=>dt,kq:()=>et,lA:()=>A,mS:()=>Y,m_:()=>St,nf:()=>rt,oH:()=>Bt,pt:()=>tt,pv:()=>ct,r2:()=>J,rC:()=>Et,rh:()=>U,u6:()=>st,ug:()=>M,vm:()=>vt,wc:()=>E,xB:()=>mt,yX:()=>Z,yq:()=>D,z2:()=>lt});var a=r(657);t=r.hmd(t);var c=n([a]);a=(c.then?(await c)():c)[0];const o=new Array(32).fill(void 0);function i(t){return o[t]}o.push(void 0,null,!0,!1);let s=o.length;function u(t){t<36||(o[t]=s,s=t)}function l(t){const e=i(t);return u(t),e}let p=new("undefined"==typeof TextDecoder?(0,t.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});p.decode();let d=null;function b(){return null!==d&&d.buffer===a.memory.buffer||(d=new Uint8Array(a.memory.buffer)),d}function g(t,e){return p.decode(b().subarray(t,t+e))}function h(t){s===o.length&&o.push(o.length+1);const e=s;return s=o[e],o[e]=t,e}function f(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+=f(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 w=0,m=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const y="function"==typeof m.encodeInto?function(t,e){return m.encodeInto(t,e)}:function(t,e){const r=m.encode(t);return e.set(r),{read:t.length,written:r.length}};function v(t,e,r){if(void 0===r){const r=m.encode(t),n=e(r.length);return b().subarray(n,n+r.length).set(r),w=r.length,n}let n=t.length,_=e(n);const a=b();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=b().subarray(_+c,_+n);c+=y(t,e).written}return w=c,_}let T=null;function k(){return null!==T&&T.buffer===a.memory.buffer||(T=new Int32Array(a.memory.buffer)),T}function x(t){return null==t}function I(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`);return t.ptr}function E(){a.init_wasm()}function O(t,e){try{return t.apply(this,e)}catch(t){a.__wbindgen_exn_store(h(t))}}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"});const S=Object.freeze({Black:0,0:"Black",White:1,1:"White"}),j=(Object.freeze({Man:0,0:"Man",King:1,1:"King"}),Object.freeze({Empty:0,0:"Empty",Occupied:1,1:"Occupied",Unplayable:2,2:"Unplayable"})),N=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();a.__wbg_board_free(t)}get width(){return a.__wbg_get_board_width(this.ptr)>>>0}set width(t){a.__wbg_set_board_width(this.ptr,t)}get height(){return a.__wbg_get_board_height(this.ptr)>>>0}set height(t){a.__wbg_set_board_height(this.ptr,t)}get current_turn(){return a.__wbg_get_board_current_turn(this.ptr)>>>0}set current_turn(t){a.__wbg_set_board_current_turn(this.ptr,t)}cell(t){const e=a.board_cell(this.ptr,t);return R.__wrap(e)}set_cell(t,e){I(e,R);var r=e.ptr;e.ptr=0,a.board_set_cell(this.ptr,t,r)}grid_cell(t){I(t,U);var e=t.ptr;t.ptr=0;const r=a.board_grid_cell(this.ptr,e);return R.__wrap(r)}cell_index(t,e){return a.board_cell_index(this.ptr,t,e)>>>0}cell_idx(t){I(t,U);var e=t.ptr;return t.ptr=0,a.board_cell_idx(this.ptr,e)>>>0}board_index(t){const e=a.board_board_index(this.ptr,t);return U.__wrap(e)}can_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;return e.ptr=0,a.board_can_move(this.ptr,r,n)>>>0}validate_man_move(t,e,r){I(t,U);var n=t.ptr;t.ptr=0,I(e,U);var _=e.ptr;e.ptr=0,I(r,C);var c=r.ptr;return r.ptr=0,a.board_validate_man_move(this.ptr,n,_,c)>>>0}validate_king_move(t,e,r){I(t,U);var n=t.ptr;t.ptr=0,I(e,U);var _=e.ptr;e.ptr=0,I(r,C);var c=r.ptr;return r.ptr=0,a.board_validate_king_move(this.ptr,n,_,c)>>>0}jumpee_idx(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;return e.ptr=0,a.board_jumpee_idx(this.ptr,r,n)>>>0}cells(){return a.board_cells(this.ptr)}num_cells(){return a.board_num_cells(this.ptr)>>>0}num_pieces(){return a.board_num_pieces(this.ptr)>>>0}num_player(t){return a.board_num_player(this.ptr,t)>>>0}score(){return a.board_score(this.ptr)}cell_state(t){return a.board_cell_state(this.ptr,t)>>>0}apply_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0;const _=a.board_apply_move(this.ptr,r,n);return B.__wrap(_)}apply_jump(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0;const _=a.board_apply_jump(this.ptr,r,n);return B.__wrap(_)}king_row_idx(){return a.board_king_row_idx(this.ptr)>>>0}static validate_jumpee(t,e){I(t,R);var r=t.ptr;t.ptr=0,I(e,C);var n=e.ptr;return e.ptr=0,a.board_validate_jumpee(r,n)>>>0}static check_jumpee_team(t,e){I(t,C);var r=t.ptr;t.ptr=0,I(e,C);var n=e.ptr;return e.ptr=0,0!==a.board_check_jumpee_team(r,n)}constructor(t,e,r){const n=a.board_new(t,e,r);return B.__wrap(n)}static init_game(t,e){I(t,B);var r=t.ptr;t.ptr=0;const n=a.board_init_game(r,e);return B.__wrap(n)}}class U{static __wrap(t){const e=Object.create(U.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();a.__wbg_brdidx_free(t)}get row(){return a.__wbg_get_brdidx_row(this.ptr)>>>0}set row(t){a.__wbg_set_brdidx_row(this.ptr,t)}get col(){return a.__wbg_get_brdidx_col(this.ptr)>>>0}set col(t){a.__wbg_set_brdidx_col(this.ptr,t)}constructor(t,e){const r=a.brdidx_from(t,e);return U.__wrap(r)}eq(t){return I(t,U),0!==a.brdidx_eq(this.ptr,t.ptr)}}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();a.__wbg_game_free(t)}get last_node_count(){return a.__wbg_get_game_last_node_count(this.ptr)>>>0}set last_node_count(t){a.__wbg_set_game_last_node_count(this.ptr,t)}get perfect_chance(){return a.__wbg_get_game_perfect_chance(this.ptr)}set perfect_chance(t){a.__wbg_set_game_perfect_chance(this.ptr,t)}current_board_cells(){return a.game_current_board_cells(this.ptr)}current_board_len(){return a.game_current_board_len(this.ptr)>>>0}current_turn(){return a.game_current_turn(this.ptr)>>>0}score(){return a.game_score(this.ptr)}winning(){const t=a.game_winning(this.ptr);return 2===t?void 0:t}has_won(){const t=a.game_has_won(this.ptr);return 2===t?void 0:t}current_cell_state(t){I(t,U);const e=a.game_current_cell_state(this.ptr,t.ptr);return R.__wrap(e)}set_search_depth(t){a.game_set_search_depth(this.ptr,t)}set_selected(t){I(t,U),a.game_set_selected(this.ptr,t.ptr)}set_perfect_chance(t){a.game_set_perfect_chance(this.ptr,t)}clear_selected(){a.game_clear_selected(this.ptr)}make_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;return e.ptr=0,a.game_make_move(this.ptr,r,n)>>>0}execute_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0,a.game_execute_move(this.ptr,r,n)}execute_jump(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0,a.game_execute_jump(this.ptr,r,n)}push_new_board(t){I(t,B);var e=t.ptr;t.ptr=0,a.game_push_new_board(this.ptr,e)}set_current(t){I(t,B);var e=t.ptr;t.ptr=0,a.game_set_current(this.ptr,e)}constructor(t,e,r,n,_){const c=a.game_new(t,e,r,n,_);return A.__wrap(c)}static new_with_canvas(t,e,r,n,_,c,o,i){const s=v(c,a.__wbindgen_malloc,a.__wbindgen_realloc),u=w,l=a.game_new_with_canvas(t,e,r,n,_,s,u,o,i);return A.__wrap(l)}set_painter(t){I(t,q);var e=t.ptr;t.ptr=0,a.game_set_painter(this.ptr,e)}draw(){a.game_draw(this.ptr)}ai_move(){a.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();a.__wbg_painter_free(t)}constructor(t,e,r){const n=v(r,a.__wbindgen_malloc,a.__wbindgen_realloc),_=w,c=a.painter_new(t,e,n,_);return q.__wrap(c)}static new_with_canvas(t,e,r){const n=a.painter_new_with_canvas(t,e,h(r));return q.__wrap(n)}set_square_outline(t){a.painter_set_square_outline(this.ptr,h(t))}set_outline_width(t){a.painter_set_outline_width(this.ptr,t)}set_draw_outline(t){a.painter_set_draw_outline(this.ptr,t)}reset_dimensions(){a.painter_reset_dimensions(this.ptr)}validate_board_dim(t){return I(t,B),0!==a.painter_validate_board_dim(this.ptr,t.ptr)}draw(t){I(t,B),a.painter_draw(this.ptr,t.ptr)}}class C{static __wrap(t){const e=Object.create(C.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();a.__wbg_piece_free(t)}get team(){return a.__wbg_get_piece_team(this.ptr)>>>0}set team(t){a.__wbg_set_piece_team(this.ptr,t)}get strength(){return a.__wbg_get_piece_strength(this.ptr)>>>0}set strength(t){a.__wbg_set_piece_strength(this.ptr,t)}constructor(t,e){const r=a.piece_new(t,e);return C.__wrap(r)}}class R{static __wrap(t){const e=Object.create(R.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();a.__wbg_square_free(t)}get occupant(){const t=a.__wbg_get_square_occupant(this.ptr);return 0===t?void 0:C.__wrap(t)}set occupant(t){let e=0;x(t)||(I(t,C),e=t.ptr,t.ptr=0),a.__wbg_set_square_occupant(this.ptr,e)}get state(){return a.__wbg_get_square_state(this.ptr)>>>0}set state(t){a.__wbg_set_square_state(this.ptr,t)}constructor(t,e){let r=0;x(e)||(I(e,C),r=e.ptr,e.ptr=0);const n=a.square_new(t,r);return R.__wrap(n)}static pc(t,e){const r=a.square_pc(t,e);return R.__wrap(r)}static empty(){const t=a.square_empty();return R.__wrap(t)}static unplay(){const t=a.square_unplay();return R.__wrap(t)}}function M(t){l(t)}function H(t,e){return h(g(t,e))}function W(){return h(new Error)}function D(t,e){const r=v(i(e).stack,a.__wbindgen_malloc,a.__wbindgen_realloc),n=w;k()[t/4+1]=n,k()[t/4+0]=r}function K(t,e){try{console.error(g(t,e))}finally{a.__wbindgen_free(t,e)}}function F(){return O((function(){return h(self.self)}),arguments)}function $(t){return h(i(t).crypto)}function Y(t){return h(i(t).msCrypto)}function L(t){return void 0===i(t)}function J(t,e,r){return h(i(t).require(g(e,r)))}function Z(t){return h(i(t).getRandomValues)}function z(t,e){i(t).getRandomValues(i(e))}function P(t,e,r){var n,_;i(t).randomFillSync((n=e,_=r,b().subarray(n/1,n/1+_)))}function G(){return h(t)}function X(t){return i(t)instanceof Window}function V(t){const e=i(t).document;return x(e)?0:h(e)}function Q(t,e,r){const n=i(t).getElementById(g(e,r));return x(n)?0:h(n)}function tt(t){console.error(i(t))}function et(t){console.log(i(t))}function rt(t){return i(t)instanceof CanvasRenderingContext2D}function nt(t,e){i(t).strokeStyle=i(e)}function _t(t,e){i(t).fillStyle=i(e)}function at(t,e){i(t).lineWidth=e}function ct(t){i(t).beginPath()}function ot(t){i(t).fill()}function it(t){i(t).stroke()}function st(){return O((function(t,e,r,n,_,a){i(t).arc(e,r,n,_,a)}),arguments)}function ut(t,e,r,n,_){i(t).fillRect(e,r,n,_)}function lt(t,e,r,n,_){i(t).strokeRect(e,r,n,_)}function pt(t){return i(t)instanceof HTMLCanvasElement}function dt(t,e){i(t).width=e>>>0}function bt(t,e){i(t).height=e>>>0}function gt(){return O((function(t,e,r){const n=i(t).getContext(g(e,r));return x(n)?0:h(n)}),arguments)}function ht(t,e){return h(new Function(g(t,e)))}function ft(){return O((function(t,e){return h(i(t).call(i(e)))}),arguments)}function wt(){return O((function(){return h(self.self)}),arguments)}function mt(){return O((function(){return h(window.window)}),arguments)}function yt(){return O((function(){return h(globalThis.globalThis)}),arguments)}function vt(){return O((function(){return h(r.g.global)}),arguments)}function Tt(t){return h(i(t).buffer)}function kt(t){return h(new Uint8Array(i(t)))}function xt(t,e,r){i(t).set(i(e),r>>>0)}function It(t){return i(t).length}function Et(t){return h(new Uint8Array(t>>>0))}function Ot(t,e,r){return h(i(t).subarray(e>>>0,r>>>0))}function St(t){return h(i(t))}function jt(t,e){const r=v(f(i(e)),a.__wbindgen_malloc,a.__wbindgen_realloc),n=w;k()[t/4+1]=n,k()[t/4+0]=r}function Nt(t,e){throw new Error(g(t,e))}function Bt(){return h(a.memory)}_()}catch(Ut){_(Ut)}}))},10:(t,e,r)=>{r.a(t,(async(t,n)=>{try{r.r(e);var _=r(171),a=t([_]);_=(a.then?(await a)():a)[0];const l=720,p=720;var c=8,o=8,i=3,s=4,u=.5;const d=3e3,b=3e3,g={HUMAN_TURN:{THINKING:"human_turn.thinking",FROM_SELECTED:"human_turn.from_selected"},AI_TURN:"ai_turn"};(0,_.wc)(),document.getElementById("status-p");const h=document.getElementById("status-d"),f=document.getElementById("team-p"),w=document.getElementById("node-count"),m=document.getElementById("winning-p");document.getElementById("startBtn").onclick=S;let y=null,v=null,T=B,k=g.HUMAN_TURN.THINKING,x=null,I=null,E=[];S();const O=document.getElementById("game-canvas");function S(){x=new _.lA(c,o,i,_.SZ.Black,s),I=new _.Ck(l,p,"game-canvas"),x.set_painter(I),x.draw(),clearInterval(y),U(),A(),E=[],k=g.HUMAN_TURN.THINKING}function j(t){switch(k){case g.HUMAN_TURN.THINKING:if(x.current_cell_state(t).state!=_.i0.Occupied)return;if(x.current_cell_state(t).occupant.team!=x.current_turn())return;E.push(t),k=g.HUMAN_TURN.FROM_SELECTED,x.set_selected(t),x.draw();break;case g.HUMAN_TURN.FROM_SELECTED:if(!E[0].eq(t)){if(x.current_cell_state(t).state!=_.i0.Empty)return;if(E.push(t),2!=E.length)return T(`Error: wrong number of clicks to process ${E.length}`),void console.error(`Error: wrong number of clicks to process ${E.length}`);switch(x.make_move(E[0],E[1])){case _.Tt.Allowed:$.checked&&void 0===x.has_won()&&(x.ai_move(),w.innerText=`searched ${x.last_node_count.toLocaleString("en-GB")} possible moves`);break;case _.Tt.IllegalTrajectory:T("You can't move like that!");break;case _.Tt.JumpingSameTeam:T("You can't jump your own piece!");break;case _.Tt.NoJumpablePiece:T("There's nothing to jump!");break;case _.Tt.OccupiedDest:T("There's a piece there!");break;case _.Tt.OutOfBounds:T("That square's not on the board! (how have you managed that?)");break;case _.Tt.UnoccupiedSrc:T("There's no piece to move!");break;case _.Tt.Unplayable:T("That's not a playable square!");break;case _.Tt.WrongTeamSrc:T("That's not your piece!")}}x.clear_selected(),x.draw(),E=[],k=g.HUMAN_TURN.THINKING;break;case g.AI_TURN:console.log("It's the AI's turn!")}U(),A(),q()}function N(t,e){var r=t.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}}function B(t,e="danger",r=!0){null!=v&&clearInterval(v),h.className=`alert alert-${e}`,h.innerText=t,h.hidden=!1,r&&(v=setTimeout((()=>{h.hidden=!0}),d))}function U(){switch(x.current_turn()){case _.SZ.White:f.innerText="βšͺ White βšͺ";break;case _.SZ.Black:f.innerText="πŸ”΄ Black πŸ”΄"}}function A(){switch(x.winning()){case void 0:m.innerText="";break;case _.SZ.White:m.innerText="πŸ‘‘ White πŸ‘‘";break;case _.SZ.Black:m.innerText="πŸ‘‘ Black πŸ‘‘"}}function q(){switch(x.has_won()){case void 0:break;case _.SZ.White:T("You Lost!"),y=setInterval((()=>{S()}),b);break;case _.SZ.Black:T("You Won!","success"),y=setInterval((()=>{S()}),b)}}O.addEventListener("click",(t=>{var e=N(O,t);j(new _.rh(Math.floor(e.y/O.clientHeight*o),Math.floor(e.x/O.clientWidth*c)))}));const C=document.getElementById("width"),R=()=>{c=parseInt(C.value),S()};C.onchange=R,C.value=8;const M=document.getElementById("height"),H=()=>{o=parseInt(M.value),W.max=o/2-1,S()};M.onchange=H,M.value=8;const W=document.getElementById("play_rows"),D=()=>{i=parseInt(W.value),S()};W.onchange=D,W.value=3;const K=document.getElementById("ai_search_depth"),F=()=>{s=parseInt(K.value),x.set_search_depth(s),s>4&&T("This increases thinking time exponentially, be careful (probably don't go past 6)","warning")};K.onchange=F,K.value=4;const $=document.getElementById("ai-checkbox"),Y=()=>{};$.onchange=Y;const L=document.getElementById("ai_difficulty"),J=()=>{u=parseInt(L.value)/100,x.set_perfect_chance(u)};L.onchange=J,L.value=50,n()}catch(Z){n(Z)}}))},657:(t,e,r)=>{r.a(t,(async(n,_)=>{try{var a,c=n([a=r(171)]),[a]=c.then?(await c)():c;await r.v(e,t.id,"ed5ad1819e47a070ceaf",{"./draught_bg.js":{__wbindgen_object_drop_ref:a.ug,__wbindgen_string_new:a.h4,__wbg_new_693216e109162396:a.Ih,__wbg_stack_0ddaca5d1abfb52f:a.yq,__wbg_error_09919627ac0992f5:a.gk,__wbg_self_86b4b13392c7af56:a.U5,__wbg_crypto_b8c92eaac23d0d80:a.iY,__wbg_msCrypto_9ad6677321a08dd8:a.mS,__wbindgen_is_undefined:a.XP,__wbg_require_f5521a5b85ad2542:a.r2,__wbg_getRandomValues_dd27e6b0652b3236:a.yX,__wbg_getRandomValues_e57c9b75ddead065:a.ae,__wbg_randomFillSync_d2ba53160aec6aba:a.Os,__wbg_static_accessor_MODULE_452b4680e8614c81:a.DA,__wbg_instanceof_Window_0e6c0f1096d66c3c:a.fO,__wbg_document_99eddbbc11ec831e:a.C4,__wbg_getElementById_f83c5de20dc455d6:a.HS,__wbg_error_8ff19d586a987aef:a.pt,__wbg_log_e8ba7b992c7ad0eb:a.kq,__wbg_instanceof_CanvasRenderingContext2d_405495bb0ea92c4f:a.nf,__wbg_setstrokeStyle_32540003cbfe210b:a.Ws,__wbg_setfillStyle_1d391c4891a6ec4d:a.T8,__wbg_setlineWidth_6f1b76036ab98bfc:a.U7,__wbg_beginPath_e040b5521d41f537:a.pv,__wbg_fill_b6e37fbbefb55ae0:a.In,__wbg_stroke_63664360a52ce7d1:a.M9,__wbg_arc_85205a36bd04df0a:a.u6,__wbg_fillRect_59b38b7e6f8d0717:a.hx,__wbg_strokeRect_469c3838c9d01537:a.z2,__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef:a.KK,__wbg_setwidth_654d8adcd4979eed:a.k4,__wbg_setheight_2b662384bfacb65c:a.bx,__wbg_getContext_0c19ba5c037e057f:a.fi,__wbg_newnoargs_e23b458e372830de:a.TL,__wbg_call_ae78342adc33730a:a._3,__wbg_self_99737b4dcdf6f0d8:a.OF,__wbg_window_9b61fbbf3564c4fb:a.xB,__wbg_globalThis_8e275ef40caea3a3:a.KQ,__wbg_global_5de1e0f82bddcd27:a.vm,__wbg_buffer_7af23f65f6c64548:a.EF,__wbg_new_cc9018bd6f283b6f:a.cb,__wbg_set_f25e869e4565d2a2:a.Ip,__wbg_length_0acb1cf9bbaf8519:a.Oo,__wbg_newwithlength_8f0657faca9f1422:a.rC,__wbg_subarray_da527dbd24eafb6b:a.YN,__wbindgen_object_clone_ref:a.m_,__wbindgen_debug_string:a.fY,__wbindgen_throw:a.Or,__wbindgen_memory:a.oH}}),_()}catch(t){_(t)}}),1)}}]); +"use strict";(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,e,r)=>{r.a(t,(async(n,_)=>{try{r.d(e,{C4:()=>V,Ck:()=>q,DA:()=>G,EF:()=>Tt,HS:()=>Q,Ih:()=>W,In:()=>ot,Ip:()=>xt,KK:()=>pt,KQ:()=>yt,M9:()=>it,OF:()=>wt,Oo:()=>It,Or:()=>Nt,Os:()=>P,SZ:()=>S,T8:()=>_t,TL:()=>ft,Tt:()=>N,U5:()=>$,U7:()=>at,Ws:()=>nt,XP:()=>Y,YN:()=>Ot,_3:()=>ht,ae:()=>z,bx:()=>bt,cb:()=>kt,fO:()=>X,fY:()=>jt,fi:()=>gt,gk:()=>K,h4:()=>H,hx:()=>ut,i0:()=>j,iY:()=>F,k4:()=>dt,kq:()=>et,lA:()=>A,mS:()=>L,m_:()=>St,nf:()=>rt,oH:()=>Bt,pt:()=>tt,pv:()=>ct,r2:()=>J,rC:()=>Et,rh:()=>U,u6:()=>st,ug:()=>M,vm:()=>vt,wc:()=>E,xB:()=>mt,yX:()=>Z,yq:()=>D,z2:()=>lt});var a=r(657);t=r.hmd(t);var c=n([a]);a=(c.then?(await c)():c)[0];const o=new Array(32).fill(void 0);function i(t){return o[t]}o.push(void 0,null,!0,!1);let s=o.length;function u(t){t<36||(o[t]=s,s=t)}function l(t){const e=i(t);return u(t),e}let p=new("undefined"==typeof TextDecoder?(0,t.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});p.decode();let d=null;function b(){return null!==d&&d.buffer===a.memory.buffer||(d=new Uint8Array(a.memory.buffer)),d}function g(t,e){return p.decode(b().subarray(t,t+e))}function f(t){s===o.length&&o.push(o.length+1);const e=s;return s=o[e],o[e]=t,e}function h(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+=h(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 w=0,m=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const y="function"==typeof m.encodeInto?function(t,e){return m.encodeInto(t,e)}:function(t,e){const r=m.encode(t);return e.set(r),{read:t.length,written:r.length}};function v(t,e,r){if(void 0===r){const r=m.encode(t),n=e(r.length);return b().subarray(n,n+r.length).set(r),w=r.length,n}let n=t.length,_=e(n);const a=b();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=b().subarray(_+c,_+n);c+=y(t,e).written}return w=c,_}let T=null;function k(){return null!==T&&T.buffer===a.memory.buffer||(T=new Int32Array(a.memory.buffer)),T}function x(t){return null==t}function I(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`);return t.ptr}function E(){a.init_wasm()}function O(t,e){try{return t.apply(this,e)}catch(t){a.__wbindgen_exn_store(f(t))}}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"});const S=Object.freeze({Black:0,0:"Black",White:1,1:"White"}),j=(Object.freeze({Man:0,0:"Man",King:1,1:"King"}),Object.freeze({Empty:0,0:"Empty",Occupied:1,1:"Occupied",Unplayable:2,2:"Unplayable"})),N=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();a.__wbg_board_free(t)}get width(){return a.__wbg_get_board_width(this.ptr)>>>0}set width(t){a.__wbg_set_board_width(this.ptr,t)}get height(){return a.__wbg_get_board_height(this.ptr)>>>0}set height(t){a.__wbg_set_board_height(this.ptr,t)}get current_turn(){return a.__wbg_get_board_current_turn(this.ptr)>>>0}set current_turn(t){a.__wbg_set_board_current_turn(this.ptr,t)}cell(t){const e=a.board_cell(this.ptr,t);return R.__wrap(e)}set_cell(t,e){I(e,R);var r=e.ptr;e.ptr=0,a.board_set_cell(this.ptr,t,r)}grid_cell(t){I(t,U);var e=t.ptr;t.ptr=0;const r=a.board_grid_cell(this.ptr,e);return R.__wrap(r)}cell_index(t,e){return a.board_cell_index(this.ptr,t,e)>>>0}cell_idx(t){I(t,U);var e=t.ptr;return t.ptr=0,a.board_cell_idx(this.ptr,e)>>>0}board_index(t){const e=a.board_board_index(this.ptr,t);return U.__wrap(e)}can_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;return e.ptr=0,a.board_can_move(this.ptr,r,n)>>>0}validate_man_move(t,e,r){I(t,U);var n=t.ptr;t.ptr=0,I(e,U);var _=e.ptr;e.ptr=0,I(r,C);var c=r.ptr;return r.ptr=0,a.board_validate_man_move(this.ptr,n,_,c)>>>0}validate_king_move(t,e,r){I(t,U);var n=t.ptr;t.ptr=0,I(e,U);var _=e.ptr;e.ptr=0,I(r,C);var c=r.ptr;return r.ptr=0,a.board_validate_king_move(this.ptr,n,_,c)>>>0}jumpee_idx(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;return e.ptr=0,a.board_jumpee_idx(this.ptr,r,n)>>>0}cells(){return a.board_cells(this.ptr)}num_cells(){return a.board_num_cells(this.ptr)>>>0}num_pieces(){return a.board_num_pieces(this.ptr)>>>0}num_player(t){return a.board_num_player(this.ptr,t)>>>0}score(){return a.board_score(this.ptr)}cell_state(t){return a.board_cell_state(this.ptr,t)>>>0}apply_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0;const _=a.board_apply_move(this.ptr,r,n);return B.__wrap(_)}apply_jump(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0;const _=a.board_apply_jump(this.ptr,r,n);return B.__wrap(_)}king_row_idx(){return a.board_king_row_idx(this.ptr)>>>0}static validate_jumpee(t,e){I(t,R);var r=t.ptr;t.ptr=0,I(e,C);var n=e.ptr;return e.ptr=0,a.board_validate_jumpee(r,n)>>>0}static check_jumpee_team(t,e){I(t,C);var r=t.ptr;t.ptr=0,I(e,C);var n=e.ptr;return e.ptr=0,0!==a.board_check_jumpee_team(r,n)}constructor(t,e,r){const n=a.board_new(t,e,r);return B.__wrap(n)}static init_game(t,e){I(t,B);var r=t.ptr;t.ptr=0;const n=a.board_init_game(r,e);return B.__wrap(n)}}class U{static __wrap(t){const e=Object.create(U.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();a.__wbg_brdidx_free(t)}get row(){return a.__wbg_get_brdidx_row(this.ptr)>>>0}set row(t){a.__wbg_set_brdidx_row(this.ptr,t)}get col(){return a.__wbg_get_brdidx_col(this.ptr)>>>0}set col(t){a.__wbg_set_brdidx_col(this.ptr,t)}constructor(t,e){const r=a.brdidx_from(t,e);return U.__wrap(r)}eq(t){return I(t,U),0!==a.brdidx_eq(this.ptr,t.ptr)}}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();a.__wbg_game_free(t)}get last_node_count(){return a.__wbg_get_game_last_node_count(this.ptr)>>>0}set last_node_count(t){a.__wbg_set_game_last_node_count(this.ptr,t)}get perfect_chance(){return a.__wbg_get_game_perfect_chance(this.ptr)}set perfect_chance(t){a.__wbg_set_game_perfect_chance(this.ptr,t)}current_board_cells(){return a.game_current_board_cells(this.ptr)}current_board_len(){return a.game_current_board_len(this.ptr)>>>0}current_turn(){return a.game_current_turn(this.ptr)>>>0}score(){return a.game_score(this.ptr)}winning(){const t=a.game_winning(this.ptr);return 2===t?void 0:t}has_won(){const t=a.game_has_won(this.ptr);return 2===t?void 0:t}current_cell_state(t){I(t,U);const e=a.game_current_cell_state(this.ptr,t.ptr);return R.__wrap(e)}set_search_depth(t){a.game_set_search_depth(this.ptr,t)}set_selected(t){I(t,U),a.game_set_selected(this.ptr,t.ptr)}set_perfect_chance(t){a.game_set_perfect_chance(this.ptr,t)}clear_selected(){a.game_clear_selected(this.ptr)}make_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;return e.ptr=0,a.game_make_move(this.ptr,r,n)>>>0}execute_move(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0,a.game_execute_move(this.ptr,r,n)}execute_jump(t,e){I(t,U);var r=t.ptr;t.ptr=0,I(e,U);var n=e.ptr;e.ptr=0,a.game_execute_jump(this.ptr,r,n)}push_new_board(t){I(t,B);var e=t.ptr;t.ptr=0,a.game_push_new_board(this.ptr,e)}set_current(t){I(t,B);var e=t.ptr;t.ptr=0,a.game_set_current(this.ptr,e)}constructor(t,e,r,n,_){const c=a.game_new(t,e,r,n,_);return A.__wrap(c)}static new_with_canvas(t,e,r,n,_,c,o,i){const s=v(c,a.__wbindgen_malloc,a.__wbindgen_realloc),u=w,l=a.game_new_with_canvas(t,e,r,n,_,s,u,o,i);return A.__wrap(l)}set_painter(t){I(t,q);var e=t.ptr;t.ptr=0,a.game_set_painter(this.ptr,e)}draw(){a.game_draw(this.ptr)}ai_move(){a.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();a.__wbg_painter_free(t)}constructor(t,e,r){const n=v(r,a.__wbindgen_malloc,a.__wbindgen_realloc),_=w,c=a.painter_new(t,e,n,_);return q.__wrap(c)}static new_with_canvas(t,e,r){const n=a.painter_new_with_canvas(t,e,f(r));return q.__wrap(n)}set_square_outline(t){a.painter_set_square_outline(this.ptr,f(t))}set_outline_width(t){a.painter_set_outline_width(this.ptr,t)}set_draw_outline(t){a.painter_set_draw_outline(this.ptr,t)}reset_dimensions(){a.painter_reset_dimensions(this.ptr)}validate_board_dim(t){return I(t,B),0!==a.painter_validate_board_dim(this.ptr,t.ptr)}draw(t){I(t,B),a.painter_draw(this.ptr,t.ptr)}}class C{static __wrap(t){const e=Object.create(C.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();a.__wbg_piece_free(t)}get team(){return a.__wbg_get_piece_team(this.ptr)>>>0}set team(t){a.__wbg_set_piece_team(this.ptr,t)}get strength(){return a.__wbg_get_piece_strength(this.ptr)>>>0}set strength(t){a.__wbg_set_piece_strength(this.ptr,t)}constructor(t,e){const r=a.piece_new(t,e);return C.__wrap(r)}}class R{static __wrap(t){const e=Object.create(R.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();a.__wbg_square_free(t)}get occupant(){const t=a.__wbg_get_square_occupant(this.ptr);return 0===t?void 0:C.__wrap(t)}set occupant(t){let e=0;x(t)||(I(t,C),e=t.ptr,t.ptr=0),a.__wbg_set_square_occupant(this.ptr,e)}get state(){return a.__wbg_get_square_state(this.ptr)>>>0}set state(t){a.__wbg_set_square_state(this.ptr,t)}constructor(t,e){let r=0;x(e)||(I(e,C),r=e.ptr,e.ptr=0);const n=a.square_new(t,r);return R.__wrap(n)}static pc(t,e){const r=a.square_pc(t,e);return R.__wrap(r)}static empty(){const t=a.square_empty();return R.__wrap(t)}static unplay(){const t=a.square_unplay();return R.__wrap(t)}}function M(t){l(t)}function H(t,e){return f(g(t,e))}function W(){return f(new Error)}function D(t,e){const r=v(i(e).stack,a.__wbindgen_malloc,a.__wbindgen_realloc),n=w;k()[t/4+1]=n,k()[t/4+0]=r}function K(t,e){try{console.error(g(t,e))}finally{a.__wbindgen_free(t,e)}}function $(){return O((function(){return f(self.self)}),arguments)}function F(t){return f(i(t).crypto)}function L(t){return f(i(t).msCrypto)}function Y(t){return void 0===i(t)}function J(t,e,r){return f(i(t).require(g(e,r)))}function Z(t){return f(i(t).getRandomValues)}function z(t,e){i(t).getRandomValues(i(e))}function P(t,e,r){var n,_;i(t).randomFillSync((n=e,_=r,b().subarray(n/1,n/1+_)))}function G(){return f(t)}function X(t){return i(t)instanceof Window}function V(t){const e=i(t).document;return x(e)?0:f(e)}function Q(t,e,r){const n=i(t).getElementById(g(e,r));return x(n)?0:f(n)}function tt(t){console.error(i(t))}function et(t){console.log(i(t))}function rt(t){return i(t)instanceof CanvasRenderingContext2D}function nt(t,e){i(t).strokeStyle=i(e)}function _t(t,e){i(t).fillStyle=i(e)}function at(t,e){i(t).lineWidth=e}function ct(t){i(t).beginPath()}function ot(t){i(t).fill()}function it(t){i(t).stroke()}function st(){return O((function(t,e,r,n,_,a){i(t).arc(e,r,n,_,a)}),arguments)}function ut(t,e,r,n,_){i(t).fillRect(e,r,n,_)}function lt(t,e,r,n,_){i(t).strokeRect(e,r,n,_)}function pt(t){return i(t)instanceof HTMLCanvasElement}function dt(t,e){i(t).width=e>>>0}function bt(t,e){i(t).height=e>>>0}function gt(){return O((function(t,e,r){const n=i(t).getContext(g(e,r));return x(n)?0:f(n)}),arguments)}function ft(t,e){return f(new Function(g(t,e)))}function ht(){return O((function(t,e){return f(i(t).call(i(e)))}),arguments)}function wt(){return O((function(){return f(self.self)}),arguments)}function mt(){return O((function(){return f(window.window)}),arguments)}function yt(){return O((function(){return f(globalThis.globalThis)}),arguments)}function vt(){return O((function(){return f(r.g.global)}),arguments)}function Tt(t){return f(i(t).buffer)}function kt(t){return f(new Uint8Array(i(t)))}function xt(t,e,r){i(t).set(i(e),r>>>0)}function It(t){return i(t).length}function Et(t){return f(new Uint8Array(t>>>0))}function Ot(t,e,r){return f(i(t).subarray(e>>>0,r>>>0))}function St(t){return f(i(t))}function jt(t,e){const r=v(h(i(e)),a.__wbindgen_malloc,a.__wbindgen_realloc),n=w;k()[t/4+1]=n,k()[t/4+0]=r}function Nt(t,e){throw new Error(g(t,e))}function Bt(){return f(a.memory)}_()}catch(Ut){_(Ut)}}))},10:(t,e,r)=>{r.a(t,(async(t,n)=>{try{r.r(e);var _=r(171),a=t([_]);_=(a.then?(await a)():a)[0];const l=720,p=720;var c=8,o=8,i=3,s=4,u=.5;const d=3e3,b=3e3,g={HUMAN_TURN:{THINKING:"human_turn.thinking",FROM_SELECTED:"human_turn.from_selected"},AI_TURN:"ai_turn"};(0,_.wc)(),document.getElementById("status-p");const f=document.getElementById("status-d"),h=document.getElementById("team-p"),w=document.getElementById("node-count"),m=document.getElementById("winning-p");document.getElementById("startBtn").onclick=S;let y=null,v=null,T=B,k=g.HUMAN_TURN.THINKING,x=null,I=null,E=[];S();const O=document.getElementById("game-canvas");function S(){x=new _.lA(c,o,i,_.SZ.Black,s),I=new _.Ck(l,p,"game-canvas"),x.set_painter(I),x.draw(),clearInterval(y),U(),A(),E=[],k=g.HUMAN_TURN.THINKING}function j(t){switch(k){case g.HUMAN_TURN.THINKING:if(x.current_cell_state(t).state!=_.i0.Occupied)return;if(x.current_cell_state(t).occupant.team!=x.current_turn())return;E.push(t),k=g.HUMAN_TURN.FROM_SELECTED,x.set_selected(t),x.draw();break;case g.HUMAN_TURN.FROM_SELECTED:if(!E[0].eq(t)){if(x.current_cell_state(t).state!=_.i0.Empty)return;if(E.push(t),2!=E.length)return T(`Error: wrong number of clicks to process ${E.length}`),void console.error(`Error: wrong number of clicks to process ${E.length}`);switch(x.make_move(E[0],E[1])){case _.Tt.Allowed:if(F.checked&&void 0===x.has_won()){let t=performance.now();x.ai_move();let e=performance.now();w.innerText=`searched ${x.last_node_count.toLocaleString("en-GB")} possible moves in ${(e-t).toLocaleString()}ms`}break;case _.Tt.IllegalTrajectory:T("You can't move like that!");break;case _.Tt.JumpingSameTeam:T("You can't jump your own piece!");break;case _.Tt.NoJumpablePiece:T("There's nothing to jump!");break;case _.Tt.OccupiedDest:T("There's a piece there!");break;case _.Tt.OutOfBounds:T("That square's not on the board! (how have you managed that?)");break;case _.Tt.UnoccupiedSrc:T("There's no piece to move!");break;case _.Tt.Unplayable:T("That's not a playable square!");break;case _.Tt.WrongTeamSrc:T("That's not your piece!")}}x.clear_selected(),x.draw(),E=[],k=g.HUMAN_TURN.THINKING;break;case g.AI_TURN:console.log("It's the AI's turn!")}U(),A(),q()}function N(t,e){var r=t.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}}function B(t,e="danger",r=!0){null!=v&&clearInterval(v),f.className=`alert alert-${e}`,f.innerText=t,f.hidden=!1,r&&(v=setTimeout((()=>{f.hidden=!0}),d))}function U(){switch(x.current_turn()){case _.SZ.White:h.innerText="βšͺ White βšͺ";break;case _.SZ.Black:h.innerText="πŸ”΄ Black πŸ”΄"}}function A(){switch(x.winning()){case void 0:m.innerText="";break;case _.SZ.White:m.innerText="πŸ‘‘ White πŸ‘‘";break;case _.SZ.Black:m.innerText="πŸ‘‘ Black πŸ‘‘"}}function q(){switch(x.has_won()){case void 0:break;case _.SZ.White:T("You Lost!"),y=setInterval((()=>{S()}),b);break;case _.SZ.Black:T("You Won!","success"),y=setInterval((()=>{S()}),b)}}O.addEventListener("click",(t=>{var e=N(O,t);j(new _.rh(Math.floor(e.y/O.clientHeight*o),Math.floor(e.x/O.clientWidth*c)))}));const C=document.getElementById("width"),R=()=>{c=parseInt(C.value),S()};C.onchange=R,C.value=8;const M=document.getElementById("height"),H=()=>{o=parseInt(M.value),W.max=o/2-1,S()};M.onchange=H,M.value=8;const W=document.getElementById("play_rows"),D=()=>{i=parseInt(W.value),S()};W.onchange=D,W.value=3;const K=document.getElementById("ai_search_depth"),$=()=>{s=parseInt(K.value),x.set_search_depth(s),s>4&&T("This increases thinking time exponentially, be careful (probably don't go past 6)","warning")};K.onchange=$,K.value=4;const F=document.getElementById("ai-checkbox"),L=()=>{};F.onchange=L;const Y=document.getElementById("ai_difficulty"),J=()=>{u=parseInt(Y.value)/100,x.set_perfect_chance(u)};Y.onchange=J,Y.value=50,n()}catch(Z){n(Z)}}))},657:(t,e,r)=>{r.a(t,(async(n,_)=>{try{var a,c=n([a=r(171)]),[a]=c.then?(await c)():c;await r.v(e,t.id,"cf9b7e45c1505173d7f2",{"./draught_bg.js":{__wbindgen_object_drop_ref:a.ug,__wbindgen_string_new:a.h4,__wbg_new_693216e109162396:a.Ih,__wbg_stack_0ddaca5d1abfb52f:a.yq,__wbg_error_09919627ac0992f5:a.gk,__wbg_self_86b4b13392c7af56:a.U5,__wbg_crypto_b8c92eaac23d0d80:a.iY,__wbg_msCrypto_9ad6677321a08dd8:a.mS,__wbindgen_is_undefined:a.XP,__wbg_require_f5521a5b85ad2542:a.r2,__wbg_getRandomValues_dd27e6b0652b3236:a.yX,__wbg_getRandomValues_e57c9b75ddead065:a.ae,__wbg_randomFillSync_d2ba53160aec6aba:a.Os,__wbg_static_accessor_MODULE_452b4680e8614c81:a.DA,__wbg_instanceof_Window_0e6c0f1096d66c3c:a.fO,__wbg_document_99eddbbc11ec831e:a.C4,__wbg_getElementById_f83c5de20dc455d6:a.HS,__wbg_error_8ff19d586a987aef:a.pt,__wbg_log_e8ba7b992c7ad0eb:a.kq,__wbg_instanceof_CanvasRenderingContext2d_405495bb0ea92c4f:a.nf,__wbg_setstrokeStyle_32540003cbfe210b:a.Ws,__wbg_setfillStyle_1d391c4891a6ec4d:a.T8,__wbg_setlineWidth_6f1b76036ab98bfc:a.U7,__wbg_beginPath_e040b5521d41f537:a.pv,__wbg_fill_b6e37fbbefb55ae0:a.In,__wbg_stroke_63664360a52ce7d1:a.M9,__wbg_arc_85205a36bd04df0a:a.u6,__wbg_fillRect_59b38b7e6f8d0717:a.hx,__wbg_strokeRect_469c3838c9d01537:a.z2,__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef:a.KK,__wbg_setwidth_654d8adcd4979eed:a.k4,__wbg_setheight_2b662384bfacb65c:a.bx,__wbg_getContext_0c19ba5c037e057f:a.fi,__wbg_newnoargs_e23b458e372830de:a.TL,__wbg_call_ae78342adc33730a:a._3,__wbg_self_99737b4dcdf6f0d8:a.OF,__wbg_window_9b61fbbf3564c4fb:a.xB,__wbg_globalThis_8e275ef40caea3a3:a.KQ,__wbg_global_5de1e0f82bddcd27:a.vm,__wbg_buffer_7af23f65f6c64548:a.EF,__wbg_new_cc9018bd6f283b6f:a.cb,__wbg_set_f25e869e4565d2a2:a.Ip,__wbg_length_0acb1cf9bbaf8519:a.Oo,__wbg_newwithlength_8f0657faca9f1422:a.rC,__wbg_subarray_da527dbd24eafb6b:a.YN,__wbindgen_object_clone_ref:a.m_,__wbindgen_debug_string:a.fY,__wbindgen_throw:a.Or,__wbindgen_memory:a.oH}}),_()}catch(t){_(t)}}),1)}}]); //# sourceMappingURL=10.bootstrap.js.map \ No newline at end of file diff --git a/10.bootstrap.js.map b/10.bootstrap.js.map index 8d0fea9..f34073f 100644 --- a/10.bootstrap.js.map +++ b/10.bootstrap.js.map @@ -1 +1 @@ -{"version":3,"file":"10.bootstrap.js","mappings":"ytBAEA,MAAMA,EAAO,IAAIC,MAAM,IAAIC,UAAKC,GAIhC,SAASC,EAAUC,GAAO,OAAOL,EAAKK,GAFtCL,EAAKM,UAAKH,EAAW,MAAM,GAAM,GAIjC,IAAII,EAAYP,EAAKQ,OAErB,SAASC,EAAWJ,GACZA,EAAM,KACVL,EAAKK,GAAOE,EACZA,EAAYF,GAGhB,SAASK,EAAWL,GAChB,MAAMM,EAAMP,EAAUC,GAEtB,OADAI,EAAWJ,GACJM,EAKX,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,GACfrB,IAAcP,EAAKQ,QAAQR,EAAKM,KAAKN,EAAKQ,OAAS,GACvD,MAAMH,EAAME,EAIZ,OAHAA,EAAYP,EAAKK,GAEjBL,EAAKK,GAAOuB,EACLvB,EAGX,SAASwB,EAAYC,GAEjB,MAAMC,SAAcD,EACpB,GAAY,UAARC,GAA4B,WAARA,GAA4B,MAAPD,EACzC,MAAQ,GAAGA,IAEf,GAAY,UAAR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AAU/J,MAAQ,EAElB,MAAMiK,EAAezH,SAASE,eAAe,aAIvCyH,EAAc,KAEhBhE,EAAa0D,SAASI,EAAajK,OACnCkH,KAEJ+C,EAAaH,SAAWK,EACxBF,EAAajK,MAAQ,EAErB,MAAMoK,EAAmB5H,SAASE,eAAe,mBAI3C2H,EAAkB,KAEpBjE,EAAeyD,SAASO,EAAiBpK,OACzCwH,EAAKzI,iBAAiBqH,GAEnBA,EAAe,GACdiB,EAAU,oFAAqF,YAGvG+C,EAAiBN,SAAWO,EAC5BD,EAAiBpK,MAAQ,EAEzB,MAAMgI,EAAaxF,SAASE,eAAe,eAIrC4H,EAAY,OAGlBtC,EAAW8B,SAAWQ,EAGtB,MAAMC,EAAkB/H,SAASE,eAAe,iBAI1C8H,EAAkB,KAEpBnE,EAAiBwD,SAASU,EAAgBvK,OAAS,IACnDwH,EAAKtI,mBAAmBmH,IAE5BkE,EAAgBT,SAAWU,EAC3BD,EAAgBvK,MAAQ,G","sources":["webpack://draught/../pkg/draught_bg.js","webpack://draught/./index.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 */\n get width() {\n const 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 */\n get height() {\n const 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 */\n get current_turn() {\n const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 */\n get row() {\n const 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 */\n get col() {\n const 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 const 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 const 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 */\n get last_node_count() {\n const 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 */\n get perfect_chance() {\n const 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 const 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 const 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 const 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 const ret = wasm.game_score(this.ptr);\n return ret;\n }\n /**\n * Get currently winning player\n * @returns {number | undefined}\n */\n winning() {\n const 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 const 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 const 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 const 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 const 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 const ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const 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 const ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const 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 const 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 const 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 */\n get team() {\n const 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 */\n get strength() {\n const 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 const 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 */\n get occupant() {\n const 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 */\n get state() {\n const 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 const 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 const 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 const 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 const 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 const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_693216e109162396() {\n const ret = new Error();\n return addHeapObject(ret);\n};\n\nexport function __wbg_stack_0ddaca5d1abfb52f(arg0, arg1) {\n const ret = getObject(arg1).stack;\n const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbg_error_09919627ac0992f5(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 const ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_crypto_b8c92eaac23d0d80(arg0) {\n const ret = getObject(arg0).crypto;\n return addHeapObject(ret);\n};\n\nexport function __wbg_msCrypto_9ad6677321a08dd8(arg0) {\n const ret = getObject(arg0).msCrypto;\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_is_undefined(arg0) {\n const ret = getObject(arg0) === undefined;\n return ret;\n};\n\nexport function __wbg_require_f5521a5b85ad2542(arg0, arg1, arg2) {\n const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));\n return addHeapObject(ret);\n};\n\nexport function __wbg_getRandomValues_dd27e6b0652b3236(arg0) {\n const 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 const ret = module;\n return addHeapObject(ret);\n};\n\nexport function __wbg_instanceof_Window_0e6c0f1096d66c3c(arg0) {\n const ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nexport function __wbg_document_99eddbbc11ec831e(arg0) {\n const ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_getElementById_f83c5de20dc455d6(arg0, arg1, arg2) {\n const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_error_8ff19d586a987aef(arg0) {\n console.error(getObject(arg0));\n};\n\nexport function __wbg_log_e8ba7b992c7ad0eb(arg0) {\n console.log(getObject(arg0));\n};\n\nexport function __wbg_instanceof_CanvasRenderingContext2d_405495bb0ea92c4f(arg0) {\n const ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n return ret;\n};\n\nexport function __wbg_setstrokeStyle_32540003cbfe210b(arg0, arg1) {\n getObject(arg0).strokeStyle = getObject(arg1);\n};\n\nexport function __wbg_setfillStyle_1d391c4891a6ec4d(arg0, arg1) {\n getObject(arg0).fillStyle = getObject(arg1);\n};\n\nexport function __wbg_setlineWidth_6f1b76036ab98bfc(arg0, arg1) {\n getObject(arg0).lineWidth = arg1;\n};\n\nexport function __wbg_beginPath_e040b5521d41f537(arg0) {\n getObject(arg0).beginPath();\n};\n\nexport function __wbg_fill_b6e37fbbefb55ae0(arg0) {\n getObject(arg0).fill();\n};\n\nexport function __wbg_stroke_63664360a52ce7d1(arg0) {\n getObject(arg0).stroke();\n};\n\nexport function __wbg_arc_85205a36bd04df0a() { 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_59b38b7e6f8d0717(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).fillRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_strokeRect_469c3838c9d01537(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef(arg0) {\n const ret = getObject(arg0) instanceof HTMLCanvasElement;\n return ret;\n};\n\nexport function __wbg_setwidth_654d8adcd4979eed(arg0, arg1) {\n getObject(arg0).width = arg1 >>> 0;\n};\n\nexport function __wbg_setheight_2b662384bfacb65c(arg0, arg1) {\n getObject(arg0).height = arg1 >>> 0;\n};\n\nexport function __wbg_getContext_0c19ba5c037e057f() { return handleError(function (arg0, arg1, arg2) {\n const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_newnoargs_e23b458e372830de(arg0, arg1) {\n const ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nexport function __wbg_call_ae78342adc33730a() { return handleError(function (arg0, arg1) {\n const ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_self_99737b4dcdf6f0d8() { return handleError(function () {\n const ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_window_9b61fbbf3564c4fb() { return handleError(function () {\n const ret = window.window;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_globalThis_8e275ef40caea3a3() { return handleError(function () {\n const ret = globalThis.globalThis;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_global_5de1e0f82bddcd27() { return handleError(function () {\n const ret = global.global;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_buffer_7af23f65f6c64548(arg0) {\n const ret = getObject(arg0).buffer;\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_cc9018bd6f283b6f(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n};\n\nexport function __wbg_set_f25e869e4565d2a2(arg0, arg1, arg2) {\n getObject(arg0).set(getObject(arg1), arg2 >>> 0);\n};\n\nexport function __wbg_length_0acb1cf9bbaf8519(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n};\n\nexport function __wbg_newwithlength_8f0657faca9f1422(arg0) {\n const ret = new Uint8Array(arg0 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbg_subarray_da527dbd24eafb6b(arg0, arg1, arg2) {\n const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_object_clone_ref(arg0) {\n const ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const 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 const 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;"],"names":["heap","Array","fill","undefined","getObject","idx","push","heap_next","length","dropObject","takeObject","ret","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","static","create","prototype","__destroy_into_raw","free","width","arg0","height","current_turn","cell","Square","__wrap","set_cell","square","ptr0","grid_cell","BrdIdx","cell_index","row","col","cell_idx","board_index","can_move","from","to","ptr1","validate_man_move","from_square_occupant","Piece","ptr2","validate_king_move","jumpee_idx","cells","num_cells","num_pieces","num_player","team","score","cell_state","apply_move","apply_jump","king_row_idx","jumpee","from_occ","constructor","board","piece_rows","eq","other","Game","last_node_count","perfect_chance","current_board_cells","current_board_len","winning","has_won","current_cell_state","set_search_depth","search_depth","set_selected","set_perfect_chance","new_chance","clear_selected","make_move","execute_move","execute_jump","push_new_board","set_current","first_turn","canvas_id","canvas_width","canvas_height","len0","set_painter","value","Painter","draw","ai_move","canvas","set_square_outline","set_outline_width","set_draw_outline","reset_dimensions","validate_board_dim","strength","occupant","state","__wbindgen_object_drop_ref","__wbindgen_string_new","arg1","__wbg_new_693216e109162396","__wbg_stack_0ddaca5d1abfb52f","__wbg_error_09919627ac0992f5","console","error","__wbg_self_86b4b13392c7af56","self","arguments","__wbg_crypto_b8c92eaac23d0d80","crypto","__wbg_msCrypto_9ad6677321a08dd8","msCrypto","__wbindgen_is_undefined","__wbg_require_f5521a5b85ad2542","arg2","__wbg_getRandomValues_dd27e6b0652b3236","getRandomValues","__wbg_getRandomValues_e57c9b75ddead065","__wbg_randomFillSync_d2ba53160aec6aba","randomFillSync","__wbg_static_accessor_MODULE_452b4680e8614c81","__wbg_instanceof_Window_0e6c0f1096d66c3c","Window","__wbg_document_99eddbbc11ec831e","document","__wbg_getElementById_f83c5de20dc455d6","getElementById","__wbg_error_8ff19d586a987aef","__wbg_log_e8ba7b992c7ad0eb","log","__wbg_instanceof_CanvasRenderingContext2d_405495bb0ea92c4f","CanvasRenderingContext2D","__wbg_setstrokeStyle_32540003cbfe210b","strokeStyle","__wbg_setfillStyle_1d391c4891a6ec4d","fillStyle","__wbg_setlineWidth_6f1b76036ab98bfc","lineWidth","__wbg_beginPath_e040b5521d41f537","beginPath","__wbg_fill_b6e37fbbefb55ae0","__wbg_stroke_63664360a52ce7d1","stroke","__wbg_arc_85205a36bd04df0a","arg3","arg4","arg5","arc","__wbg_fillRect_59b38b7e6f8d0717","fillRect","__wbg_strokeRect_469c3838c9d01537","strokeRect","__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef","HTMLCanvasElement","__wbg_setwidth_654d8adcd4979eed","__wbg_setheight_2b662384bfacb65c","__wbg_getContext_0c19ba5c037e057f","getContext","__wbg_newnoargs_e23b458e372830de","Function","__wbg_call_ae78342adc33730a","__wbg_self_99737b4dcdf6f0d8","__wbg_window_9b61fbbf3564c4fb","window","__wbg_globalThis_8e275ef40caea3a3","globalThis","__wbg_global_5de1e0f82bddcd27","g","global","__wbg_buffer_7af23f65f6c64548","__wbg_new_cc9018bd6f283b6f","__wbg_set_f25e869e4565d2a2","__wbg_length_0acb1cf9bbaf8519","__wbg_newwithlength_8f0657faca9f1422","__wbg_subarray_da527dbd24eafb6b","__wbindgen_object_clone_ref","__wbindgen_debug_string","__wbindgen_throw","__wbindgen_memory","CANVAS_WIDTH","CANVAS_HEIGHT","BOARD_WIDTH","BOARD_HEIGHT","PIECE_ROWS","SEARCH_DEPTH","PERFECT_CHANCE","STATUS_TIMEOUT","WON_TIMEOUT","GameState","HUMAN_TURN","THINKING","FROM_SELECTED","AI_TURN","statusAlert","teamText","nodeCountText","winningText","onclick","start_game","wonTimeout","statusTimeout","setStatus","setStatusAlert","current_state","game","painter","clicks","clearInterval","updateTeamText","updateWinningText","process_canvas_click","cell_coord","aiCheckBox","checked","innerText","toLocaleString","checkWon","getMousePos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","txt","alertType","hide","hidden","setTimeout","setInterval","addEventListener","event","mousepos","Math","floor","clientHeight","clientWidth","widthBox","onWidth","parseInt","onchange","heightBox","onHeight","pieceRowsBox","max","onPieceRows","aiSearchDepthBox","onAISearchDepth","onAICheck","aiPerfectChance","onPerfectChance"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"10.bootstrap.js","mappings":"ytBAEA,MAAMA,EAAO,IAAIC,MAAM,IAAIC,UAAKC,GAIhC,SAASC,EAAUC,GAAO,OAAOL,EAAKK,GAFtCL,EAAKM,UAAKH,EAAW,MAAM,GAAM,GAIjC,IAAII,EAAYP,EAAKQ,OAErB,SAASC,EAAWJ,GACZA,EAAM,KACVL,EAAKK,GAAOE,EACZA,EAAYF,GAGhB,SAASK,EAAWL,GAChB,MAAMM,EAAMP,EAAUC,GAEtB,OADAI,EAAWJ,GACJM,EAKX,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,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AKC,MAAOF,EAASX,EAAI3I,EAAOyJ,aAAgB3D,GAChDyD,KAAKC,MAAOF,EAAStQ,EAAIgH,EAAO0J,YAAe7D,QAyNvD,MAAM8D,EAAWvH,SAASE,eAAe,SAInCsH,EAAU,KAEZ/D,EAAcgE,SAASF,EAAS/J,OAChCkH,KAEJ6C,EAASG,SAAWF,EACpBD,EAAS/J,MAAQ,EAEjB,MAAMmK,EAAY3H,SAASE,eAAe,UAIpC0H,EAAW,KAEblE,EAAe+D,SAASE,EAAUnK,OAClCqK,EAAaC,IAAQpE,EAAe,EAAK,EACzCgB,KAEJiD,EAAUD,SAAWE,EACrBD,EAAUnK,MAAQ,EAElB,MAAMqK,EAAe7H,SAASE,eAAe,aAIvC6H,EAAc,KAEhBpE,EAAa8D,SAASI,EAAarK,OACnCkH,KAEJmD,EAAaH,SAAWK,EACxBF,EAAarK,MAAQ,EAErB,MAAMwK,EAAmBhI,SAASE,eAAe,mBAI3C+H,EAAkB,KAEpBrE,EAAe6D,SAASO,EAAiBxK,OACzCwH,EAAKzI,iBAAiBqH,GAEnBA,EAAe,GACdiB,EAAU,oFAAqF,YAGvGmD,EAAiBN,SAAWO,EAC5BD,EAAiBxK,MAAQ,EAEzB,MAAMgI,EAAaxF,SAASE,eAAe,eAIrCgI,EAAY,OAGlB1C,EAAWkC,SAAWQ,EAGtB,MAAMC,EAAkBnI,SAASE,eAAe,iBAI1CkI,EAAkB,KAEpBvE,EAAiB4D,SAASU,EAAgB3K,OAAS,IACnDwH,EAAKtI,mBAAmBmH,IAE5BsE,EAAgBT,SAAWU,EAC3BD,EAAgB3K,MAAQ,G","sources":["webpack://draught/../pkg/draught_bg.js","webpack://draught/./index.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 */\n get width() {\n const 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 */\n get height() {\n const 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 */\n get current_turn() {\n const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 */\n get row() {\n const 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 */\n get col() {\n const 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 const 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 const 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 */\n get last_node_count() {\n const 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 */\n get perfect_chance() {\n const 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 const 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 const 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 const 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 const ret = wasm.game_score(this.ptr);\n return ret;\n }\n /**\n * Get currently winning player\n * @returns {number | undefined}\n */\n winning() {\n const 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 const 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 const 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 const 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 const 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 const ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const 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 const ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const 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 const 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 const 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 */\n get team() {\n const 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 */\n get strength() {\n const 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 const 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 */\n get occupant() {\n const 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 */\n get state() {\n const 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 const 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 const 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 const 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 const 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 const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_693216e109162396() {\n const ret = new Error();\n return addHeapObject(ret);\n};\n\nexport function __wbg_stack_0ddaca5d1abfb52f(arg0, arg1) {\n const ret = getObject(arg1).stack;\n const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbg_error_09919627ac0992f5(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 const ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_crypto_b8c92eaac23d0d80(arg0) {\n const ret = getObject(arg0).crypto;\n return addHeapObject(ret);\n};\n\nexport function __wbg_msCrypto_9ad6677321a08dd8(arg0) {\n const ret = getObject(arg0).msCrypto;\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_is_undefined(arg0) {\n const ret = getObject(arg0) === undefined;\n return ret;\n};\n\nexport function __wbg_require_f5521a5b85ad2542(arg0, arg1, arg2) {\n const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));\n return addHeapObject(ret);\n};\n\nexport function __wbg_getRandomValues_dd27e6b0652b3236(arg0) {\n const 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 const ret = module;\n return addHeapObject(ret);\n};\n\nexport function __wbg_instanceof_Window_0e6c0f1096d66c3c(arg0) {\n const ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nexport function __wbg_document_99eddbbc11ec831e(arg0) {\n const ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_getElementById_f83c5de20dc455d6(arg0, arg1, arg2) {\n const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_error_8ff19d586a987aef(arg0) {\n console.error(getObject(arg0));\n};\n\nexport function __wbg_log_e8ba7b992c7ad0eb(arg0) {\n console.log(getObject(arg0));\n};\n\nexport function __wbg_instanceof_CanvasRenderingContext2d_405495bb0ea92c4f(arg0) {\n const ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n return ret;\n};\n\nexport function __wbg_setstrokeStyle_32540003cbfe210b(arg0, arg1) {\n getObject(arg0).strokeStyle = getObject(arg1);\n};\n\nexport function __wbg_setfillStyle_1d391c4891a6ec4d(arg0, arg1) {\n getObject(arg0).fillStyle = getObject(arg1);\n};\n\nexport function __wbg_setlineWidth_6f1b76036ab98bfc(arg0, arg1) {\n getObject(arg0).lineWidth = arg1;\n};\n\nexport function __wbg_beginPath_e040b5521d41f537(arg0) {\n getObject(arg0).beginPath();\n};\n\nexport function __wbg_fill_b6e37fbbefb55ae0(arg0) {\n getObject(arg0).fill();\n};\n\nexport function __wbg_stroke_63664360a52ce7d1(arg0) {\n getObject(arg0).stroke();\n};\n\nexport function __wbg_arc_85205a36bd04df0a() { 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_59b38b7e6f8d0717(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).fillRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_strokeRect_469c3838c9d01537(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef(arg0) {\n const ret = getObject(arg0) instanceof HTMLCanvasElement;\n return ret;\n};\n\nexport function __wbg_setwidth_654d8adcd4979eed(arg0, arg1) {\n getObject(arg0).width = arg1 >>> 0;\n};\n\nexport function __wbg_setheight_2b662384bfacb65c(arg0, arg1) {\n getObject(arg0).height = arg1 >>> 0;\n};\n\nexport function __wbg_getContext_0c19ba5c037e057f() { return handleError(function (arg0, arg1, arg2) {\n const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_newnoargs_e23b458e372830de(arg0, arg1) {\n const ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nexport function __wbg_call_ae78342adc33730a() { return handleError(function (arg0, arg1) {\n const ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_self_99737b4dcdf6f0d8() { return handleError(function () {\n const ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_window_9b61fbbf3564c4fb() { return handleError(function () {\n const ret = window.window;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_globalThis_8e275ef40caea3a3() { return handleError(function () {\n const ret = globalThis.globalThis;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_global_5de1e0f82bddcd27() { return handleError(function () {\n const ret = global.global;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_buffer_7af23f65f6c64548(arg0) {\n const ret = getObject(arg0).buffer;\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_cc9018bd6f283b6f(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n};\n\nexport function __wbg_set_f25e869e4565d2a2(arg0, arg1, arg2) {\n getObject(arg0).set(getObject(arg1), arg2 >>> 0);\n};\n\nexport function __wbg_length_0acb1cf9bbaf8519(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n};\n\nexport function __wbg_newwithlength_8f0657faca9f1422(arg0) {\n const ret = new Uint8Array(arg0 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbg_subarray_da527dbd24eafb6b(arg0, arg1, arg2) {\n const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_object_clone_ref(arg0) {\n const ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const 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 const 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\n let start = performance.now();\n\n game.ai_move();\n\n let end = performance.now();\n\n nodeCountText.innerText = `searched ${game.last_node_count.toLocaleString(\"en-GB\")} possible moves in ${(end - start).toLocaleString()}ms`;\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;"],"names":["heap","Array","fill","undefined","getObject","idx","push","heap_next","length","dropObject","takeObject","ret","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","static","create","prototype","__destroy_into_raw","free","width","arg0","height","current_turn","cell","Square","__wrap","set_cell","square","ptr0","grid_cell","BrdIdx","cell_index","row","col","cell_idx","board_index","can_move","from","to","ptr1","validate_man_move","from_square_occupant","Piece","ptr2","validate_king_move","jumpee_idx","cells","num_cells","num_pieces","num_player","team","score","cell_state","apply_move","apply_jump","king_row_idx","jumpee","from_occ","constructor","board","piece_rows","eq","other","Game","last_node_count","perfect_chance","current_board_cells","current_board_len","winning","has_won","current_cell_state","set_search_depth","search_depth","set_selected","set_perfect_chance","new_chance","clear_selected","make_move","execute_move","execute_jump","push_new_board","set_current","first_turn","canvas_id","canvas_width","canvas_height","len0","set_painter","value","Painter","draw","ai_move","canvas","set_square_outline","set_outline_width","set_draw_outline","reset_dimensions","validate_board_dim","strength","occupant","state","__wbindgen_object_drop_ref","__wbindgen_string_new","arg1","__wbg_new_693216e109162396","__wbg_stack_0ddaca5d1abfb52f","__wbg_error_09919627ac0992f5","console","error","__wbg_self_86b4b13392c7af56","self","arguments","__wbg_crypto_b8c92eaac23d0d80","crypto","__wbg_msCrypto_9ad6677321a08dd8","msCrypto","__wbindgen_is_undefined","__wbg_require_f5521a5b85ad2542","arg2","__wbg_getRandomValues_dd27e6b0652b3236","getRandomValues","__wbg_getRandomValues_e57c9b75ddead065","__wbg_randomFillSync_d2ba53160aec6aba","randomFillSync","__wbg_static_accessor_MODULE_452b4680e8614c81","__wbg_instanceof_Window_0e6c0f1096d66c3c","Window","__wbg_document_99eddbbc11ec831e","document","__wbg_getElementById_f83c5de20dc455d6","getElementById","__wbg_error_8ff19d586a987aef","__wbg_log_e8ba7b992c7ad0eb","log","__wbg_instanceof_CanvasRenderingContext2d_405495bb0ea92c4f","CanvasRenderingContext2D","__wbg_setstrokeStyle_32540003cbfe210b","strokeStyle","__wbg_setfillStyle_1d391c4891a6ec4d","fillStyle","__wbg_setlineWidth_6f1b76036ab98bfc","lineWidth","__wbg_beginPath_e040b5521d41f537","beginPath","__wbg_fill_b6e37fbbefb55ae0","__wbg_stroke_63664360a52ce7d1","stroke","__wbg_arc_85205a36bd04df0a","arg3","arg4","arg5","arc","__wbg_fillRect_59b38b7e6f8d0717","fillRect","__wbg_strokeRect_469c3838c9d01537","strokeRect","__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef","HTMLCanvasElement","__wbg_setwidth_654d8adcd4979eed","__wbg_setheight_2b662384bfacb65c","__wbg_getContext_0c19ba5c037e057f","getContext","__wbg_newnoargs_e23b458e372830de","Function","__wbg_call_ae78342adc33730a","__wbg_self_99737b4dcdf6f0d8","__wbg_window_9b61fbbf3564c4fb","window","__wbg_globalThis_8e275ef40caea3a3","globalThis","__wbg_global_5de1e0f82bddcd27","g","global","__wbg_buffer_7af23f65f6c64548","__wbg_new_cc9018bd6f283b6f","__wbg_set_f25e869e4565d2a2","__wbg_length_0acb1cf9bbaf8519","__wbg_newwithlength_8f0657faca9f1422","__wbg_subarray_da527dbd24eafb6b","__wbindgen_object_clone_ref","__wbindgen_debug_string","__wbindgen_throw","__wbindgen_memory","CANVAS_WIDTH","CANVAS_HEIGHT","BOARD_WIDTH","BOARD_HEIGHT","PIECE_ROWS","SEARCH_DEPTH","PERFECT_CHANCE","STATUS_TIMEOUT","WON_TIMEOUT","GameState","HUMAN_TURN","THINKING","FROM_SELECTED","AI_TURN","statusAlert","teamText","nodeCountText","winningText","onclick","start_game","wonTimeout","statusTimeout","setStatus","setStatusAlert","current_state","game","painter","clicks","clearInterval","updateTeamText","updateWinningText","process_canvas_click","cell_coord","aiCheckBox","checked","start","performance","now","end","innerText","toLocaleString","checkWon","getMousePos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","txt","alertType","hide","hidden","setTimeout","setInterval","addEventListener","event","mousepos","Math","floor","clientHeight","clientWidth","widthBox","onWidth","parseInt","onchange","heightBox","onHeight","pieceRowsBox","max","onPieceRows","aiSearchDepthBox","onAISearchDepth","onAICheck","aiPerfectChance","onPerfectChance"],"sourceRoot":""} \ No newline at end of file diff --git a/ed5ad1819e47a070ceaf.module.wasm b/cf9b7e45c1505173d7f2.module.wasm similarity index 54% rename from ed5ad1819e47a070ceaf.module.wasm rename to cf9b7e45c1505173d7f2.module.wasm index 24ef5cc..80ee852 100644 Binary files a/ed5ad1819e47a070ceaf.module.wasm and b/cf9b7e45c1505173d7f2.module.wasm differ diff --git a/doc/draught/comp/index.html b/doc/draught/comp/index.html index 7be96ea..e0099b5 100644 --- a/doc/draught/comp/index.html +++ b/doc/draught/comp/index.html @@ -4,7 +4,7 @@
-

Module draught::comp

source Β· []
Expand description

AI player logic

+

Module draught::comp

source Β· []
Expand description

AI player logic

Structs

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

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

diff --git a/doc/draught/comp/struct.Computer.html b/doc/draught/comp/struct.Computer.html index 92f553b..a2fb0c7 100644 --- a/doc/draught/comp/struct.Computer.html +++ b/doc/draught/comp/struct.Computer.html @@ -10,7 +10,7 @@ pub last_node_count: usize, pub perfect_chance: f64, }
Expand description

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

-

Fields

search_depth: usizeteam: Teamlast_node_count: usizeperfect_chance: f64

Implementations

Get vector of available moves for a given board

+

Fields

search_depth: usizeteam: Teamlast_node_count: usizeperfect_chance: f64

Implementations

Get vector of available moves for a given board

Generate tree of boards to given search depth, return root node

Propagate scores up the tree employing MiniMax algorithm

Get best of given scores for given team

@@ -21,8 +21,8 @@ Used for leaf nodes ready for propagating up tree

Insert all possible next boards as children of given board node

Insert given boards into tree

Get all possible next boards from given board

-

Get a new board based on the given using MiniMax to make decisions

-

Get a random board from possible node IDs and associated tree

+

Get a new board based on the given using MiniMax to make decisions

+

Get a random board from possible node IDs and associated tree

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

diff --git a/doc/src/draught/comp/mod.rs.html b/doc/src/draught/comp/mod.rs.html index 25a2de8..7153760 100644 --- a/doc/src/draught/comp/mod.rs.html +++ b/doc/src/draught/comp/mod.rs.html @@ -428,6 +428,11 @@ 423 424 425 +426 +427 +428 +429 +430
//! AI player logic
 
 use indextree::{Arena, Node, NodeId, NodeEdge};
@@ -746,6 +751,9 @@
     /// Get a new board based on the given using MiniMax to make decisions 
     pub fn get_move(&mut self, brd: Board) -> Option<Board> {
 
+        #[allow(unused_assignments)]
+        let mut ret: Option<Board> = None;
+
         let mut tree = Arena::new();
 
         // generate a tree to given depth for the given board
@@ -816,21 +824,21 @@
             if possible_perfect_moves.len() == 0 {
                 log_error!("No next moves matched the score of the root node, picking randomly instead");
                 
-                Some(Computer::random_choice(&tree, possible_moves, &mut rng))
+                ret = Some(Computer::random_choice(&tree, possible_moves, &mut rng));
             }
             // only one possible move, use that
             else if possible_perfect_moves.len() == 1 {
-                Some(possible_perfect_moves[0].board.clone())
+                ret = Some(possible_perfect_moves[0].board.clone());
             }
             // more than one possible perfect move to make, choose one randomly
             else {
-                Some(
+                ret = Some(
                     possible_perfect_moves
                         .choose(&mut rng) // random choice
                         .unwrap() // unwrap Option
                         .board
                         .clone()
-                )
+                );
             }
         } 
         // get random move
@@ -838,8 +846,10 @@
             #[cfg(feature = "debug_logs")]
             log!("Making random move");
 
-            Some(Computer::random_choice(&tree, possible_moves, &mut rng))
+            ret = Some(Computer::random_choice(&tree, possible_moves, &mut rng));
         }
+
+        ret
     }
 
     /// Get a random board from possible node IDs and associated tree