From 067e9d2fe1f450f08a171c45a7a57f9d4aa5b5e4 Mon Sep 17 00:00:00 2001 From: Sarsoo Date: Fri, 9 Jul 2021 21:31:30 +0000 Subject: [PATCH] deploy: 5d3e20cf376cd5394b635e28589eeb46dd04226b --- 10.bootstrap.js | 2 +- 10.bootstrap.js.map | 2 +- ...e.wasm => 4ee49dc6adc51094e53f.module.wasm | Bin 121694 -> 121711 bytes doc/draught/game/index.html | 2 +- doc/draught/game/struct.Game.html | 16 ++++++++-------- doc/search-index.js | 2 +- doc/src/draught/game/mod.rs.html | 6 +++++- index.html | 8 +++++++- 8 files changed, 24 insertions(+), 14 deletions(-) rename 79476c847cbd09d58343.module.wasm => 4ee49dc6adc51094e53f.module.wasm (87%) diff --git a/10.bootstrap.js b/10.bootstrap.js index 1a8fff3..9f057b2 100644 --- a/10.bootstrap.js +++ b/10.bootstrap.js @@ -1,2 +1,2 @@ -(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,r,e)=>{"use strict";e.a(t,(async n=>{e.d(r,{wc:()=>x,SZ:()=>O,rh:()=>E,lA:()=>q,Ck:()=>I,ug:()=>C,h4:()=>A,h9:()=>W,Dz:()=>U,kF:()=>M,s8:()=>$,WB:()=>R,cP:()=>D,a:()=>P,l_:()=>z,U_:()=>F,EN:()=>J,qu:()=>N,Wg:()=>Y,B3:()=>K,I6:()=>L,Qb:()=>Q,cI:()=>X,QK:()=>H,Md:()=>Z,ox:()=>G,ES:()=>V,Ae:()=>tt,UL:()=>rt,qw:()=>et,tS:()=>nt,R$:()=>_t,md:()=>at,IF:()=>it,XP:()=>ot,m_:()=>ct,fY:()=>st,Or:()=>ut});var _=e(813);t=e.hmd(t);var a=n([_]);_=(a.then?await a:a)[0];const i=new Array(32).fill(void 0);function o(t){return i[t]}i.push(void 0,null,!0,!1);let c=i.length;let s=new("undefined"==typeof TextDecoder?(0,t.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});s.decode();let u=null;function p(){return null!==u&&u.buffer===_.memory.buffer||(u=new Uint8Array(_.memory.buffer)),u}function l(t,r){return s.decode(p().subarray(t,t+r))}function d(t){c===i.length&&i.push(i.length+1);const r=c;return c=i[r],i[r]=t,r}function b(t){const r=typeof t;if("number"==r||"boolean"==r||null==t)return`${t}`;if("string"==r)return`"${t}"`;if("symbol"==r){const r=t.description;return null==r?"Symbol":`Symbol(${r})`}if("function"==r){const r=t.name;return"string"==typeof r&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){const r=t.length;let e="[";r>0&&(e+=b(t[0]));for(let n=1;n1))return toString.call(t);if(n=e[1],"Object"==n)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:n}let g=0,w=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const f="function"==typeof w.encodeInto?function(t,r){return w.encodeInto(t,r)}:function(t,r){const e=w.encode(t);return r.set(e),{read:t.length,written:e.length}};function h(t,r,e){if(void 0===e){const e=w.encode(t),n=r(e.length);return p().subarray(n,n+e.length).set(e),g=e.length,n}let n=t.length,_=r(n);const a=p();let i=0;for(;i127)break;a[_+i]=r}if(i!==n){0!==i&&(t=t.slice(i)),_=e(_,n,n=i+3*t.length);const r=p().subarray(_+i,_+n);i+=f(t,r).written}return g=i,_}let m=null;function v(){return null!==m&&m.buffer===_.memory.buffer||(m=new Int32Array(_.memory.buffer)),m}function y(t){return null==t}function k(t,r){if(!(t instanceof r))throw new Error(`expected instance of ${r.name}`);return t.ptr}function x(){_.init_wasm()}function j(t,r){try{return t.apply(this,r)}catch(t){_.__wbindgen_exn_store(d(t))}}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"});const O=Object.freeze({Black:0,0:"Black",White:1,1:"White"});Object.freeze({Man:0,0:"Man",King:1,1:"King"}),Object.freeze({Empty:0,0:"Empty",Occupied:1,1:"Occupied",Unplayable:2,2:"Unplayable"}),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 S{static __wrap(t){const r=Object.create(S.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_board_free(t)}get width(){return _.__wbg_get_board_width(this.ptr)>>>0}set width(t){_.__wbg_set_board_width(this.ptr,t)}get height(){return _.__wbg_get_board_height(this.ptr)>>>0}set height(t){_.__wbg_set_board_height(this.ptr,t)}get current_turn(){return _.__wbg_get_board_current_turn(this.ptr)>>>0}set current_turn(t){_.__wbg_set_board_current_turn(this.ptr,t)}cell(t){var r=_.board_cell(this.ptr,t);return B.__wrap(r)}set_cell(t,r){k(r,B);var e=r.ptr;r.ptr=0,_.board_set_cell(this.ptr,t,e)}grid_cell(t){k(t,E);var r=t.ptr;t.ptr=0;var e=_.board_grid_cell(this.ptr,r);return B.__wrap(e)}cell_index(t,r){return _.board_cell_index(this.ptr,t,r)>>>0}cell_idx(t){k(t,E);var r=t.ptr;return t.ptr=0,_.board_cell_idx(this.ptr,r)>>>0}board_index(t){var r=_.board_board_index(this.ptr,t);return E.__wrap(r)}can_move(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;return r.ptr=0,_.board_can_move(this.ptr,e,n)>>>0}validate_man_move(t,r,e){k(t,E);var n=t.ptr;t.ptr=0,k(r,E);var a=r.ptr;r.ptr=0,k(e,T);var i=e.ptr;return e.ptr=0,_.board_validate_man_move(this.ptr,n,a,i)>>>0}validate_king_move(t,r,e){k(t,E);var n=t.ptr;t.ptr=0,k(r,E);var a=r.ptr;r.ptr=0,k(e,T);var i=e.ptr;return e.ptr=0,_.board_validate_king_move(this.ptr,n,a,i)>>>0}jumpee_idx(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;return r.ptr=0,_.board_jumpee_idx(this.ptr,e,n)>>>0}cells(){return _.board_cells(this.ptr)}num_cells(){return _.board_num_cells(this.ptr)>>>0}num_pieces(){return _.board_num_pieces(this.ptr)>>>0}num_player(t){return _.board_num_player(this.ptr,t)>>>0}score(){return _.board_score(this.ptr)}cell_state(t){return _.board_cell_state(this.ptr,t)>>>0}apply_move(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;r.ptr=0;var a=_.board_apply_move(this.ptr,e,n);return S.__wrap(a)}apply_jump(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;r.ptr=0;var a=_.board_apply_jump(this.ptr,e,n);return S.__wrap(a)}static validate_jumpee(t,r){k(t,B);var e=t.ptr;t.ptr=0,k(r,T);var n=r.ptr;return r.ptr=0,_.board_validate_jumpee(e,n)>>>0}static check_jumpee_team(t,r){k(t,T);var e=t.ptr;t.ptr=0,k(r,T);var n=r.ptr;return r.ptr=0,0!==_.board_check_jumpee_team(e,n)}constructor(t,r,e){var n=_.board_new(t,r,e);return S.__wrap(n)}static init_game(t,r){k(t,S);var e=t.ptr;t.ptr=0;var n=_.board_init_game(e,r);return S.__wrap(n)}}class E{static __wrap(t){const r=Object.create(E.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_brdidx_free(t)}get row(){return _.__wbg_get_brdidx_row(this.ptr)>>>0}set row(t){_.__wbg_set_brdidx_row(this.ptr,t)}get col(){return _.__wbg_get_brdidx_col(this.ptr)>>>0}set col(t){_.__wbg_set_brdidx_col(this.ptr,t)}constructor(t,r){var e=_.brdidx_from(t,r);return E.__wrap(e)}}class q{static __wrap(t){const r=Object.create(q.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_game_free(t)}current_board_cells(){return _.game_current_board_cells(this.ptr)}current_board_len(){return _.game_current_board_len(this.ptr)>>>0}current_turn(){return _.game_current_turn(this.ptr)>>>0}make_move(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;r.ptr=0,_.game_make_move(this.ptr,e,n)}execute_move(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;r.ptr=0,_.game_execute_move(this.ptr,e,n)}execute_jump(t,r){k(t,E);var e=t.ptr;t.ptr=0,k(r,E);var n=r.ptr;r.ptr=0,_.game_execute_jump(this.ptr,e,n)}push_new_board(t){k(t,S);var r=t.ptr;t.ptr=0,_.game_push_new_board(this.ptr,r)}set_current(t){k(t,S);var r=t.ptr;t.ptr=0,_.game_set_current(this.ptr,r)}constructor(t,r,e,n){var a=_.game_new(t,r,e,n);return q.__wrap(a)}static new_with_canvas(t,r,e,n,a,i,o){var c=h(a,_.__wbindgen_malloc,_.__wbindgen_realloc),s=g,u=_.game_new_with_canvas(t,r,e,n,c,s,i,o);return q.__wrap(u)}set_painter(t){k(t,I);var r=t.ptr;t.ptr=0,_.game_set_painter(this.ptr,r)}draw(){_.game_draw(this.ptr)}}class I{static __wrap(t){const r=Object.create(I.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_painter_free(t)}constructor(t,r,e){var n=h(e,_.__wbindgen_malloc,_.__wbindgen_realloc),a=g,i=_.painter_new(t,r,n,a);return I.__wrap(i)}static new_with_canvas(t,r,e){var n=_.painter_new_with_canvas(t,r,d(e));return I.__wrap(n)}set_square_outline(t){_.painter_set_square_outline(this.ptr,d(t))}set_outline_width(t){_.painter_set_outline_width(this.ptr,t)}set_draw_outline(t){_.painter_set_draw_outline(this.ptr,t)}reset_dimensions(){_.painter_reset_dimensions(this.ptr)}validate_board_dim(t){return k(t,S),0!==_.painter_validate_board_dim(this.ptr,t.ptr)}draw(t){k(t,S),_.painter_draw(this.ptr,t.ptr)}}class T{static __wrap(t){const r=Object.create(T.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_piece_free(t)}get team(){return _.__wbg_get_piece_team(this.ptr)>>>0}set team(t){_.__wbg_set_piece_team(this.ptr,t)}get strength(){return _.__wbg_get_piece_strength(this.ptr)>>>0}set strength(t){_.__wbg_set_piece_strength(this.ptr,t)}constructor(t,r){var e=_.piece_new(t,r);return T.__wrap(e)}}class B{static __wrap(t){const r=Object.create(B.prototype);return r.ptr=t,r}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_square_free(t)}get occupant(){var t=_.__wbg_get_square_occupant(this.ptr);return 0===t?void 0:T.__wrap(t)}set occupant(t){let r=0;y(t)||(k(t,T),r=t.ptr,t.ptr=0),_.__wbg_set_square_occupant(this.ptr,r)}get state(){return _.__wbg_get_square_state(this.ptr)>>>0}set state(t){_.__wbg_set_square_state(this.ptr,t)}constructor(t,r){let e=0;y(r)||(k(r,T),e=r.ptr,r.ptr=0);var n=_.square_new(t,e);return B.__wrap(n)}static pc(t,r){var e=_.square_pc(t,r);return B.__wrap(e)}static empty(){var t=_.square_empty();return B.__wrap(t)}static unplay(){var t=_.square_unplay();return B.__wrap(t)}}function C(t){!function(t){const r=o(t);(function(t){t<36||(i[t]=c,c=t)})(t)}(t)}function A(t,r){return d(l(t,r))}function W(){return d(new Error)}function U(t,r){var e=h(o(r).stack,_.__wbindgen_malloc,_.__wbindgen_realloc),n=g;v()[t/4+1]=n,v()[t/4+0]=e}function M(t,r){try{console.error(l(t,r))}finally{_.__wbindgen_free(t,r)}}function $(t){return o(t)instanceof Window}function R(t){var r=o(t).document;return y(r)?0:d(r)}function D(t,r,e){var n=o(t).getElementById(l(r,e));return y(n)?0:d(n)}function P(t){console.log(o(t))}function z(t){return o(t)instanceof CanvasRenderingContext2D}function F(t,r){o(t).strokeStyle=o(r)}function J(t,r){o(t).fillStyle=o(r)}function N(t,r){o(t).lineWidth=r}function Y(t){o(t).beginPath()}function K(t){o(t).fill()}function L(t){o(t).stroke()}function Q(){return j((function(t,r,e,n,_,a){o(t).arc(r,e,n,_,a)}),arguments)}function X(t,r,e,n,_){o(t).fillRect(r,e,n,_)}function H(t,r,e,n,_){o(t).strokeRect(r,e,n,_)}function Z(t){return o(t)instanceof HTMLCanvasElement}function G(t,r){o(t).width=r>>>0}function V(t,r){o(t).height=r>>>0}function tt(){return j((function(t,r,e){var n=o(t).getContext(l(r,e));return y(n)?0:d(n)}),arguments)}function rt(t,r){return d(new Function(l(t,r)))}function et(){return j((function(t,r){return d(o(t).call(o(r)))}),arguments)}function nt(){return j((function(){return d(self.self)}),arguments)}function _t(){return j((function(){return d(window.window)}),arguments)}function at(){return j((function(){return d(globalThis.globalThis)}),arguments)}function it(){return j((function(){return d(e.g.global)}),arguments)}function ot(t){return void 0===o(t)}function ct(t){return d(o(t))}function st(t,r){var e=h(b(o(r)),_.__wbindgen_malloc,_.__wbindgen_realloc),n=g;v()[t/4+1]=n,v()[t/4+0]=e}function ut(t,r){throw new Error(l(t,r))}}))},813:(t,r,e)=>{"use strict";var n=([n])=>e.v(r,t.id,"79476c847cbd09d58343",{"./draught_bg.js":{__wbindgen_object_drop_ref:n.ug,__wbindgen_string_new:n.h4,__wbg_new_59cb74e423758ede:n.h9,__wbg_stack_558ba5917b466edd:n.Dz,__wbg_error_4bb6c2a97407129a:n.kF,__wbg_instanceof_Window_11e25482011fc506:n.s8,__wbg_document_5aff8cd83ef968f5:n.WB,__wbg_getElementById_b180ea4ada06a837:n.cP,__wbg_log_9a99fb1af846153b:n.a,__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b:n.l_,__wbg_setstrokeStyle_2939ee453716e462:n.U_,__wbg_setfillStyle_af790b5baf4d3210:n.EN,__wbg_setlineWidth_3e6b1837ae38d099:n.qu,__wbg_beginPath_2378575e37027ad3:n.Wg,__wbg_fill_558339447ed6ad43:n.B3,__wbg_stroke_c1e0313c58997dcf:n.I6,__wbg_arc_fffd87d9113dce32:n.Qb,__wbg_fillRect_46ffc8d2cef7e298:n.cI,__wbg_strokeRect_7ea34fad8a7f0fe2:n.QK,__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792:n.Md,__wbg_setwidth_f3c88eb520ba8d47:n.ox,__wbg_setheight_5a1abba41e35c42a:n.ES,__wbg_getContext_813df131fcbd6e91:n.Ae,__wbg_newnoargs_9fdd8f3961dd1bee:n.UL,__wbg_call_ba36642bd901572b:n.qw,__wbg_self_bb69a836a72ec6e9:n.tS,__wbg_window_3304fc4b414c9693:n.R$,__wbg_globalThis_e0d21cabc6630763:n.md,__wbg_global_8463719227271676:n.IF,__wbindgen_is_undefined:n.XP,__wbindgen_object_clone_ref:n.m_,__wbindgen_debug_string:n.fY,__wbindgen_throw:n.Or}});e.a(t,(t=>{var r=t([e(171)]);return r.then?r.then(n):n(r)}),1)},10:(t,r,e)=>{"use strict";e.a(t,(async t=>{e.r(r);var n=e(171),_=t([n]);n=(_.then?await _:_)[0];const a="human_turn.thinking",i="human_turn.from_selected";(0,n.wc)();let o=a,c=new n.Ck(480,480,"game-canvas"),s=null,u=null,p=new n.lA(8,8,3,n.SZ.Black);p.set_painter(c),p.draw();const l=document.getElementById("game-canvas");l.addEventListener("click",(t=>{var r=function(t,r){var e=t.getBoundingClientRect();return{x:r.clientX-e.left,y:r.clientY-e.top}}(l,t);!function(t){switch(o){case a:console.log("Your turn, first piece picked"),s=t,o=i;break;case i:console.log("Your turn, first piece already picked, picking second"),u=t,p.make_move(s,u),p.draw(),o=a;break;case"ai_turn":console.log("It's the AI's turn!")}}(new n.rh(Math.floor(r.y/480*8),Math.floor(r.x/480*8)))}))}))}}]); +(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,e,r)=>{"use strict";r.a(t,(async n=>{r.d(e,{wc:()=>k,SZ:()=>T,Tt:()=>O,rh:()=>E,lA:()=>I,Ck:()=>q,ug:()=>A,h4:()=>U,h9:()=>W,Dz:()=>M,kF:()=>$,s8:()=>D,WB:()=>J,cP:()=>P,a:()=>R,l_:()=>z,U_:()=>F,EN:()=>N,qu:()=>Y,Wg:()=>K,B3:()=>L,I6:()=>Q,Qb:()=>X,cI:()=>H,QK:()=>Z,Md:()=>G,ox:()=>V,ES:()=>tt,Ae:()=>et,UL:()=>rt,qw:()=>nt,tS:()=>_t,R$:()=>at,md:()=>ct,IF:()=>it,XP:()=>ot,m_:()=>st,fY:()=>ut,Or:()=>pt});var _=r(813);t=r.hmd(t);var a=n([_]);_=(a.then?await a:a)[0];const c=new Array(32).fill(void 0);function i(t){return c[t]}c.push(void 0,null,!0,!1);let o=c.length;let s=new("undefined"==typeof TextDecoder?(0,t.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});s.decode();let u=null;function p(){return null!==u&&u.buffer===_.memory.buffer||(u=new Uint8Array(_.memory.buffer)),u}function l(t,e){return s.decode(p().subarray(t,t+e))}function d(t){o===c.length&&c.push(c.length+1);const e=o;return o=c[e],c[e]=t,e}function b(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return`${t}`;if("string"==e)return`"${t}"`;if("symbol"==e){const e=t.description;return null==e?"Symbol":`Symbol(${e})`}if("function"==e){const e=t.name;return"string"==typeof e&&e.length>0?`Function(${e})`:"Function"}if(Array.isArray(t)){const e=t.length;let r="[";e>0&&(r+=b(t[0]));for(let n=1;n1))return toString.call(t);if(n=r[1],"Object"==n)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:n}let g=0,w=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const f="function"==typeof w.encodeInto?function(t,e){return w.encodeInto(t,e)}:function(t,e){const r=w.encode(t);return e.set(r),{read:t.length,written:r.length}};function h(t,e,r){if(void 0===r){const r=w.encode(t),n=e(r.length);return p().subarray(n,n+r.length).set(r),g=r.length,n}let n=t.length,_=e(n);const a=p();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=p().subarray(_+c,_+n);c+=f(t,e).written}return g=c,_}let m=null;function v(){return null!==m&&m.buffer===_.memory.buffer||(m=new Int32Array(_.memory.buffer)),m}function y(t){return null==t}function x(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`);return t.ptr}function k(){_.init_wasm()}function j(t,e){try{return t.apply(this,e)}catch(t){_.__wbindgen_exn_store(d(t))}}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"});const T=Object.freeze({Black:0,0:"Black",White:1,1:"White"}),O=(Object.freeze({Man:0,0:"Man",King:1,1:"King"}),Object.freeze({Empty:0,0:"Empty",Occupied:1,1:"Occupied",Unplayable:2,2:"Unplayable"}),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 S{static __wrap(t){const e=Object.create(S.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_board_free(t)}get width(){return _.__wbg_get_board_width(this.ptr)>>>0}set width(t){_.__wbg_set_board_width(this.ptr,t)}get height(){return _.__wbg_get_board_height(this.ptr)>>>0}set height(t){_.__wbg_set_board_height(this.ptr,t)}get current_turn(){return _.__wbg_get_board_current_turn(this.ptr)>>>0}set current_turn(t){_.__wbg_set_board_current_turn(this.ptr,t)}cell(t){var e=_.board_cell(this.ptr,t);return C.__wrap(e)}set_cell(t,e){x(e,C);var r=e.ptr;e.ptr=0,_.board_set_cell(this.ptr,t,r)}grid_cell(t){x(t,E);var e=t.ptr;t.ptr=0;var r=_.board_grid_cell(this.ptr,e);return C.__wrap(r)}cell_index(t,e){return _.board_cell_index(this.ptr,t,e)>>>0}cell_idx(t){x(t,E);var e=t.ptr;return t.ptr=0,_.board_cell_idx(this.ptr,e)>>>0}board_index(t){var e=_.board_board_index(this.ptr,t);return E.__wrap(e)}can_move(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;return e.ptr=0,_.board_can_move(this.ptr,r,n)>>>0}validate_man_move(t,e,r){x(t,E);var n=t.ptr;t.ptr=0,x(e,E);var a=e.ptr;e.ptr=0,x(r,B);var c=r.ptr;return r.ptr=0,_.board_validate_man_move(this.ptr,n,a,c)>>>0}validate_king_move(t,e,r){x(t,E);var n=t.ptr;t.ptr=0,x(e,E);var a=e.ptr;e.ptr=0,x(r,B);var c=r.ptr;return r.ptr=0,_.board_validate_king_move(this.ptr,n,a,c)>>>0}jumpee_idx(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;return e.ptr=0,_.board_jumpee_idx(this.ptr,r,n)>>>0}cells(){return _.board_cells(this.ptr)}num_cells(){return _.board_num_cells(this.ptr)>>>0}num_pieces(){return _.board_num_pieces(this.ptr)>>>0}num_player(t){return _.board_num_player(this.ptr,t)>>>0}score(){return _.board_score(this.ptr)}cell_state(t){return _.board_cell_state(this.ptr,t)>>>0}apply_move(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;e.ptr=0;var a=_.board_apply_move(this.ptr,r,n);return S.__wrap(a)}apply_jump(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;e.ptr=0;var a=_.board_apply_jump(this.ptr,r,n);return S.__wrap(a)}static validate_jumpee(t,e){x(t,C);var r=t.ptr;t.ptr=0,x(e,B);var n=e.ptr;return e.ptr=0,_.board_validate_jumpee(r,n)>>>0}static check_jumpee_team(t,e){x(t,B);var r=t.ptr;t.ptr=0,x(e,B);var n=e.ptr;return e.ptr=0,0!==_.board_check_jumpee_team(r,n)}constructor(t,e,r){var n=_.board_new(t,e,r);return S.__wrap(n)}static init_game(t,e){x(t,S);var r=t.ptr;t.ptr=0;var n=_.board_init_game(r,e);return S.__wrap(n)}}class E{static __wrap(t){const e=Object.create(E.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_brdidx_free(t)}get row(){return _.__wbg_get_brdidx_row(this.ptr)>>>0}set row(t){_.__wbg_set_brdidx_row(this.ptr,t)}get col(){return _.__wbg_get_brdidx_col(this.ptr)>>>0}set col(t){_.__wbg_set_brdidx_col(this.ptr,t)}constructor(t,e){var r=_.brdidx_from(t,e);return E.__wrap(r)}}class I{static __wrap(t){const e=Object.create(I.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_game_free(t)}current_board_cells(){return _.game_current_board_cells(this.ptr)}current_board_len(){return _.game_current_board_len(this.ptr)>>>0}current_turn(){return _.game_current_turn(this.ptr)>>>0}make_move(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;return e.ptr=0,_.game_make_move(this.ptr,r,n)>>>0}execute_move(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;e.ptr=0,_.game_execute_move(this.ptr,r,n)}execute_jump(t,e){x(t,E);var r=t.ptr;t.ptr=0,x(e,E);var n=e.ptr;e.ptr=0,_.game_execute_jump(this.ptr,r,n)}push_new_board(t){x(t,S);var e=t.ptr;t.ptr=0,_.game_push_new_board(this.ptr,e)}set_current(t){x(t,S);var e=t.ptr;t.ptr=0,_.game_set_current(this.ptr,e)}constructor(t,e,r,n){var a=_.game_new(t,e,r,n);return I.__wrap(a)}static new_with_canvas(t,e,r,n,a,c,i){var o=h(a,_.__wbindgen_malloc,_.__wbindgen_realloc),s=g,u=_.game_new_with_canvas(t,e,r,n,o,s,c,i);return I.__wrap(u)}set_painter(t){x(t,q);var e=t.ptr;t.ptr=0,_.game_set_painter(this.ptr,e)}draw(){_.game_draw(this.ptr)}}class q{static __wrap(t){const e=Object.create(q.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_painter_free(t)}constructor(t,e,r){var n=h(r,_.__wbindgen_malloc,_.__wbindgen_realloc),a=g,c=_.painter_new(t,e,n,a);return q.__wrap(c)}static new_with_canvas(t,e,r){var n=_.painter_new_with_canvas(t,e,d(r));return q.__wrap(n)}set_square_outline(t){_.painter_set_square_outline(this.ptr,d(t))}set_outline_width(t){_.painter_set_outline_width(this.ptr,t)}set_draw_outline(t){_.painter_set_draw_outline(this.ptr,t)}reset_dimensions(){_.painter_reset_dimensions(this.ptr)}validate_board_dim(t){return x(t,S),0!==_.painter_validate_board_dim(this.ptr,t.ptr)}draw(t){x(t,S),_.painter_draw(this.ptr,t.ptr)}}class B{static __wrap(t){const e=Object.create(B.prototype);return e.ptr=t,e}__destroy_into_raw(){const t=this.ptr;return this.ptr=0,t}free(){const t=this.__destroy_into_raw();_.__wbg_piece_free(t)}get team(){return _.__wbg_get_piece_team(this.ptr)>>>0}set team(t){_.__wbg_set_piece_team(this.ptr,t)}get strength(){return _.__wbg_get_piece_strength(this.ptr)>>>0}set strength(t){_.__wbg_set_piece_strength(this.ptr,t)}constructor(t,e){var r=_.piece_new(t,e);return B.__wrap(r)}}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();_.__wbg_square_free(t)}get occupant(){var t=_.__wbg_get_square_occupant(this.ptr);return 0===t?void 0:B.__wrap(t)}set occupant(t){let e=0;y(t)||(x(t,B),e=t.ptr,t.ptr=0),_.__wbg_set_square_occupant(this.ptr,e)}get state(){return _.__wbg_get_square_state(this.ptr)>>>0}set state(t){_.__wbg_set_square_state(this.ptr,t)}constructor(t,e){let r=0;y(e)||(x(e,B),r=e.ptr,e.ptr=0);var n=_.square_new(t,r);return C.__wrap(n)}static pc(t,e){var r=_.square_pc(t,e);return C.__wrap(r)}static empty(){var t=_.square_empty();return C.__wrap(t)}static unplay(){var t=_.square_unplay();return C.__wrap(t)}}function A(t){!function(t){const e=i(t);(function(t){t<36||(c[t]=o,o=t)})(t)}(t)}function U(t,e){return d(l(t,e))}function W(){return d(new Error)}function M(t,e){var r=h(i(e).stack,_.__wbindgen_malloc,_.__wbindgen_realloc),n=g;v()[t/4+1]=n,v()[t/4+0]=r}function $(t,e){try{console.error(l(t,e))}finally{_.__wbindgen_free(t,e)}}function D(t){return i(t)instanceof Window}function J(t){var e=i(t).document;return y(e)?0:d(e)}function P(t,e,r){var n=i(t).getElementById(l(e,r));return y(n)?0:d(n)}function R(t){console.log(i(t))}function z(t){return i(t)instanceof CanvasRenderingContext2D}function F(t,e){i(t).strokeStyle=i(e)}function N(t,e){i(t).fillStyle=i(e)}function Y(t,e){i(t).lineWidth=e}function K(t){i(t).beginPath()}function L(t){i(t).fill()}function Q(t){i(t).stroke()}function X(){return j((function(t,e,r,n,_,a){i(t).arc(e,r,n,_,a)}),arguments)}function H(t,e,r,n,_){i(t).fillRect(e,r,n,_)}function Z(t,e,r,n,_){i(t).strokeRect(e,r,n,_)}function G(t){return i(t)instanceof HTMLCanvasElement}function V(t,e){i(t).width=e>>>0}function tt(t,e){i(t).height=e>>>0}function et(){return j((function(t,e,r){var n=i(t).getContext(l(e,r));return y(n)?0:d(n)}),arguments)}function rt(t,e){return d(new Function(l(t,e)))}function nt(){return j((function(t,e){return d(i(t).call(i(e)))}),arguments)}function _t(){return j((function(){return d(self.self)}),arguments)}function at(){return j((function(){return d(window.window)}),arguments)}function ct(){return j((function(){return d(globalThis.globalThis)}),arguments)}function it(){return j((function(){return d(r.g.global)}),arguments)}function ot(t){return void 0===i(t)}function st(t){return d(i(t))}function ut(t,e){var r=h(b(i(e)),_.__wbindgen_malloc,_.__wbindgen_realloc),n=g;v()[t/4+1]=n,v()[t/4+0]=r}function pt(t,e){throw new Error(l(t,e))}}))},813:(t,e,r)=>{"use strict";var n=([n])=>r.v(e,t.id,"4ee49dc6adc51094e53f",{"./draught_bg.js":{__wbindgen_object_drop_ref:n.ug,__wbindgen_string_new:n.h4,__wbg_new_59cb74e423758ede:n.h9,__wbg_stack_558ba5917b466edd:n.Dz,__wbg_error_4bb6c2a97407129a:n.kF,__wbg_instanceof_Window_11e25482011fc506:n.s8,__wbg_document_5aff8cd83ef968f5:n.WB,__wbg_getElementById_b180ea4ada06a837:n.cP,__wbg_log_9a99fb1af846153b:n.a,__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b:n.l_,__wbg_setstrokeStyle_2939ee453716e462:n.U_,__wbg_setfillStyle_af790b5baf4d3210:n.EN,__wbg_setlineWidth_3e6b1837ae38d099:n.qu,__wbg_beginPath_2378575e37027ad3:n.Wg,__wbg_fill_558339447ed6ad43:n.B3,__wbg_stroke_c1e0313c58997dcf:n.I6,__wbg_arc_fffd87d9113dce32:n.Qb,__wbg_fillRect_46ffc8d2cef7e298:n.cI,__wbg_strokeRect_7ea34fad8a7f0fe2:n.QK,__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792:n.Md,__wbg_setwidth_f3c88eb520ba8d47:n.ox,__wbg_setheight_5a1abba41e35c42a:n.ES,__wbg_getContext_813df131fcbd6e91:n.Ae,__wbg_newnoargs_9fdd8f3961dd1bee:n.UL,__wbg_call_ba36642bd901572b:n.qw,__wbg_self_bb69a836a72ec6e9:n.tS,__wbg_window_3304fc4b414c9693:n.R$,__wbg_globalThis_e0d21cabc6630763:n.md,__wbg_global_8463719227271676:n.IF,__wbindgen_is_undefined:n.XP,__wbindgen_object_clone_ref:n.m_,__wbindgen_debug_string:n.fY,__wbindgen_throw:n.Or}});r.a(t,(t=>{var e=t([r(171)]);return e.then?e.then(n):n(e)}),1)},10:(t,e,r)=>{"use strict";r.a(t,(async t=>{r.r(e);var n=r(171),_=t([n]);n=(_.then?await _:_)[0];const a="human_turn.thinking",c="human_turn.from_selected";(0,n.wc)();const i=document.getElementById("status-p");let o=a,s=new n.Ck(480,480,"game-canvas"),u=null,p=null,l=new n.lA(8,8,3,n.SZ.Black);l.set_painter(s),l.draw();const d=document.getElementById("game-canvas");d.addEventListener("click",(t=>{var e=function(t,e){var r=t.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}}(d,t);!function(t){switch(o){case a:console.log("Your turn, first piece picked"),u=t,o=c;break;case c:if(console.log("Your turn, first piece already picked, picking second"),p=t,u.col==p.col&&u.row==p.row)"Move Cancelled",i.hidden=!1,i.innerText="Move Cancelled";else{let t=l.make_move(u,p);if(t==n.Tt.Allowed);else switch(t){case n.Tt.Allowed:case n.Tt.IllegalTrajectory:case n.Tt.JumpingSameTeam:case n.Tt.NoJumpablePiece:case n.Tt.OccupiedDest:case n.Tt.OutOfBounds:case n.Tt.UnoccupiedSrc:case n.Tt.Unplayable:case n.Tt.WrongTeamSrc:}}l.draw(),u=null,p=null,o=a;break;case"ai_turn":console.log("It's the AI's turn!")}}(new n.rh(Math.floor(e.y/480*8),Math.floor(e.x/480*8)))}))}))}}]); //# sourceMappingURL=10.bootstrap.js.map \ No newline at end of file diff --git a/10.bootstrap.js.map b/10.bootstrap.js.map index df7fcee..85757c6 100644 --- a/10.bootstrap.js.map +++ b/10.bootstrap.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://draught/../pkg/draught_bg.js","webpack://draught/./index.js"],"names":["heap","Array","fill","undefined","getObject","idx","push","heap_next","length","cachedTextDecoder","TextDecoder","module","require","ignoreBOM","fatal","decode","cachegetUint8Memory0","getUint8Memory0","buffer","Uint8Array","getStringFromWasm0","ptr","len","subarray","addHeapObject","obj","debugString","val","type","description","name","isArray","debug","i","builtInMatches","exec","toString","call","className","JSON","stringify","_","Error","message","stack","WASM_VECTOR_LEN","cachedTextEncoder","TextEncoder","encodeString","encodeInto","arg","view","buf","encode","set","read","written","passStringToWasm0","malloc","realloc","mem","offset","code","charCodeAt","slice","cachegetInt32Memory0","getInt32Memory0","Int32Array","isLikeNone","x","_assertClass","instance","klass","init_wasm","handleError","f","args","apply","this","e","Object","freeze","Move","Jump","Team","Black","White","Man","King","Empty","Occupied","Unplayable","Allowed","UnoccupiedSrc","OccupiedDest","OutOfBounds","WrongTeamSrc","IllegalTrajectory","NoJumpablePiece","JumpingSameTeam","Board","create","prototype","__destroy_into_raw","arg0","ret","Square","__wrap","square","ptr0","BrdIdx","row","col","from","to","ptr1","from_square_occupant","Piece","ptr2","team","jumpee","from_occ","width","height","current_turn","board","piece_rows","Game","first_turn","canvas_id","canvas_width","canvas_height","len0","value","Painter","canvas","strength","state","occupant","__wbindgen_object_drop_ref","dropObject","takeObject","__wbindgen_string_new","arg1","__wbg_new_59cb74e423758ede","__wbg_stack_558ba5917b466edd","__wbg_error_4bb6c2a97407129a","console","error","__wbg_instanceof_Window_11e25482011fc506","Window","__wbg_document_5aff8cd83ef968f5","document","__wbg_getElementById_b180ea4ada06a837","arg2","getElementById","__wbg_log_9a99fb1af846153b","log","__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b","CanvasRenderingContext2D","__wbg_setstrokeStyle_2939ee453716e462","strokeStyle","__wbg_setfillStyle_af790b5baf4d3210","fillStyle","__wbg_setlineWidth_3e6b1837ae38d099","lineWidth","__wbg_beginPath_2378575e37027ad3","beginPath","__wbg_fill_558339447ed6ad43","__wbg_stroke_c1e0313c58997dcf","stroke","__wbg_arc_fffd87d9113dce32","arg3","arg4","arg5","arc","arguments","__wbg_fillRect_46ffc8d2cef7e298","fillRect","__wbg_strokeRect_7ea34fad8a7f0fe2","strokeRect","__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792","HTMLCanvasElement","__wbg_setwidth_f3c88eb520ba8d47","__wbg_setheight_5a1abba41e35c42a","__wbg_getContext_813df131fcbd6e91","getContext","__wbg_newnoargs_9fdd8f3961dd1bee","Function","__wbg_call_ba36642bd901572b","__wbg_self_bb69a836a72ec6e9","self","__wbg_window_3304fc4b414c9693","window","__wbg_globalThis_e0d21cabc6630763","globalThis","__wbg_global_8463719227271676","g","global","__wbindgen_is_undefined","__wbindgen_object_clone_ref","__wbindgen_debug_string","__wbindgen_throw","GameState","current_state","painter","game","set_painter","draw","addEventListener","event","mousepos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","getMousePos","cell_coord","make_move","process_canvas_click","Math","floor"],"mappings":"shBAEA,MAAMA,EAAO,IAAIC,MAAM,IAAIC,UAAKC,GAIhC,SAASC,EAAUC,GAAO,OAAOL,EAAKK,GAFtCL,EAAKM,UAAKH,EAAW,MAAM,GAAM,GAIjC,IAAII,EAAYP,EAAKQ,OAgBrB,IAAIC,EAAoB,IAFoB,oBAAhBC,aAA8B,EAAIC,EAAOC,SAAS,QAAQF,YAAcA,aAE3D,QAAS,CAAEG,WAAW,EAAMC,OAAO,IAE5EL,EAAkBM,SAElB,IAAIC,EAAuB,KAC3B,SAASC,IAIL,OAH6B,OAAzBD,GAAiCA,EAAqBE,SAAW,kBACjEF,EAAuB,IAAIG,WAAW,kBAEnCH,EAGX,SAASI,EAAmBC,EAAKC,GAC7B,OAAOb,EAAkBM,OAAOE,IAAkBM,SAASF,EAAKA,EAAMC,IAG1E,SAASE,EAAcC,GACflB,IAAcP,EAAKQ,QAAQR,EAAKM,KAAKN,EAAKQ,OAAS,GACvD,MAAMH,EAAME,EAIZ,OAHAA,EAAYP,EAAKK,GAEjBL,EAAKK,GAAOoB,EACLpB,EAGX,SAASqB,EAAYC,GAEjB,MAAMC,SAAcD,EACpB,GAAY,UAARC,GAA4B,WAARA,GAA4B,MAAPD,EACzC,MAAQ,GAAGA,IAEf,GAAY,UAARC,EACA,MAAO,IAAID,KAEf,GAAY,UAARC,EAAkB,CAClB,MAAMC,EAAcF,EAAIE,YACxB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AAU7G,EAAMC,GACrB4F,EAAKE,OAELJ,EAAgBD,EAEhB,MACJ,IArEK,UAsEDxD,QAAQU,IAAI,wBAnCpBkE,CALW,IAAI,KACXC,KAAKC,MAAOd,EAASM,EA3CP,IAGD,GAyCbO,KAAKC,MAAOd,EAAS9I,EA7CR,IAGD","file":"10.bootstrap.js","sourcesContent":["import * as wasm from './draught_bg.wasm';\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n return instance.ptr;\n}\n/**\n*/\nexport function init_wasm() {\n wasm.init_wasm();\n}\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_exn_store(addHeapObject(e));\n }\n}\n/**\n*/\nexport const MoveType = Object.freeze({ Move:0,\"0\":\"Move\",Jump:1,\"1\":\"Jump\", });\n/**\n*/\nexport const Team = Object.freeze({ Black:0,\"0\":\"Black\",White:1,\"1\":\"White\", });\n/**\n*/\nexport const Strength = Object.freeze({ Man:0,\"0\":\"Man\",King:1,\"1\":\"King\", });\n/**\n*/\nexport const SquareState = Object.freeze({ Empty:0,\"0\":\"Empty\",Occupied:1,\"1\":\"Occupied\",Unplayable:2,\"2\":\"Unplayable\", });\n/**\n*/\nexport const Moveable = Object.freeze({ Allowed:0,\"0\":\"Allowed\",UnoccupiedSrc:1,\"1\":\"UnoccupiedSrc\",OccupiedDest:2,\"2\":\"OccupiedDest\",OutOfBounds:3,\"3\":\"OutOfBounds\",Unplayable:4,\"4\":\"Unplayable\",WrongTeamSrc:5,\"5\":\"WrongTeamSrc\",IllegalTrajectory:6,\"6\":\"IllegalTrajectory\",NoJumpablePiece:7,\"7\":\"NoJumpablePiece\",JumpingSameTeam:8,\"8\":\"JumpingSameTeam\", });\n/**\n* Single state of a checkers board\n*/\nexport class Board {\n\n static __wrap(ptr) {\n const obj = Object.create(Board.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_board_free(ptr);\n }\n /**\n * @returns {number}\n */\n get width() {\n var ret = wasm.__wbg_get_board_width(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set width(arg0) {\n wasm.__wbg_set_board_width(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get height() {\n var ret = wasm.__wbg_get_board_height(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set height(arg0) {\n wasm.__wbg_set_board_height(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get current_turn() {\n var ret = wasm.__wbg_get_board_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set current_turn(arg0) {\n wasm.__wbg_set_board_current_turn(this.ptr, arg0);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @returns {Square}\n */\n cell(idx) {\n var ret = wasm.board_cell(this.ptr, idx);\n return Square.__wrap(ret);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @param {Square} square\n */\n set_cell(idx, square) {\n _assertClass(square, Square);\n var ptr0 = square.ptr;\n square.ptr = 0;\n wasm.board_set_cell(this.ptr, idx, ptr0);\n }\n /**\n * Get a copy of a board square by 2D [`BrdIdx`] index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n grid_cell(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_grid_cell(this.ptr, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {number} row\n * @param {number} col\n * @returns {number}\n */\n cell_index(row, col) {\n var ret = wasm.board_cell_index(this.ptr, row, col);\n return ret >>> 0;\n }\n /**\n * Similar to [`Board::cell_index`] but with a [`BrdIdx`] instead of separate indices. Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {BrdIdx} idx\n * @returns {number}\n */\n cell_idx(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_cell_idx(this.ptr, ptr0);\n return ret >>> 0;\n }\n /**\n * Transform a 1D array index (for [`Board::cells`]) into a 2D game board index (by row/col)\n * @param {number} idx\n * @returns {BrdIdx}\n */\n board_index(idx) {\n var ret = wasm.board_board_index(this.ptr, idx);\n return BrdIdx.__wrap(ret);\n }\n /**\n * Check whether a move given by source and destination indices is legal\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n can_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_can_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_man_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_man_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_king_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_king_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n jumpee_idx(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_jumpee_idx(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Get a pointer to the backing array of board squares, [`Board::cells`]\n * @returns {number}\n */\n cells() {\n var ret = wasm.board_cells(this.ptr);\n return ret;\n }\n /**\n * Get the number of board squares\n * @returns {number}\n */\n num_cells() {\n var ret = wasm.board_num_cells(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces\n * @returns {number}\n */\n num_pieces() {\n var ret = wasm.board_num_pieces(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces for a player\n * @param {number} team\n * @returns {number}\n */\n num_player(team) {\n var ret = wasm.board_num_player(this.ptr, team);\n return ret >>> 0;\n }\n /**\n * Get the score value, Black - White pieces\n * @returns {number}\n */\n score() {\n var ret = wasm.board_score(this.ptr);\n return ret;\n }\n /**\n * Get the state of a board square by 1D array index\n * @param {number} idx\n * @returns {number}\n */\n cell_state(idx) {\n var ret = wasm.board_cell_state(this.ptr, idx);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_move(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_jump(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * Unwrap the jumpee piece from the square and [`Board::check_jumpee_team`] with [`Moveable`] response\n * @param {Square} jumpee\n * @param {Piece} from_occ\n * @returns {number}\n */\n static validate_jumpee(jumpee, from_occ) {\n _assertClass(jumpee, Square);\n var ptr0 = jumpee.ptr;\n jumpee.ptr = 0;\n _assertClass(from_occ, Piece);\n var ptr1 = from_occ.ptr;\n from_occ.ptr = 0;\n var ret = wasm.board_validate_jumpee(ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Check that the source piece and the jumpee are of opposing teams\n * @param {Piece} from\n * @param {Piece} jumpee\n * @returns {boolean}\n */\n static check_jumpee_team(from, jumpee) {\n _assertClass(from, Piece);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(jumpee, Piece);\n var ptr1 = jumpee.ptr;\n jumpee.ptr = 0;\n var ret = wasm.board_check_jumpee_team(ptr0, ptr1);\n return ret !== 0;\n }\n /**\n * Initialise a game board without game pieces\n * @param {number} width\n * @param {number} height\n * @param {number} current_turn\n */\n constructor(width, height, current_turn) {\n var ret = wasm.board_new(width, height, current_turn);\n return Board.__wrap(ret);\n }\n /**\n * Reset the given board to a starting layout with 3 rows of opposing pieces\n * @param {Board} board\n * @param {number} piece_rows\n * @returns {Board}\n */\n static init_game(board, piece_rows) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n var ret = wasm.board_init_game(ptr0, piece_rows);\n return Board.__wrap(ret);\n }\n}\n/**\n* Rank 2 tensor index to identify a board square by row and column\n*/\nexport class BrdIdx {\n\n static __wrap(ptr) {\n const obj = Object.create(BrdIdx.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_brdidx_free(ptr);\n }\n /**\n * @returns {number}\n */\n get row() {\n var ret = wasm.__wbg_get_brdidx_row(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set row(arg0) {\n wasm.__wbg_set_brdidx_row(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get col() {\n var ret = wasm.__wbg_get_brdidx_col(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set col(arg0) {\n wasm.__wbg_set_brdidx_col(this.ptr, arg0);\n }\n /**\n * @param {number} row\n * @param {number} col\n */\n constructor(row, col) {\n var ret = wasm.brdidx_from(row, col);\n return BrdIdx.__wrap(ret);\n }\n}\n/**\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 * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_cells() {\n var ret = wasm.game_current_board_cells(this.ptr);\n return ret;\n }\n /**\n * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_len() {\n var ret = wasm.game_current_board_len(this.ptr);\n return ret >>> 0;\n }\n /**\n * Current turn's team\n * @returns {number}\n */\n current_turn() {\n var ret = wasm.game_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * Attempt to make a move given a source and destination index\n * @param {BrdIdx} from\n * @param {BrdIdx} to\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 wasm.game_make_move(this.ptr, ptr0, ptr1);\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 * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\n */\n constructor(width, height, piece_rows, first_turn) {\n var ret = wasm.game_new(width, height, piece_rows, first_turn);\n return Game.__wrap(ret);\n }\n /**\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\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, canvas_id, canvas_width, canvas_height) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.game_new_with_canvas(width, height, piece_rows, first_turn, ptr0, len0, canvas_width, canvas_height);\n return Game.__wrap(ret);\n }\n /**\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 */\n draw() {\n wasm.game_draw(this.ptr);\n }\n}\n/**\n* Used to paint boards onto HTML canvases\n*/\nexport class Painter {\n\n static __wrap(ptr) {\n const obj = Object.create(Painter.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_painter_free(ptr);\n }\n /**\n * Default constructor which queries for canvas by ID\n * @param {number} width\n * @param {number} height\n * @param {string} canvas_id\n */\n constructor(width, height, canvas_id) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.painter_new(width, height, ptr0, len0);\n return Painter.__wrap(ret);\n }\n /**\n * Constructor with given canvas element\n * @param {number} width\n * @param {number} height\n * @param {HTMLCanvasElement} canvas\n * @returns {Painter}\n */\n static new_with_canvas(width, height, canvas) {\n var ret = wasm.painter_new_with_canvas(width, height, addHeapObject(canvas));\n return Painter.__wrap(ret);\n }\n /**\n * Set new square outline colour value\n * @param {any} value\n */\n set_square_outline(value) {\n wasm.painter_set_square_outline(this.ptr, addHeapObject(value));\n }\n /**\n * Set new line width for outlining squares\n * @param {number} value\n */\n set_outline_width(value) {\n wasm.painter_set_outline_width(this.ptr, value);\n }\n /**\n * Set whether squares are outlined\n * @param {boolean} value\n */\n set_draw_outline(value) {\n wasm.painter_set_draw_outline(this.ptr, value);\n }\n /**\n * Reset the canvas dimensions to the given width and height\n */\n reset_dimensions() {\n wasm.painter_reset_dimensions(this.ptr);\n }\n /**\n * Check whether given canvas dimensions divide evenly by given board dimenions\n * @param {Board} board\n * @returns {boolean}\n */\n validate_board_dim(board) {\n _assertClass(board, Board);\n var ret = wasm.painter_validate_board_dim(this.ptr, board.ptr);\n return ret !== 0;\n }\n /**\n * Draw a board onto the canvas\n * @param {Board} board\n */\n draw(board) {\n _assertClass(board, Board);\n wasm.painter_draw(this.ptr, board.ptr);\n }\n}\n/**\n* Game piece given by its team and strength (normal or kinged)\n*/\nexport class Piece {\n\n static __wrap(ptr) {\n const obj = Object.create(Piece.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_piece_free(ptr);\n }\n /**\n * @returns {number}\n */\n get team() {\n var ret = wasm.__wbg_get_piece_team(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set team(arg0) {\n wasm.__wbg_set_piece_team(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get strength() {\n var ret = wasm.__wbg_get_piece_strength(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set strength(arg0) {\n wasm.__wbg_set_piece_strength(this.ptr, arg0);\n }\n /**\n * @param {number} team\n * @param {number} strength\n */\n constructor(team, strength) {\n var ret = wasm.piece_new(team, strength);\n return Piece.__wrap(ret);\n }\n}\n/**\n*/\nexport class Player {\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_player_free(ptr);\n }\n}\n/**\n* Board squares given by a state and a possible occupying game piece\n*/\nexport class Square {\n\n static __wrap(ptr) {\n const obj = Object.create(Square.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_square_free(ptr);\n }\n /**\n * Game piece if square is occupied\n * @returns {Piece | undefined}\n */\n get occupant() {\n var ret = wasm.__wbg_get_square_occupant(this.ptr);\n return ret === 0 ? undefined : Piece.__wrap(ret);\n }\n /**\n * Game piece if square is occupied\n * @param {Piece | undefined} arg0\n */\n set occupant(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Piece);\n ptr0 = arg0.ptr;\n arg0.ptr = 0;\n }\n wasm.__wbg_set_square_occupant(this.ptr, ptr0);\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @returns {number}\n */\n get state() {\n var ret = wasm.__wbg_get_square_state(this.ptr);\n return ret >>> 0;\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @param {number} arg0\n */\n set state(arg0) {\n wasm.__wbg_set_square_state(this.ptr, arg0);\n }\n /**\n * Standard constructor function to form square from state and occupant\n * @param {number} state\n * @param {Piece | undefined} occupant\n */\n constructor(state, occupant) {\n let ptr0 = 0;\n if (!isLikeNone(occupant)) {\n _assertClass(occupant, Piece);\n ptr0 = occupant.ptr;\n occupant.ptr = 0;\n }\n var ret = wasm.square_new(state, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed piece square by team and strength\n * @param {number} team\n * @param {number} strength\n * @returns {Square}\n */\n static pc(team, strength) {\n var ret = wasm.square_pc(team, strength);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed empty square\n * @returns {Square}\n */\n static empty() {\n var ret = wasm.square_empty();\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed unplayable square\n * @returns {Square}\n */\n static unplay() {\n var ret = wasm.square_unplay();\n return Square.__wrap(ret);\n }\n}\n\nexport function __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nexport function __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nexport function __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(arg0, arg1);\n }\n};\n\nexport function __wbg_instanceof_Window_11e25482011fc506(arg0) {\n var ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nexport function __wbg_document_5aff8cd83ef968f5(arg0) {\n var ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_getElementById_b180ea4ada06a837(arg0, arg1, arg2) {\n var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nexport function __wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b(arg0) {\n var ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n return ret;\n};\n\nexport function __wbg_setstrokeStyle_2939ee453716e462(arg0, arg1) {\n getObject(arg0).strokeStyle = getObject(arg1);\n};\n\nexport function __wbg_setfillStyle_af790b5baf4d3210(arg0, arg1) {\n getObject(arg0).fillStyle = getObject(arg1);\n};\n\nexport function __wbg_setlineWidth_3e6b1837ae38d099(arg0, arg1) {\n getObject(arg0).lineWidth = arg1;\n};\n\nexport function __wbg_beginPath_2378575e37027ad3(arg0) {\n getObject(arg0).beginPath();\n};\n\nexport function __wbg_fill_558339447ed6ad43(arg0) {\n getObject(arg0).fill();\n};\n\nexport function __wbg_stroke_c1e0313c58997dcf(arg0) {\n getObject(arg0).stroke();\n};\n\nexport function __wbg_arc_fffd87d9113dce32() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {\n getObject(arg0).arc(arg1, arg2, arg3, arg4, arg5);\n}, arguments) };\n\nexport function __wbg_fillRect_46ffc8d2cef7e298(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).fillRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_strokeRect_7ea34fad8a7f0fe2(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792(arg0) {\n var ret = getObject(arg0) instanceof HTMLCanvasElement;\n return ret;\n};\n\nexport function __wbg_setwidth_f3c88eb520ba8d47(arg0, arg1) {\n getObject(arg0).width = arg1 >>> 0;\n};\n\nexport function __wbg_setheight_5a1abba41e35c42a(arg0, arg1) {\n getObject(arg0).height = arg1 >>> 0;\n};\n\nexport function __wbg_getContext_813df131fcbd6e91() { return handleError(function (arg0, arg1, arg2) {\n var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_newnoargs_9fdd8f3961dd1bee(arg0, arg1) {\n var ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nexport function __wbg_call_ba36642bd901572b() { return handleError(function (arg0, arg1) {\n var ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_self_bb69a836a72ec6e9() { return handleError(function () {\n var ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_window_3304fc4b414c9693() { return handleError(function () {\n var ret = window.window;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_globalThis_e0d21cabc6630763() { return handleError(function () {\n var ret = globalThis.globalThis;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_global_8463719227271676() { return handleError(function () {\n var ret = global.global;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbindgen_is_undefined(arg0) {\n var ret = getObject(arg0) === undefined;\n return ret;\n};\n\nexport function __wbindgen_object_clone_ref(arg0) {\n var ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n var ret = debugString(getObject(arg1));\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n","import { Game, Board, BrdIdx, Painter, Team, init_wasm } from \"draught\";\nimport { memory } from \"draught/draught_bg.wasm\";\n\n///////////////////\n// CONSTS\n///////////////////\n\nconst CANVAS_WIDTH = 480;\nconst CANVAS_HEIGHT = 480;\n\nconst BOARD_WIDTH = 8;\nconst BOARD_HEIGHT = 8;\n\nconst PIECE_ROWS = 3;\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\nlet current_state = GameState.HUMAN_TURN.THINKING;\nlet painter = new Painter(CANVAS_WIDTH, CANVAS_HEIGHT, \"game-canvas\");\n// painter.draw(board);\n\nlet from = null;\nlet to = null;\n\nlet game = new Game(BOARD_WIDTH, BOARD_HEIGHT, PIECE_ROWS, Team.Black);\ngame.set_painter(painter);\ngame.draw();\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_HEIGHT) * BOARD_HEIGHT),\n Math.floor((mousepos.x / CANVAS_WIDTH) * 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);\n game.set_painter(painter);\n game.draw();\n\n current_state = GameState.HUMAN_TURN.THINKING;\n}\n\nfunction process_canvas_click(cell_coord) {\n switch(current_state) {\n case GameState.HUMAN_TURN.THINKING:\n console.log(\"Your turn, first piece picked\");\n\n from = cell_coord;\n current_state = GameState.HUMAN_TURN.FROM_SELECTED; \n \n break;\n case GameState.HUMAN_TURN.FROM_SELECTED:\n console.log(\"Your turn, first piece already picked, picking second\");\n\n to = cell_coord;\n game.make_move(from, to);\n game.draw();\n\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\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\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://draught/../pkg/draught_bg.js","webpack://draught/./index.js"],"names":["heap","Array","fill","undefined","getObject","idx","push","heap_next","length","cachedTextDecoder","TextDecoder","module","require","ignoreBOM","fatal","decode","cachegetUint8Memory0","getUint8Memory0","buffer","Uint8Array","getStringFromWasm0","ptr","len","subarray","addHeapObject","obj","debugString","val","type","description","name","isArray","debug","i","builtInMatches","exec","toString","call","className","JSON","stringify","_","Error","message","stack","WASM_VECTOR_LEN","cachedTextEncoder","TextEncoder","encodeString","encodeInto","arg","view","buf","encode","set","read","written","passStringToWasm0","malloc","realloc","mem","offset","code","charCodeAt","slice","cachegetInt32Memory0","getInt32Memory0","Int32Array","isLikeNone","x","_assertClass","instance","klass","init_wasm","handleError","f","args","apply","this","e","Object","freeze","Move","Jump","Team","Black","White","Moveable","Man","King","Empty","Occupied","Unplayable","Allowed","UnoccupiedSrc","OccupiedDest","OutOfBounds","WrongTeamSrc","IllegalTrajectory","NoJumpablePiece","JumpingSameTeam","Board","create","prototype","__destroy_into_raw","arg0","ret","Square","__wrap","square","ptr0","BrdIdx","row","col","from","to","ptr1","from_square_occupant","Piece","ptr2","team","jumpee","from_occ","width","height","current_turn","board","piece_rows","Game","first_turn","canvas_id","canvas_width","canvas_height","len0","value","Painter","canvas","strength","state","occupant","__wbindgen_object_drop_ref","dropObject","takeObject","__wbindgen_string_new","arg1","__wbg_new_59cb74e423758ede","__wbg_stack_558ba5917b466edd","__wbg_error_4bb6c2a97407129a","console","error","__wbg_instanceof_Window_11e25482011fc506","Window","__wbg_document_5aff8cd83ef968f5","document","__wbg_getElementById_b180ea4ada06a837","arg2","getElementById","__wbg_log_9a99fb1af846153b","log","__wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b","CanvasRenderingContext2D","__wbg_setstrokeStyle_2939ee453716e462","strokeStyle","__wbg_setfillStyle_af790b5baf4d3210","fillStyle","__wbg_setlineWidth_3e6b1837ae38d099","lineWidth","__wbg_beginPath_2378575e37027ad3","beginPath","__wbg_fill_558339447ed6ad43","__wbg_stroke_c1e0313c58997dcf","stroke","__wbg_arc_fffd87d9113dce32","arg3","arg4","arg5","arc","arguments","__wbg_fillRect_46ffc8d2cef7e298","fillRect","__wbg_strokeRect_7ea34fad8a7f0fe2","strokeRect","__wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792","HTMLCanvasElement","__wbg_setwidth_f3c88eb520ba8d47","__wbg_setheight_5a1abba41e35c42a","__wbg_getContext_813df131fcbd6e91","getContext","__wbg_newnoargs_9fdd8f3961dd1bee","Function","__wbg_call_ba36642bd901572b","__wbg_self_bb69a836a72ec6e9","self","__wbg_window_3304fc4b414c9693","window","__wbg_globalThis_e0d21cabc6630763","globalThis","__wbg_global_8463719227271676","g","global","__wbindgen_is_undefined","__wbindgen_object_clone_ref","__wbindgen_debug_string","__wbindgen_throw","GameState","statusText","current_state","painter","game","set_painter","draw","addEventListener","event","mousepos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","getMousePos","cell_coord","hidden","innerText","status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EL,KAAK,oBAOjBlB,EAAKE,OACLhG,EAAO,KACPC,EAAK,KACL2F,EAAgBF,EAEhB,MACJ,IAzGK,UA0GDxD,QAAQU,IAAI,wBArEpBsE,CALW,IAAI,KACXC,KAAKC,MAAOjB,EAASM,EA7CP,IAGD,GA2CbU,KAAKC,MAAOjB,EAAShJ,EA/CR,IAGD","file":"10.bootstrap.js","sourcesContent":["import * as wasm from './draught_bg.wasm';\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n return instance.ptr;\n}\n/**\n*/\nexport function init_wasm() {\n wasm.init_wasm();\n}\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_exn_store(addHeapObject(e));\n }\n}\n/**\n*/\nexport const MoveType = Object.freeze({ Move:0,\"0\":\"Move\",Jump:1,\"1\":\"Jump\", });\n/**\n*/\nexport const Team = Object.freeze({ Black:0,\"0\":\"Black\",White:1,\"1\":\"White\", });\n/**\n*/\nexport const Strength = Object.freeze({ Man:0,\"0\":\"Man\",King:1,\"1\":\"King\", });\n/**\n*/\nexport const SquareState = Object.freeze({ Empty:0,\"0\":\"Empty\",Occupied:1,\"1\":\"Occupied\",Unplayable:2,\"2\":\"Unplayable\", });\n/**\n*/\nexport const Moveable = Object.freeze({ Allowed:0,\"0\":\"Allowed\",UnoccupiedSrc:1,\"1\":\"UnoccupiedSrc\",OccupiedDest:2,\"2\":\"OccupiedDest\",OutOfBounds:3,\"3\":\"OutOfBounds\",Unplayable:4,\"4\":\"Unplayable\",WrongTeamSrc:5,\"5\":\"WrongTeamSrc\",IllegalTrajectory:6,\"6\":\"IllegalTrajectory\",NoJumpablePiece:7,\"7\":\"NoJumpablePiece\",JumpingSameTeam:8,\"8\":\"JumpingSameTeam\", });\n/**\n* Single state of a checkers board\n*/\nexport class Board {\n\n static __wrap(ptr) {\n const obj = Object.create(Board.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_board_free(ptr);\n }\n /**\n * @returns {number}\n */\n get width() {\n var ret = wasm.__wbg_get_board_width(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set width(arg0) {\n wasm.__wbg_set_board_width(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get height() {\n var ret = wasm.__wbg_get_board_height(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set height(arg0) {\n wasm.__wbg_set_board_height(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get current_turn() {\n var ret = wasm.__wbg_get_board_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set current_turn(arg0) {\n wasm.__wbg_set_board_current_turn(this.ptr, arg0);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @returns {Square}\n */\n cell(idx) {\n var ret = wasm.board_cell(this.ptr, idx);\n return Square.__wrap(ret);\n }\n /**\n * Get a copy of a board square by 1D array index\n * @param {number} idx\n * @param {Square} square\n */\n set_cell(idx, square) {\n _assertClass(square, Square);\n var ptr0 = square.ptr;\n square.ptr = 0;\n wasm.board_set_cell(this.ptr, idx, ptr0);\n }\n /**\n * Get a copy of a board square by 2D [`BrdIdx`] index\n * @param {BrdIdx} idx\n * @returns {Square}\n */\n grid_cell(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_grid_cell(this.ptr, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {number} row\n * @param {number} col\n * @returns {number}\n */\n cell_index(row, col) {\n var ret = wasm.board_cell_index(this.ptr, row, col);\n return ret >>> 0;\n }\n /**\n * Similar to [`Board::cell_index`] but with a [`BrdIdx`] instead of separate indices. Transform a 2D row/column board index into a single 1D index for use with [`Board::cells`]\n * @param {BrdIdx} idx\n * @returns {number}\n */\n cell_idx(idx) {\n _assertClass(idx, BrdIdx);\n var ptr0 = idx.ptr;\n idx.ptr = 0;\n var ret = wasm.board_cell_idx(this.ptr, ptr0);\n return ret >>> 0;\n }\n /**\n * Transform a 1D array index (for [`Board::cells`]) into a 2D game board index (by row/col)\n * @param {number} idx\n * @returns {BrdIdx}\n */\n board_index(idx) {\n var ret = wasm.board_board_index(this.ptr, idx);\n return BrdIdx.__wrap(ret);\n }\n /**\n * Check whether a move given by source and destination indices is legal\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n can_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_can_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_man_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_man_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @param {Piece} from_square_occupant\n * @returns {number}\n */\n validate_king_move(from, to, from_square_occupant) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n _assertClass(from_square_occupant, Piece);\n var ptr2 = from_square_occupant.ptr;\n from_square_occupant.ptr = 0;\n var ret = wasm.board_validate_king_move(this.ptr, ptr0, ptr1, ptr2);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n jumpee_idx(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_jumpee_idx(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Get a pointer to the backing array of board squares, [`Board::cells`]\n * @returns {number}\n */\n cells() {\n var ret = wasm.board_cells(this.ptr);\n return ret;\n }\n /**\n * Get the number of board squares\n * @returns {number}\n */\n num_cells() {\n var ret = wasm.board_num_cells(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces\n * @returns {number}\n */\n num_pieces() {\n var ret = wasm.board_num_pieces(this.ptr);\n return ret >>> 0;\n }\n /**\n * Get the number of remaining pieces for a player\n * @param {number} team\n * @returns {number}\n */\n num_player(team) {\n var ret = wasm.board_num_player(this.ptr, team);\n return ret >>> 0;\n }\n /**\n * Get the score value, Black - White pieces\n * @returns {number}\n */\n score() {\n var ret = wasm.board_score(this.ptr);\n return ret;\n }\n /**\n * Get the state of a board square by 1D array index\n * @param {number} idx\n * @returns {number}\n */\n cell_state(idx) {\n var ret = wasm.board_cell_state(this.ptr, idx);\n return ret >>> 0;\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_move(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {Board}\n */\n apply_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.board_apply_jump(this.ptr, ptr0, ptr1);\n return Board.__wrap(ret);\n }\n /**\n * Unwrap the jumpee piece from the square and [`Board::check_jumpee_team`] with [`Moveable`] response\n * @param {Square} jumpee\n * @param {Piece} from_occ\n * @returns {number}\n */\n static validate_jumpee(jumpee, from_occ) {\n _assertClass(jumpee, Square);\n var ptr0 = jumpee.ptr;\n jumpee.ptr = 0;\n _assertClass(from_occ, Piece);\n var ptr1 = from_occ.ptr;\n from_occ.ptr = 0;\n var ret = wasm.board_validate_jumpee(ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Check that the source piece and the jumpee are of opposing teams\n * @param {Piece} from\n * @param {Piece} jumpee\n * @returns {boolean}\n */\n static check_jumpee_team(from, jumpee) {\n _assertClass(from, Piece);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(jumpee, Piece);\n var ptr1 = jumpee.ptr;\n jumpee.ptr = 0;\n var ret = wasm.board_check_jumpee_team(ptr0, ptr1);\n return ret !== 0;\n }\n /**\n * Initialise a game board without game pieces\n * @param {number} width\n * @param {number} height\n * @param {number} current_turn\n */\n constructor(width, height, current_turn) {\n var ret = wasm.board_new(width, height, current_turn);\n return Board.__wrap(ret);\n }\n /**\n * Reset the given board to a starting layout with 3 rows of opposing pieces\n * @param {Board} board\n * @param {number} piece_rows\n * @returns {Board}\n */\n static init_game(board, piece_rows) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n var ret = wasm.board_init_game(ptr0, piece_rows);\n return Board.__wrap(ret);\n }\n}\n/**\n* Rank 2 tensor index to identify a board square by row and column\n*/\nexport class BrdIdx {\n\n static __wrap(ptr) {\n const obj = Object.create(BrdIdx.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_brdidx_free(ptr);\n }\n /**\n * @returns {number}\n */\n get row() {\n var ret = wasm.__wbg_get_brdidx_row(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set row(arg0) {\n wasm.__wbg_set_brdidx_row(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get col() {\n var ret = wasm.__wbg_get_brdidx_col(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set col(arg0) {\n wasm.__wbg_set_brdidx_col(this.ptr, arg0);\n }\n /**\n * @param {number} row\n * @param {number} col\n */\n constructor(row, col) {\n var ret = wasm.brdidx_from(row, col);\n return BrdIdx.__wrap(ret);\n }\n}\n/**\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 * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_cells() {\n var ret = wasm.game_current_board_cells(this.ptr);\n return ret;\n }\n /**\n * Get pointer to current board's squares\n * @returns {number}\n */\n current_board_len() {\n var ret = wasm.game_current_board_len(this.ptr);\n return ret >>> 0;\n }\n /**\n * Current turn's team\n * @returns {number}\n */\n current_turn() {\n var ret = wasm.game_current_turn(this.ptr);\n return ret >>> 0;\n }\n /**\n * Attempt to make a move given a source and destination index\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n * @returns {number}\n */\n make_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n var ret = wasm.game_make_move(this.ptr, ptr0, ptr1);\n return ret >>> 0;\n }\n /**\n * Update board state with given move and push new board into current state\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n */\n execute_move(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n wasm.game_execute_move(this.ptr, ptr0, ptr1);\n }\n /**\n * Update board state with given jump move and push new board into current state\n * @param {BrdIdx} from\n * @param {BrdIdx} to\n */\n execute_jump(from, to) {\n _assertClass(from, BrdIdx);\n var ptr0 = from.ptr;\n from.ptr = 0;\n _assertClass(to, BrdIdx);\n var ptr1 = to.ptr;\n to.ptr = 0;\n wasm.game_execute_jump(this.ptr, ptr0, ptr1);\n }\n /**\n * Push current board into the previous turns and set given board to current\n * @param {Board} board\n */\n push_new_board(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n wasm.game_push_new_board(this.ptr, ptr0);\n }\n /**\n * Set current board to given\n * @param {Board} board\n */\n set_current(board) {\n _assertClass(board, Board);\n var ptr0 = board.ptr;\n board.ptr = 0;\n wasm.game_set_current(this.ptr, ptr0);\n }\n /**\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\n */\n constructor(width, height, piece_rows, first_turn) {\n var ret = wasm.game_new(width, height, piece_rows, first_turn);\n return Game.__wrap(ret);\n }\n /**\n * @param {number} width\n * @param {number} height\n * @param {number} piece_rows\n * @param {number} first_turn\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, canvas_id, canvas_width, canvas_height) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.game_new_with_canvas(width, height, piece_rows, first_turn, ptr0, len0, canvas_width, canvas_height);\n return Game.__wrap(ret);\n }\n /**\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 */\n draw() {\n wasm.game_draw(this.ptr);\n }\n}\n/**\n* Used to paint boards onto HTML canvases\n*/\nexport class Painter {\n\n static __wrap(ptr) {\n const obj = Object.create(Painter.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_painter_free(ptr);\n }\n /**\n * Default constructor which queries for canvas by ID\n * @param {number} width\n * @param {number} height\n * @param {string} canvas_id\n */\n constructor(width, height, canvas_id) {\n var ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ret = wasm.painter_new(width, height, ptr0, len0);\n return Painter.__wrap(ret);\n }\n /**\n * Constructor with given canvas element\n * @param {number} width\n * @param {number} height\n * @param {HTMLCanvasElement} canvas\n * @returns {Painter}\n */\n static new_with_canvas(width, height, canvas) {\n var ret = wasm.painter_new_with_canvas(width, height, addHeapObject(canvas));\n return Painter.__wrap(ret);\n }\n /**\n * Set new square outline colour value\n * @param {any} value\n */\n set_square_outline(value) {\n wasm.painter_set_square_outline(this.ptr, addHeapObject(value));\n }\n /**\n * Set new line width for outlining squares\n * @param {number} value\n */\n set_outline_width(value) {\n wasm.painter_set_outline_width(this.ptr, value);\n }\n /**\n * Set whether squares are outlined\n * @param {boolean} value\n */\n set_draw_outline(value) {\n wasm.painter_set_draw_outline(this.ptr, value);\n }\n /**\n * Reset the canvas dimensions to the given width and height\n */\n reset_dimensions() {\n wasm.painter_reset_dimensions(this.ptr);\n }\n /**\n * Check whether given canvas dimensions divide evenly by given board dimenions\n * @param {Board} board\n * @returns {boolean}\n */\n validate_board_dim(board) {\n _assertClass(board, Board);\n var ret = wasm.painter_validate_board_dim(this.ptr, board.ptr);\n return ret !== 0;\n }\n /**\n * Draw a board onto the canvas\n * @param {Board} board\n */\n draw(board) {\n _assertClass(board, Board);\n wasm.painter_draw(this.ptr, board.ptr);\n }\n}\n/**\n* Game piece given by its team and strength (normal or kinged)\n*/\nexport class Piece {\n\n static __wrap(ptr) {\n const obj = Object.create(Piece.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_piece_free(ptr);\n }\n /**\n * @returns {number}\n */\n get team() {\n var ret = wasm.__wbg_get_piece_team(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set team(arg0) {\n wasm.__wbg_set_piece_team(this.ptr, arg0);\n }\n /**\n * @returns {number}\n */\n get strength() {\n var ret = wasm.__wbg_get_piece_strength(this.ptr);\n return ret >>> 0;\n }\n /**\n * @param {number} arg0\n */\n set strength(arg0) {\n wasm.__wbg_set_piece_strength(this.ptr, arg0);\n }\n /**\n * @param {number} team\n * @param {number} strength\n */\n constructor(team, strength) {\n var ret = wasm.piece_new(team, strength);\n return Piece.__wrap(ret);\n }\n}\n/**\n*/\nexport class Player {\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_player_free(ptr);\n }\n}\n/**\n* Board squares given by a state and a possible occupying game piece\n*/\nexport class Square {\n\n static __wrap(ptr) {\n const obj = Object.create(Square.prototype);\n obj.ptr = ptr;\n\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.ptr;\n this.ptr = 0;\n\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_square_free(ptr);\n }\n /**\n * Game piece if square is occupied\n * @returns {Piece | undefined}\n */\n get occupant() {\n var ret = wasm.__wbg_get_square_occupant(this.ptr);\n return ret === 0 ? undefined : Piece.__wrap(ret);\n }\n /**\n * Game piece if square is occupied\n * @param {Piece | undefined} arg0\n */\n set occupant(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Piece);\n ptr0 = arg0.ptr;\n arg0.ptr = 0;\n }\n wasm.__wbg_set_square_occupant(this.ptr, ptr0);\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @returns {number}\n */\n get state() {\n var ret = wasm.__wbg_get_square_state(this.ptr);\n return ret >>> 0;\n }\n /**\n * Description of whether the square is occupied or an unplayable, i.e. off-lattice square\n * @param {number} arg0\n */\n set state(arg0) {\n wasm.__wbg_set_square_state(this.ptr, arg0);\n }\n /**\n * Standard constructor function to form square from state and occupant\n * @param {number} state\n * @param {Piece | undefined} occupant\n */\n constructor(state, occupant) {\n let ptr0 = 0;\n if (!isLikeNone(occupant)) {\n _assertClass(occupant, Piece);\n ptr0 = occupant.ptr;\n occupant.ptr = 0;\n }\n var ret = wasm.square_new(state, ptr0);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed piece square by team and strength\n * @param {number} team\n * @param {number} strength\n * @returns {Square}\n */\n static pc(team, strength) {\n var ret = wasm.square_pc(team, strength);\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed empty square\n * @returns {Square}\n */\n static empty() {\n var ret = wasm.square_empty();\n return Square.__wrap(ret);\n }\n /**\n * Helper function for a well-formed unplayable square\n * @returns {Square}\n */\n static unplay() {\n var ret = wasm.square_unplay();\n return Square.__wrap(ret);\n }\n}\n\nexport function __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nexport function __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nexport function __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nexport function __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(arg0, arg1);\n }\n};\n\nexport function __wbg_instanceof_Window_11e25482011fc506(arg0) {\n var ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nexport function __wbg_document_5aff8cd83ef968f5(arg0) {\n var ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_getElementById_b180ea4ada06a837(arg0, arg1, arg2) {\n var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nexport function __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nexport function __wbg_instanceof_CanvasRenderingContext2d_779e79c4121aa91b(arg0) {\n var ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n return ret;\n};\n\nexport function __wbg_setstrokeStyle_2939ee453716e462(arg0, arg1) {\n getObject(arg0).strokeStyle = getObject(arg1);\n};\n\nexport function __wbg_setfillStyle_af790b5baf4d3210(arg0, arg1) {\n getObject(arg0).fillStyle = getObject(arg1);\n};\n\nexport function __wbg_setlineWidth_3e6b1837ae38d099(arg0, arg1) {\n getObject(arg0).lineWidth = arg1;\n};\n\nexport function __wbg_beginPath_2378575e37027ad3(arg0) {\n getObject(arg0).beginPath();\n};\n\nexport function __wbg_fill_558339447ed6ad43(arg0) {\n getObject(arg0).fill();\n};\n\nexport function __wbg_stroke_c1e0313c58997dcf(arg0) {\n getObject(arg0).stroke();\n};\n\nexport function __wbg_arc_fffd87d9113dce32() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {\n getObject(arg0).arc(arg1, arg2, arg3, arg4, arg5);\n}, arguments) };\n\nexport function __wbg_fillRect_46ffc8d2cef7e298(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).fillRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_strokeRect_7ea34fad8a7f0fe2(arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);\n};\n\nexport function __wbg_instanceof_HtmlCanvasElement_fd3cbbe3906d7792(arg0) {\n var ret = getObject(arg0) instanceof HTMLCanvasElement;\n return ret;\n};\n\nexport function __wbg_setwidth_f3c88eb520ba8d47(arg0, arg1) {\n getObject(arg0).width = arg1 >>> 0;\n};\n\nexport function __wbg_setheight_5a1abba41e35c42a(arg0, arg1) {\n getObject(arg0).height = arg1 >>> 0;\n};\n\nexport function __wbg_getContext_813df131fcbd6e91() { return handleError(function (arg0, arg1, arg2) {\n var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_newnoargs_9fdd8f3961dd1bee(arg0, arg1) {\n var ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nexport function __wbg_call_ba36642bd901572b() { return handleError(function (arg0, arg1) {\n var ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_self_bb69a836a72ec6e9() { return handleError(function () {\n var ret = self.self;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_window_3304fc4b414c9693() { return handleError(function () {\n var ret = window.window;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_globalThis_e0d21cabc6630763() { return handleError(function () {\n var ret = globalThis.globalThis;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbg_global_8463719227271676() { return handleError(function () {\n var ret = global.global;\n return addHeapObject(ret);\n}, arguments) };\n\nexport function __wbindgen_is_undefined(arg0) {\n var ret = getObject(arg0) === undefined;\n return ret;\n};\n\nexport function __wbindgen_object_clone_ref(arg0) {\n var ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n var ret = debugString(getObject(arg1));\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nexport function __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n","import { Game, Board, BrdIdx, Painter, Team, init_wasm, Moveable } from \"draught\";\nimport { memory } from \"draught/draught_bg.wasm\";\n\n///////////////////\n// CONSTS\n///////////////////\n\nconst CANVAS_WIDTH = 480;\nconst CANVAS_HEIGHT = 480;\n\nconst BOARD_WIDTH = 8;\nconst BOARD_HEIGHT = 8;\n\nconst PIECE_ROWS = 3;\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\");\n\nlet current_state = GameState.HUMAN_TURN.THINKING;\nlet painter = new Painter(CANVAS_WIDTH, CANVAS_HEIGHT, \"game-canvas\");\n// painter.draw(board);\n\nlet from = null;\nlet to = null;\n\nlet game = new Game(BOARD_WIDTH, BOARD_HEIGHT, PIECE_ROWS, Team.Black);\ngame.set_painter(painter);\ngame.draw();\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_HEIGHT) * BOARD_HEIGHT),\n Math.floor((mousepos.x / CANVAS_WIDTH) * 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);\n game.set_painter(painter);\n game.draw();\n\n current_state = GameState.HUMAN_TURN.THINKING;\n}\n\nfunction process_canvas_click(cell_coord) {\n switch(current_state) {\n case GameState.HUMAN_TURN.THINKING:\n console.log(\"Your turn, first piece picked\");\n\n from = cell_coord;\n current_state = GameState.HUMAN_TURN.FROM_SELECTED; \n \n break;\n case GameState.HUMAN_TURN.FROM_SELECTED:\n console.log(\"Your turn, first piece already picked, picking second\");\n\n to = cell_coord;\n\n if(from.col == to.col && from.row == to.row){\n setStatusText(\"Move Cancelled\");\n } else {\n\n let status = game.make_move(from, to);\n\n if (status == Moveable.Allowed) {\n // game.draw();\n } else {\n switch(status) {\n case Moveable.Allowed:\n break;\n case Moveable.IllegalTrajectory:\n break;\n case Moveable.JumpingSameTeam:\n break;\n case Moveable.NoJumpablePiece:\n break;\n case Moveable.OccupiedDest:\n break;\n case Moveable.OutOfBounds:\n break;\n case Moveable.UnoccupiedSrc:\n break;\n case Moveable.Unplayable:\n break;\n case Moveable.WrongTeamSrc:\n break;\n }\n }\n \n }\n\n game.draw();\n from = null;\n to = null;\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\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) {\n statusText.hidden = false;\n statusText.innerText = txt;\n}\n\n"],"sourceRoot":""} \ No newline at end of file diff --git a/79476c847cbd09d58343.module.wasm b/4ee49dc6adc51094e53f.module.wasm similarity index 87% rename from 79476c847cbd09d58343.module.wasm rename to 4ee49dc6adc51094e53f.module.wasm index b94463ec4931883a8b5aa9488b92583088769fa2..51822638591f569067003483c66c7fd4fa8f8fda 100644 GIT binary patch delta 410 zcmcb&js5*L_6=LvnR!`RC+}c)X5(OEW@Y2p%*YYT#JFs7JeMQm^34mm%2^l}Z}Qv9h;b@&@&U$;%v@c2HVX;zEM|<~EWagRfN}EV z%f~Lr#qlt5E3i6hWGS#IFe)%9Fe|VKq$x0fg#_XzA3QF`r^~>v2ogBJkfp+)u({`m z8`I`{$AwfG<0gN6(+(!3Hcx&l%ETDAdF6X8_Q|hbNls&9_6=LvnORwRChuT(W@BS!W#eGq%*YYT#JF^FJeMQmvds&*%2^m!Oc!it z6yB`Ee~eLKF{Aw?=8sIP8NV=XV*JDWklD{J7v=saS3W2FE)LSxO8F47v;qj*P`t3=9gajt3YvKRzy| z3RLy$O*@#B+C1m2C=+As=1uRl*f)oL4`E_1WMrCL@Kj>5!CRimYByvj%Y7G?j0c*> zV8+Ct!0afHrNY3^EwGfCfm>i1^X3&lg}E7*Oy9%8n9aCky9O(x03+k_?Urne-*|w+ z2EvTq5K4afY+*(n82dSxyjQ~%btF*oKb4} z#cIYtrg%fJj9hMFc4~ZXep#xORfa*5xn-h-L8@trS+a4OX>x+s^bIwP65DNR7@zY_ zH|YY~+t9^m%eZv-m1T@v#f7DbMXB+5spZQV*>h8KK}M}$draught::game - Rust

