From 057883f88fd38475e0e62f58f364bbf3be60d234 Mon Sep 17 00:00:00 2001 From: Sarsoo Date: Thu, 5 May 2022 22:04:25 +0000 Subject: [PATCH] deploy: 771390ce85ce6ba40c5d1dd7ec10f561691aa41d --- 10.bootstrap.js | 2 +- 10.bootstrap.js.map | 2 +- ...e.wasm => cf9b7e45c1505173d7f2.module.wasm | Bin 124951 -> 125469 bytes doc/draught/comp/index.html | 2 +- doc/draught/comp/struct.Computer.html | 6 +++--- doc/src/draught/comp/mod.rs.html | 20 +++++++++++++----- 6 files changed, 21 insertions(+), 11 deletions(-) rename ed5ad1819e47a070ceaf.module.wasm => cf9b7e45c1505173d7f2.module.wasm (54%) 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,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B,EALW,IAAI,KACXyB,KAAKC,MAAOF,EAASX,EAAIvI,EAAOqJ,aAAgBvD,GAChDqD,KAAKC,MAAOF,EAASlQ,EAAIgH,EAAOsJ,YAAezD,QAmNvD,MAAM0D,EAAWnH,SAASE,eAAe,SAInCkH,EAAU,KAEZ3D,EAAc4D,SAASF,EAAS3J,OAChCkH,KAEJyC,EAASG,SAAWF,EACpBD,EAAS3J,MAAQ,EAEjB,MAAM+J,EAAYvH,SAASE,eAAe,UAIpCsH,EAAW,KAEb9D,EAAe2D,SAASE,EAAU/J,OAClCiK,EAAaC,IAAQhE,EAAe,EAAK,EACzCgB,KAEJ6C,EAAUD,SAAWE,EACrBD,EAAU/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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,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 24ef5cc7714e80b0b3fdb5a7d8ae84fc4a3d8f6a..80ee8528312f17ffe16a9dfd55e241425266b906 100644 GIT binary patch delta 17947 zcmb7M30xKR_MbB|$Z}c6jYUxB;)a5PWoRzRSZeCiva*-21rbTPC?JAbS>R5lxs3Y5 zqFhqbToV?sO)E<)ElVpkvwSV4{=erp_g--6z4w>TotfYHZRdCPb7o5H4}9TJ z;QD1D`UJg1w^xRE>^iOrd%G)1CCxtXIz#W;$3mlGDz$p)>0<^DO&^t2n4X`Vm6?@Z zn3XX?`N%fHVrhw;6c*d$eKpwW$;}$0e5cm-P8eB~QIM7XXhBw%vcUF)#dY{Vjj3L1 zl+&G;nOT&dkz1(zLXl4AP;BJw995W6n5DdAzZDka`9=-#LV1^8DcIY}&r}Yoq25N; zi2TCGl;wJuw_TK*KRn|xA~J+)=1@JGMs}9&dVqm;_OwS)vrFB10Rz;q;QzB+}FY6 zt=Tcn{xLiz_GQgWlG8wz(?JV!## zsSyrjXhHT62lOf#)l<^5bBAP&RW7UEi99JCbW%=HZD*8ob%ssz56j3+ACWgYOI1Fx zzlvx;mG++zvBg__D|?DY1LX^=_k-Et(gf+@cW@ol(k4&5I9%q%e(ACaE=H z;A2*S@{HVJsGqQ6FvkIi@cm*=AsBn08ZkDoNjj7q|1*bbgF~fefb}U`7_u{(9 z{=Rm@rY9)WH+)Dz#u()%itx%4aBxKI-*&4yZhFQ32d>ZBxph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o4rzZz$?2 zjTYt-su~P?P)5O*meJ&PXCbc95D^o?h-epTB@G=2ZNe)BTmdA~Sy%4O9FK1qq&Pu^ zkxuNeoGjSmPnS~@gxGhM!&AK?YOjF%IztRx0qZnFjJF>}_G9-7df4TWoBZvN8%_&2 zq2Mx#IKB&zW(djSim>4sVq_8B#>c23I-v?<_ZPsphN%Ec#)s9PpA_ zuJTpcoTBS$B&fd@kFTbBjZc^FbcCECiaF^+%n+&b(N|e9S8(l!0(z}kP3!8eBWDn1 zGT6Z$=?vgWZ>bT^Knc^Qh|z06)DOkRHPo;r+>t=VoRA;Dj)_0U=vhubMgNs&dFa@N zMY~^}xapTkd0bnz;?U*dJ$tVGpp-aYr>6oaw`BMR8XOq*C@D&1MNtZMT?xf=jyO?5 zskBnG*+LJpTN?5%Jzes}7P_QTq{!cZOvdPK6eRZVp{5TUudc%~VKAPL;Q2O?1>zYL z^jJWDT$_-lxIFfIqKSX_;8H5PZa($oh=)X9dJE}D+!m0YarnK*AZ80 z)(fL^G8LthXts-L=5+yx=jH2RT=M@P$VeHPoSHc_ZD?9{YF7H_ob=3$u4oJJ^y`La zW_EH~R#s+KcMpum^B((WjL68$%`iH1V;e&`j;Wd6y&v;|l*@nx0hX1LQL<+j)m9Uh zN9xL0T+iU@h^sNKKO%JHOI(|AO~f@AS9@Gagf8;8PzP~oCpE0nCrVdRfs1Jxg{x1L zaFx>QYD8_Zzm&SyWp?o&)4C_FUR=Q+*B?-nk}A9DmOu3@3HXHesuWjp^bqxo`ac#6 B?*;$> 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