Module draught::game[][src]

Top-level object for managing Boards, applying and managing turns

+ Change settings

Module draught::game[][src]

Top-level object for managing Boards, applying and managing turns

Structs

Game

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

diff --git a/doc/draught/game/struct.Game.html b/doc/draught/game/struct.Game.html index d970558..236f687 100644 --- a/doc/draught/game/struct.Game.html +++ b/doc/draught/game/struct.Game.html @@ -9,16 +9,16 @@

Fields

current: Boardprevious_boards: Vec<Board>painter: Option<Painter>

Implementations

impl Game[src]

pub fn previous_board(&self, turn: usize) -> &Board[src]

Get a read-only copy of a previous turn’s board

pub fn current_board(&self) -> &Board[src]

Set current board to given

-

impl Game[src]

pub fn current_board_cells(&self) -> *const Square[src]

Get pointer to current board’s squares

+

impl Game[src]

pub fn current_board_cells(&self) -> *const Square[src]

Get pointer to current board’s squares

pub fn current_board_len(&self) -> usize[src]

Get pointer to current board’s squares

pub fn current_turn(&self) -> Team[src]

Current turn’s team

-

pub fn make_move(&mut self, from: BrdIdx, to: BrdIdx)[src]

Attempt to make a move given a source and destination index

-

pub fn execute_move(&mut self, from: BrdIdx, to: BrdIdx)[src]

Update board state with given move and push new board into current state

-

pub fn execute_jump(&mut self, from: BrdIdx, to: BrdIdx)[src]

Update board state with given jump move and push new board into current state

-

pub fn push_new_board(&mut self, board: Board)[src]

Push current board into the previous turns and set given board to current

-

pub fn set_current(&mut self, board: Board)[src]

Set current board to given

-

pub fn new(
    width: usize,
    height: usize,
    piece_rows: usize,
    first_turn: Team
) -> Game
[src]

pub fn new_with_canvas(
    width: usize,
    height: usize,
    piece_rows: usize,
    first_turn: Team,
    canvas_id: &str,
    canvas_width: u32,
    canvas_height: u32
) -> Game
[src]

pub fn set_painter(&mut self, value: Painter)[src]

pub fn draw(&self)[src]

Trait Implementations

impl Debug for Game[src]

impl Display for Game[src]

pub fn make_move(&mut self, from: BrdIdx, to: BrdIdx) -> Moveable[src]

Attempt to make a move given a source and destination index

+

pub fn execute_move(&mut self, from: BrdIdx, to: BrdIdx)[src]

Update board state with given move and push new board into current state

+

pub fn execute_jump(&mut self, from: BrdIdx, to: BrdIdx)[src]

Update board state with given jump move and push new board into current state

+

pub fn push_new_board(&mut self, board: Board)[src]

Push current board into the previous turns and set given board to current

+

pub fn set_current(&mut self, board: Board)[src]

Set current board to given

+

pub fn new(
    width: usize,
    height: usize,
    piece_rows: usize,
    first_turn: Team
) -> Game
[src]

pub fn new_with_canvas(
    width: usize,
    height: usize,
    piece_rows: usize,
    first_turn: Team,
    canvas_id: &str,
    canvas_width: u32,
    canvas_height: u32
) -> Game
[src]

pub fn set_painter(&mut self, value: Painter)[src]

pub fn draw(&self)[src]

Trait Implementations

impl Debug for Game[src]

impl Display for Game[src]

impl From<Game> for JsValue[src]

impl FromWasmAbi for Game[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

diff --git a/doc/search-index.js b/doc/search-index.js index d82e672..f20f492 100644 --- a/doc/search-index.js +++ b/doc/search-index.js @@ -1,4 +1,4 @@ var searchIndex = JSON.parse('{\ -"draught":{"doc":"Draught","t":[5,0,0,0,5,14,0,0,0,3,3,3,3,17,17,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,13,13,13,13,13,13,13,13,13,4,4,13,13,13,13,4,4,4,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,3,3,3,12,12,12,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,3,3,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,11,11,12,12,12,12,11,12,11,11,11,11,11,11,11,3,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,11,11,11,11,11,11,11,17,17,17,17,17,17,17,17,17,3,17,17,17,17,12,12,12,11,11,12,12,11,11,12,11,11,11,11,11,12,11,11,11,12,11,11,11,12,12,12,11,11,11,11,11,11,11,12,11,11,11,11,12,12,12,12,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,5],"n":["__wasm_bindgen_generated_init_wasm","board","comp","game","init_wasm","log","paint","player","utils","Board","BrdIdx","Direction","Piece","STD_HEIGHT","STD_WIDTH","Square","adjacent_dir","adjacent_indices","apply_jump","apply_move","board_index","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","can_move","cell","cell_idx","cell_index","cell_mut","cell_state","cells","cells","check_jumpee_team","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","col","current_turn","describe","describe","describe","describe","empty","empty","enums","eq","eq","eq","eq","eq","filter_indices","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from_abi","from_abi","from_abi","from_abi","grid_cell","height","idx_diffs","init_game","into","into","into","into","into","into_abi","into_abi","into_abi","into_abi","is_none","is_none","is_none","is_none","iter","jumpable_dir","jumpable_indices","jumpee_idx","ne","ne","ne","ne","ne","ne","new","new","new","none","none","none","none","num_cells","num_pieces","num_player","nw","occupant","pc","player_adjacent_indices","player_jumpable_indices","ref_from_abi","ref_from_abi","ref_from_abi","ref_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","return_abi","return_abi","return_abi","return_abi","row","score","se","set_cell","state","strength","sw","team","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","to_string","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","unplay","validate_jumpee","validate_king_move","validate_man_move","width","Allowed","Black","Empty","IllegalTrajectory","Jump","JumpingSameTeam","King","Man","Move","MoveType","Moveable","NoJumpablePiece","Occupied","OccupiedDest","OutOfBounds","SquareState","Strength","Team","UnoccupiedSrc","Unplayable","Unplayable","White","WrongTeamSrc","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","describe","describe","describe","describe","describe","eq","eq","eq","eq","eq","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_abi","from_abi","from_abi","from_abi","from_abi","into","into","into","into","into","into_abi","into_abi","into_abi","into_abi","into_abi","is_none","is_none","is_none","is_none","is_none","none","none","none","none","none","opponent","return_abi","return_abi","return_abi","return_abi","return_abi","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","to_string","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","PieceIterator","RowIndexIterator","RowSquareIterator","board","board","board","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","from","from","from","index_cursor","index_iter","into","into","into","into_iter","into_iter","into_iter","new","new","new","next","next","next","row_cursor","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","Computer","Move","available_turns","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","eq","fmt","fmt","from","from","from","get_move","get_move_boards","insert_boards","into","into","mv_type","ne","new","new","root_node_id","search_depth","team","to","to_owned","tree","try_from","try_from","try_into","try_into","type_id","type_id","update_board","Game","borrow","borrow_mut","current","current_board","current_board_cells","current_board_len","current_turn","describe","draw","execute_jump","execute_move","fmt","fmt","from","from_abi","into","into_abi","is_none","make_move","new","new_with_canvas","none","painter","previous_board","previous_boards","push_new_board","ref_from_abi","ref_mut_from_abi","return_abi","set_current","set_painter","to_string","try_from","try_into","type_id","BLACK_PIECE","BLACK_PIECE_OUTLINE","BLACK_SQUARE","DRAW_OUTLINE","DRAW_PIECE_OUTLINES","KING_OUTLINE","OUTLINE_WIDTH","PIECE_MARGIN","PIECE_OUTLINE_WIDTH","Painter","SQUARE_OUTLINE","WHITE_PIECE","WHITE_PIECE_OUTLINE","WHITE_SQUARE","black_piece","black_piece_line","black_square","borrow","borrow_mut","canvas","context","describe","draw","draw_outline","fmt","from","from_abi","get_canvas","get_canvas_context","height","into","into_abi","is_none","king_line","new","new_with_canvas","none","outline_width","piece_line_width","piece_lines","ref_from_abi","ref_mut_from_abi","reset_dimensions","return_abi","set_draw_outline","set_outline_width","set_square_outline","square_outline","try_from","try_into","type_id","validate_board_dim","white_piece","white_piece_line","white_square","width","Player","borrow","borrow_mut","clone","clone_into","describe","from","from_abi","into","into_abi","is_none","none","ref_from_abi","ref_mut_from_abi","return_abi","score","to_owned","try_from","try_into","type_id","set_panic_hook"],"q":["draught","","","","","","","","","draught::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::board::enums","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::board::iter","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::comp","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::game","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::paint","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::player","","","","","","","","","","","","","","","","","","","","draught::utils"],"d":["","Board module for components related to the checkers board …","AI player logic","Top-level object for managing [Board]s, applying and …","","Wrap the [web_sys] access to the browser console in a …","Components for painting board states onto HTML canvases","","","Single state of a checkers board","Rank 2 tensor index to identify a board square by row and …","Standard diagonal movements given by north west/east etc","Game piece given by its team and strength (normal or …","Standard height of a checkers board is 8 squares","Standard width of a checkers board is 8 squares","Board squares given by a state and a possible occupying …","Get a [Direction] structure for the diagonally adjacent …","Get the 1D array indices for the diagonally adjacent …","","","Transform a 1D array index (for [Board::cells]) into a 2D …","","","","","","","","","","","Check whether a move given by source and destination …","Get a copy of a board square by 1D array index","Similar to [Board::cell_index] but with a [BrdIdx] …","Transform a 2D row/column board index into a single 1D …","Get a mutable reference to a board square by 1D array …","Get the state of a board square by 1D array index","Get a pointer to the backing array of board squares, […","1D backing array of board squares for the 2D game board","Check that the source piece and the jumpee are of …","","","","","","","","","","","","","","","","","Create an empty direction full of [Option::None]","Helper function for a well-formed empty square","","","","","","","Filter an array of diagonal indices (Like those from […","","","","","","","","","","","","","","","","","","Get a copy of a board square by 2D [BrdIdx] index","","Get the difference between two [BrdIdx] objects","Reset the given board to a starting layout with 3 rows of …","","","","","","","","","","","","","","","Get a [Direction] structure for the diagonally jumpable …","Get the 1D array indices for the diagonally jumpable …","","","","","","","North East","","Standard constructor function to form square from state …","Initialise a game board without game pieces","","","","","Get the number of board squares","Get the number of remaining pieces","Get the number of remaining pieces for a player","North West ","Game piece if square is occupied","Helper function for a well-formed piece square by team …","","","","","","","","","","","","","","","","Get the score value, Black - White pieces","South East","Get a copy of a board square by 1D array index","Description of whether the square is occupied or an …","","South West","","","","","","","","","","","","","","","","","","","","","","","","Helper function for a well-formed unplayable square","Unwrap the jumpee piece from the square and […","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get next item from the iterator","Get next item from the iterator","Get next item from the iterator","","","","","","","","","","","Root-level structure for managing the game as a …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Root-level structure for managing the game as a …","","","","Set current board to given","Get pointer to current board’s squares","Get pointer to current board’s squares","Current turn’s team","","","Update board state with given jump move and push new …","Update board state with given move and push new board …","","","","","","","","Attempt to make a move given a source and destination …","","","","","Get a read-only copy of a previous turn’s board","","Push current board into the previous turns and set given …","","","","Set current board to given","","","","","","Default hex colour value for black pieces","Default hex colour value for black piece outline","Default hex colour value for black square background","Whether to outline black squares","Whether to outline pieces","Default hex colour value for black piece outline","Line width when outlining black squares","Margin from square to define piece radius","Line width for outlining pieces","Used to paint boards onto HTML canvases","Default hex colour value for outline of black squares","Default hex colour value for white pieces","Default hex colour value for white piece outline","Default hex colour value for white square background","","","","","","","","","Draw a board onto the canvas","","","","","Get a canvas by element ID","Get a 2D canvas context for a given canvas","","","","","","Default constructor which queries for canvas by ID","Constructor with given canvas element","","","","","","","Reset the canvas dimensions to the given width and height","","Set whether squares are outlined","Set new line width for outlining squares","Set new square outline colour value","","","","","Check whether given canvas dimensions divide evenly by …","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,2,3,4,5,1,2,3,4,5,1,1,1,1,1,1,1,1,1,1,2,3,4,5,1,2,3,4,5,1,5,1,2,4,5,1,3,4,0,2,3,4,5,1,1,2,3,4,5,5,1,1,2,3,4,5,5,1,2,4,5,1,1,1,1,1,2,3,4,5,1,2,4,5,1,2,4,5,1,0,1,1,1,2,3,4,5,1,3,2,4,1,2,4,5,1,1,1,1,3,4,4,1,1,2,4,5,1,2,4,5,1,2,4,5,1,5,1,3,1,4,2,3,2,2,3,4,5,1,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,4,1,1,1,1,6,7,8,6,9,6,10,10,9,0,0,6,8,6,6,0,0,0,6,8,6,7,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,7,10,8,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,7,9,7,10,8,6,9,7,10,8,6,7,8,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,0,0,0,11,12,13,11,12,13,11,12,13,11,12,13,13,12,11,12,13,11,12,13,11,12,13,11,12,13,11,11,12,13,11,12,13,11,12,13,0,0,14,15,14,15,14,15,15,15,15,14,15,14,15,14,14,14,15,14,15,15,15,14,14,14,14,15,15,14,15,14,15,14,15,14,14,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,0],"f":[[[]],null,null,null,[[]],null,null,null,null,null,null,null,null,null,null,null,[[["brdidx",3]],[["option",4],["direction",3]]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],["board",3]],[[["brdidx",3]],["board",3]],[[["usize",15]],["brdidx",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["brdidx",3]],["moveable",4]],[[["usize",15]],["square",3]],[[["brdidx",3]],["usize",15]],[[["usize",15]],["usize",15]],[[["usize",15]],["square",3]],[[["usize",15]],["squarestate",4]],[[]],null,[[["piece",3]],["bool",15]],[[],["piece",3]],[[],["direction",3]],[[],["square",3]],[[],["brdidx",3]],[[],["board",3]],[[]],[[]],[[]],[[]],[[]],null,null,[[]],[[]],[[]],[[]],[[],["direction",3]],[[],["square",3]],null,[[["piece",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["square",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["board",3]],["bool",15]],[[["team",4],["brdidx",3],["vec",3],["usize",15]],[["vec",3],["usize",15]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[["usize",15]],["brdidx",3]],[[]],[[]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["brdidx",3]],["square",3]],null,[[["brdidx",3]]],[[["board",3],["usize",15]],["board",3]],[[]],[[]],[[]],[[]],[[]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],null,[[["brdidx",3]],[["option",4],["direction",3]]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],["usize",15]],[[["piece",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["square",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["board",3]],["bool",15]],null,[[["team",4],["strength",4]],["piece",3]],[[["piece",3],["option",4],["squarestate",4]],["square",3]],[[["team",4],["usize",15]],["board",3]],[[]],[[]],[[]],[[]],[[],["usize",15]],[[],["usize",15]],[[["team",4]],["usize",15]],null,null,[[["team",4],["strength",4]],["square",3]],[[["team",4],["brdidx",3]],[["option",4],["vec",3]]],[[["team",4],["brdidx",3]],[["option",4],["vec",3]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,[[],["isize",15]],null,[[["usize",15],["square",3]]],null,null,null,null,[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["square",3]],[[["square",3],["piece",3]],["moveable",4]],[[["brdidx",3],["piece",3]],["moveable",4]],[[["brdidx",3],["piece",3]],["moveable",4]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["movetype",4]],[[],["team",4]],[[],["strength",4]],[[],["squarestate",4]],[[],["moveable",4]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["movetype",4]],["bool",15]],[[["team",4]],["bool",15]],[[["strength",4]],["bool",15]],[[["squarestate",4]],["bool",15]],[[["moveable",4]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[]],[[]],[[]],[[]],[[]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[],["team",4]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,null,null,null,null,null,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,null,[[]],[[]],[[]],[[]],[[]],[[]],[[["board",3]]],[[["board",3]]],[[["board",3]]],[[],[["option",4],["vec",3]]],[[],[["vec",3],["option",4]]],[[],["option",4]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,null,[[["board",3]],[["move",3],["vec",3]]],[[]],[[]],[[]],[[]],[[],["move",3]],[[]],[[["move",3]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],null,[[]],[[["board",3]],[["vec",3],["board",3]]],[[["vec",3],["board",3]],[["nodeid",3],["vec",3]]],[[]],[[]],null,[[["move",3]],["bool",15]],[[["brdidx",3],["movetype",4]],["move",3]],[[["board",3],["usize",15],["team",4]],["computer",3]],null,null,null,null,[[]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[["board",3]]],null,[[]],[[]],null,[[],["board",3]],[[]],[[],["usize",15]],[[],["team",4]],[[]],[[]],[[["brdidx",3]]],[[["brdidx",3]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[["u32",15]]],[[]],[[],["u32",15]],[[],["bool",15]],[[["brdidx",3]]],[[["team",4],["usize",15]],["game",3]],[[["team",4],["str",15],["usize",15],["u32",15]],["game",3]],[[]],null,[[["usize",15]],["board",3]],null,[[["board",3]]],[[]],[[]],[[]],[[["board",3]]],[[["painter",3]]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],null,null,[[]],[[["board",3]]],null,[[["formatter",3]],["result",6]],[[]],[[["u32",15]]],[[["str",15]],["htmlcanvaselement",3]],[[["htmlcanvaselement",3]],["canvasrenderingcontext2d",3]],null,[[]],[[],["u32",15]],[[],["bool",15]],null,[[["u32",15],["str",15]],["painter",3]],[[["htmlcanvaselement",3],["u32",15]],["painter",3]],[[]],null,null,null,[[]],[[]],[[]],[[]],[[["bool",15]]],[[["f64",15]]],[[["jsvalue",3]]],null,[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[["board",3]],["bool",15]],null,null,null,null,null,[[]],[[]],[[],["player",3]],[[]],[[]],[[]],[[["u32",15]]],[[]],[[],["u32",15]],[[],["bool",15]],[[]],[[]],[[]],[[]],null,[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]]],"p":[[3,"Board"],[3,"Piece"],[3,"Direction"],[3,"Square"],[3,"BrdIdx"],[4,"Moveable"],[4,"Team"],[4,"SquareState"],[4,"MoveType"],[4,"Strength"],[3,"RowIndexIterator"],[3,"RowSquareIterator"],[3,"PieceIterator"],[3,"Computer"],[3,"Move"],[3,"Game"],[3,"Painter"],[3,"Player"]]}\ +"draught":{"doc":"Draught","t":[5,0,0,0,5,14,0,0,0,3,3,3,3,17,17,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,13,13,13,13,13,13,13,13,13,4,4,13,13,13,13,4,4,4,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,3,3,3,12,12,12,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,3,3,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,11,11,12,12,12,12,11,12,11,11,11,11,11,11,11,3,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,11,11,11,11,11,11,11,17,17,17,17,17,17,17,17,17,3,17,17,17,17,12,12,12,11,11,12,12,11,11,12,11,11,11,11,11,12,11,11,11,12,11,11,11,12,12,12,11,11,11,11,11,11,11,12,11,11,11,11,12,12,12,12,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,5],"n":["__wasm_bindgen_generated_init_wasm","board","comp","game","init_wasm","log","paint","player","utils","Board","BrdIdx","Direction","Piece","STD_HEIGHT","STD_WIDTH","Square","adjacent_dir","adjacent_indices","apply_jump","apply_move","board_index","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","can_move","cell","cell_idx","cell_index","cell_mut","cell_state","cells","cells","check_jumpee_team","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","col","current_turn","describe","describe","describe","describe","empty","empty","enums","eq","eq","eq","eq","eq","filter_indices","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from_abi","from_abi","from_abi","from_abi","grid_cell","height","idx_diffs","init_game","into","into","into","into","into","into_abi","into_abi","into_abi","into_abi","is_none","is_none","is_none","is_none","iter","jumpable_dir","jumpable_indices","jumpee_idx","ne","ne","ne","ne","ne","ne","new","new","new","none","none","none","none","num_cells","num_pieces","num_player","nw","occupant","pc","player_adjacent_indices","player_jumpable_indices","ref_from_abi","ref_from_abi","ref_from_abi","ref_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","ref_mut_from_abi","return_abi","return_abi","return_abi","return_abi","row","score","se","set_cell","state","strength","sw","team","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","to_string","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","unplay","validate_jumpee","validate_king_move","validate_man_move","width","Allowed","Black","Empty","IllegalTrajectory","Jump","JumpingSameTeam","King","Man","Move","MoveType","Moveable","NoJumpablePiece","Occupied","OccupiedDest","OutOfBounds","SquareState","Strength","Team","UnoccupiedSrc","Unplayable","Unplayable","White","WrongTeamSrc","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","describe","describe","describe","describe","describe","eq","eq","eq","eq","eq","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_abi","from_abi","from_abi","from_abi","from_abi","into","into","into","into","into","into_abi","into_abi","into_abi","into_abi","into_abi","is_none","is_none","is_none","is_none","is_none","none","none","none","none","none","opponent","return_abi","return_abi","return_abi","return_abi","return_abi","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","to_string","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","PieceIterator","RowIndexIterator","RowSquareIterator","board","board","board","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","from","from","from","index_cursor","index_iter","into","into","into","into_iter","into_iter","into_iter","new","new","new","next","next","next","row_cursor","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","Computer","Move","available_turns","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","eq","fmt","fmt","from","from","from","get_move","get_move_boards","insert_boards","into","into","mv_type","ne","new","new","root_node_id","search_depth","team","to","to_owned","tree","try_from","try_from","try_into","try_into","type_id","type_id","update_board","Game","borrow","borrow_mut","current","current_board","current_board_cells","current_board_len","current_turn","describe","draw","execute_jump","execute_move","fmt","fmt","from","from_abi","into","into_abi","is_none","make_move","new","new_with_canvas","none","painter","previous_board","previous_boards","push_new_board","ref_from_abi","ref_mut_from_abi","return_abi","set_current","set_painter","to_string","try_from","try_into","type_id","BLACK_PIECE","BLACK_PIECE_OUTLINE","BLACK_SQUARE","DRAW_OUTLINE","DRAW_PIECE_OUTLINES","KING_OUTLINE","OUTLINE_WIDTH","PIECE_MARGIN","PIECE_OUTLINE_WIDTH","Painter","SQUARE_OUTLINE","WHITE_PIECE","WHITE_PIECE_OUTLINE","WHITE_SQUARE","black_piece","black_piece_line","black_square","borrow","borrow_mut","canvas","context","describe","draw","draw_outline","fmt","from","from_abi","get_canvas","get_canvas_context","height","into","into_abi","is_none","king_line","new","new_with_canvas","none","outline_width","piece_line_width","piece_lines","ref_from_abi","ref_mut_from_abi","reset_dimensions","return_abi","set_draw_outline","set_outline_width","set_square_outline","square_outline","try_from","try_into","type_id","validate_board_dim","white_piece","white_piece_line","white_square","width","Player","borrow","borrow_mut","clone","clone_into","describe","from","from_abi","into","into_abi","is_none","none","ref_from_abi","ref_mut_from_abi","return_abi","score","to_owned","try_from","try_into","type_id","set_panic_hook"],"q":["draught","","","","","","","","","draught::board","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::board::enums","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::board::iter","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::comp","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::game","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::paint","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","draught::player","","","","","","","","","","","","","","","","","","","","draught::utils"],"d":["","Board module for components related to the checkers board …","AI player logic","Top-level object for managing [Board]s, applying and …","","Wrap the [web_sys] access to the browser console in a …","Components for painting board states onto HTML canvases","","","Single state of a checkers board","Rank 2 tensor index to identify a board square by row and …","Standard diagonal movements given by north west/east etc","Game piece given by its team and strength (normal or …","Standard height of a checkers board is 8 squares","Standard width of a checkers board is 8 squares","Board squares given by a state and a possible occupying …","Get a [Direction] structure for the diagonally adjacent …","Get the 1D array indices for the diagonally adjacent …","","","Transform a 1D array index (for [Board::cells]) into a 2D …","","","","","","","","","","","Check whether a move given by source and destination …","Get a copy of a board square by 1D array index","Similar to [Board::cell_index] but with a [BrdIdx] …","Transform a 2D row/column board index into a single 1D …","Get a mutable reference to a board square by 1D array …","Get the state of a board square by 1D array index","Get a pointer to the backing array of board squares, […","1D backing array of board squares for the 2D game board","Check that the source piece and the jumpee are of …","","","","","","","","","","","","","","","","","Create an empty direction full of [Option::None]","Helper function for a well-formed empty square","","","","","","","Filter an array of diagonal indices (Like those from […","","","","","","","","","","","","","","","","","","Get a copy of a board square by 2D [BrdIdx] index","","Get the difference between two [BrdIdx] objects","Reset the given board to a starting layout with 3 rows of …","","","","","","","","","","","","","","","Get a [Direction] structure for the diagonally jumpable …","Get the 1D array indices for the diagonally jumpable …","","","","","","","North East","","Standard constructor function to form square from state …","Initialise a game board without game pieces","","","","","Get the number of board squares","Get the number of remaining pieces","Get the number of remaining pieces for a player","North West ","Game piece if square is occupied","Helper function for a well-formed piece square by team …","","","","","","","","","","","","","","","","Get the score value, Black - White pieces","South East","Get a copy of a board square by 1D array index","Description of whether the square is occupied or an …","","South West","","","","","","","","","","","","","","","","","","","","","","","","Helper function for a well-formed unplayable square","Unwrap the jumpee piece from the square and […","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get next item from the iterator","Get next item from the iterator","Get next item from the iterator","","","","","","","","","","","Root-level structure for managing the game as a …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Root-level structure for managing the game as a …","","","","Set current board to given","Get pointer to current board’s squares","Get pointer to current board’s squares","Current turn’s team","","","Update board state with given jump move and push new …","Update board state with given move and push new board …","","","","","","","","Attempt to make a move given a source and destination …","","","","","Get a read-only copy of a previous turn’s board","","Push current board into the previous turns and set given …","","","","Set current board to given","","","","","","Default hex colour value for black pieces","Default hex colour value for black piece outline","Default hex colour value for black square background","Whether to outline black squares","Whether to outline pieces","Default hex colour value for black piece outline","Line width when outlining black squares","Margin from square to define piece radius","Line width for outlining pieces","Used to paint boards onto HTML canvases","Default hex colour value for outline of black squares","Default hex colour value for white pieces","Default hex colour value for white piece outline","Default hex colour value for white square background","","","","","","","","","Draw a board onto the canvas","","","","","Get a canvas by element ID","Get a 2D canvas context for a given canvas","","","","","","Default constructor which queries for canvas by ID","Constructor with given canvas element","","","","","","","Reset the canvas dimensions to the given width and height","","Set whether squares are outlined","Set new line width for outlining squares","Set new square outline colour value","","","","","Check whether given canvas dimensions divide evenly by …","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,2,3,4,5,1,2,3,4,5,1,1,1,1,1,1,1,1,1,1,2,3,4,5,1,2,3,4,5,1,5,1,2,4,5,1,3,4,0,2,3,4,5,1,1,2,3,4,5,5,1,1,2,3,4,5,5,1,2,4,5,1,1,1,1,1,2,3,4,5,1,2,4,5,1,2,4,5,1,0,1,1,1,2,3,4,5,1,3,2,4,1,2,4,5,1,1,1,1,3,4,4,1,1,2,4,5,1,2,4,5,1,2,4,5,1,5,1,3,1,4,2,3,2,2,3,4,5,1,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,4,1,1,1,1,6,7,8,6,9,6,10,10,9,0,0,6,8,6,6,0,0,0,6,8,6,7,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,7,10,8,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,7,9,7,10,8,6,9,7,10,8,6,7,8,9,7,10,8,6,9,7,10,8,6,9,7,10,8,6,0,0,0,11,12,13,11,12,13,11,12,13,11,12,13,13,12,11,12,13,11,12,13,11,12,13,11,12,13,11,11,12,13,11,12,13,11,12,13,0,0,14,15,14,15,14,15,15,15,15,14,15,14,15,14,14,14,15,14,15,15,15,14,14,14,14,15,15,14,15,14,15,14,15,14,14,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,0],"f":[[[]],null,null,null,[[]],null,null,null,null,null,null,null,null,null,null,null,[[["brdidx",3]],[["option",4],["direction",3]]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],["board",3]],[[["brdidx",3]],["board",3]],[[["usize",15]],["brdidx",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["brdidx",3]],["moveable",4]],[[["usize",15]],["square",3]],[[["brdidx",3]],["usize",15]],[[["usize",15]],["usize",15]],[[["usize",15]],["square",3]],[[["usize",15]],["squarestate",4]],[[]],null,[[["piece",3]],["bool",15]],[[],["piece",3]],[[],["direction",3]],[[],["square",3]],[[],["brdidx",3]],[[],["board",3]],[[]],[[]],[[]],[[]],[[]],null,null,[[]],[[]],[[]],[[]],[[],["direction",3]],[[],["square",3]],null,[[["piece",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["square",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["board",3]],["bool",15]],[[["team",4],["brdidx",3],["vec",3],["usize",15]],[["vec",3],["usize",15]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[["usize",15]],["brdidx",3]],[[]],[[]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["brdidx",3]],["square",3]],null,[[["brdidx",3]]],[[["board",3],["usize",15]],["board",3]],[[]],[[]],[[]],[[]],[[]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],null,[[["brdidx",3]],[["option",4],["direction",3]]],[[["brdidx",3]],[["option",4],["vec",3]]],[[["brdidx",3]],["usize",15]],[[["piece",3]],["bool",15]],[[["direction",3]],["bool",15]],[[["square",3]],["bool",15]],[[["brdidx",3]],["bool",15]],[[["board",3]],["bool",15]],null,[[["team",4],["strength",4]],["piece",3]],[[["piece",3],["option",4],["squarestate",4]],["square",3]],[[["team",4],["usize",15]],["board",3]],[[]],[[]],[[]],[[]],[[],["usize",15]],[[],["usize",15]],[[["team",4]],["usize",15]],null,null,[[["team",4],["strength",4]],["square",3]],[[["team",4],["brdidx",3]],[["option",4],["vec",3]]],[[["team",4],["brdidx",3]],[["option",4],["vec",3]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,[[],["isize",15]],null,[[["usize",15],["square",3]]],null,null,null,null,[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["square",3]],[[["square",3],["piece",3]],["moveable",4]],[[["brdidx",3],["piece",3]],["moveable",4]],[[["brdidx",3],["piece",3]],["moveable",4]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["movetype",4]],[[],["team",4]],[[],["strength",4]],[[],["squarestate",4]],[[],["moveable",4]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["movetype",4]],["bool",15]],[[["team",4]],["bool",15]],[[["strength",4]],["bool",15]],[[["squarestate",4]],["bool",15]],[[["moveable",4]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],[[]],[[]],[[]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[["u32",15]]],[[]],[[]],[[]],[[]],[[]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[["u32",15]],["bool",15]],[[]],[[]],[[]],[[]],[[]],[[],["team",4]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,null,null,null,null,null,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],null,null,[[]],[[]],[[]],[[]],[[]],[[]],[[["board",3]]],[[["board",3]]],[[["board",3]]],[[],[["option",4],["vec",3]]],[[],[["vec",3],["option",4]]],[[],["option",4]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,null,[[["board",3]],[["move",3],["vec",3]]],[[]],[[]],[[]],[[]],[[],["move",3]],[[]],[[["move",3]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[]],null,[[]],[[["board",3]],[["vec",3],["board",3]]],[[["vec",3],["board",3]],[["nodeid",3],["vec",3]]],[[]],[[]],null,[[["move",3]],["bool",15]],[[["brdidx",3],["movetype",4]],["move",3]],[[["board",3],["usize",15],["team",4]],["computer",3]],null,null,null,null,[[]],null,[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[["board",3]]],null,[[]],[[]],null,[[],["board",3]],[[]],[[],["usize",15]],[[],["team",4]],[[]],[[]],[[["brdidx",3]]],[[["brdidx",3]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[["u32",15]]],[[]],[[],["u32",15]],[[],["bool",15]],[[["brdidx",3]],["moveable",4]],[[["team",4],["usize",15]],["game",3]],[[["team",4],["str",15],["usize",15],["u32",15]],["game",3]],[[]],null,[[["usize",15]],["board",3]],null,[[["board",3]]],[[]],[[]],[[]],[[["board",3]]],[[["painter",3]]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[]],[[]],null,null,[[]],[[["board",3]]],null,[[["formatter",3]],["result",6]],[[]],[[["u32",15]]],[[["str",15]],["htmlcanvaselement",3]],[[["htmlcanvaselement",3]],["canvasrenderingcontext2d",3]],null,[[]],[[],["u32",15]],[[],["bool",15]],null,[[["u32",15],["str",15]],["painter",3]],[[["htmlcanvaselement",3],["u32",15]],["painter",3]],[[]],null,null,null,[[]],[[]],[[]],[[]],[[["bool",15]]],[[["f64",15]]],[[["jsvalue",3]]],null,[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[["board",3]],["bool",15]],null,null,null,null,null,[[]],[[]],[[],["player",3]],[[]],[[]],[[]],[[["u32",15]]],[[]],[[],["u32",15]],[[],["bool",15]],[[]],[[]],[[]],[[]],null,[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]]],"p":[[3,"Board"],[3,"Piece"],[3,"Direction"],[3,"Square"],[3,"BrdIdx"],[4,"Moveable"],[4,"Team"],[4,"SquareState"],[4,"MoveType"],[4,"Strength"],[3,"RowIndexIterator"],[3,"RowSquareIterator"],[3,"PieceIterator"],[3,"Computer"],[3,"Move"],[3,"Game"],[3,"Painter"],[3,"Player"]]}\ }'); if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file diff --git a/doc/src/draught/game/mod.rs.html b/doc/src/draught/game/mod.rs.html index 2d4fb59..2c36151 100644 --- a/doc/src/draught/game/mod.rs.html +++ b/doc/src/draught/game/mod.rs.html @@ -144,6 +144,8 @@ 141 142 143 +144 +145
 //! Top-level object for managing [`Board`]s, applying and managing turns
 
@@ -204,7 +206,7 @@
     }
 
     /// Attempt to make a move given a source and destination index
-    pub fn make_move(&mut self, from: BrdIdx, to: BrdIdx) {
+    pub fn make_move(&mut self, from: BrdIdx, to: BrdIdx) -> Moveable {
         let able = self.current.can_move(from, to);
 
         if let Moveable::Allowed = able {
@@ -223,6 +225,8 @@
 
         // board has been changed, update player turn
         self.current.current_turn = self.current.current_turn.opponent();
+
+        able
     }
 
     /// Update board state with given move and push new board into current state
diff --git a/index.html b/index.html
index 6a09245..27eba6e 100644
--- a/index.html
+++ b/index.html
@@ -39,11 +39,17 @@
                     

Working on an implementation of checkers in Rust WASM with a thin Js frontend, mainly as an exercise to learn Rust and to have a larger project in the language to fiddle with. The idea is to use the minimax algorithm to create an AI player that can operate with reasonable performance as a result of Rust's compiled performance.

-
+ + +
+
+ +
+