diff --git a/10.bootstrap.js b/10.bootstrap.js index 677f952..1beeca0 100644 --- a/10.bootstrap.js +++ b/10.bootstrap.js @@ -1,2 +1,2 @@ -(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(e,n,t)=>{"use strict";t.a(e,(async r=>{t.d(n,{QC:()=>s,ug:()=>y,h4:()=>O,a:()=>v,h9:()=>T,Dz:()=>k,kF:()=>j,Or:()=>E});var c=t(813);e=t.hmd(e);var o=r([c]);c=(o.then?await o:o)[0];const u=new Array(32).fill(void 0);function a(e){return u[e]}u.push(void 0,null,!0,!1);let l=u.length;let i=new("undefined"==typeof TextDecoder?(0,e.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});i.decode();let f=null;function d(){return null!==f&&f.buffer===c.memory.buffer||(f=new Uint8Array(c.memory.buffer)),f}function b(e,n){return i.decode(d().subarray(e,e+n))}function g(e){l===u.length&&u.push(u.length+1);const n=l;return l=u[n],u[n]=e,n}function s(){c.init_game()}let _=0,h=new("undefined"==typeof TextEncoder?(0,e.require)("util").TextEncoder:TextEncoder)("utf-8");const w="function"==typeof h.encodeInto?function(e,n){return h.encodeInto(e,n)}:function(e,n){const t=h.encode(e);return n.set(t),{read:e.length,written:t.length}};let m=null;function p(){return null!==m&&m.buffer===c.memory.buffer||(m=new Int32Array(c.memory.buffer)),m}function y(e){!function(e){const n=a(e);(function(e){e<36||(u[e]=l,l=e)})(e)}(e)}function O(e,n){return g(b(e,n))}function v(e){console.log(a(e))}function T(){return g(new Error)}function k(e,n){var t=function(e,n,t){if(void 0===t){const t=h.encode(e),r=n(t.length);return d().subarray(r,r+t.length).set(t),_=t.length,r}let r=e.length,c=n(r);const o=d();let u=0;for(;u127)break;o[c+u]=n}if(u!==r){0!==u&&(e=e.slice(u)),c=t(c,r,r=u+3*e.length);const n=d().subarray(c+u,c+r);u+=w(e,n).written}return _=u,c}(a(n).stack,c.__wbindgen_malloc,c.__wbindgen_realloc),r=_;p()[e/4+1]=r,p()[e/4+0]=t}function j(e,n){try{console.error(b(e,n))}finally{c.__wbindgen_free(e,n)}}function E(e,n){throw new Error(b(e,n))}Object.freeze({Move:0,0:"Move",Jump:1,1:"Jump"}),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"})}))},813:(e,n,t)=>{"use strict";var r=([r])=>t.v(n,e.id,"cdd94e76e3c8474c3b05",{"./draught_bg.js":{__wbindgen_object_drop_ref:r.ug,__wbindgen_string_new:r.h4,__wbg_log_9a99fb1af846153b:r.a,__wbg_new_59cb74e423758ede:r.h9,__wbg_stack_558ba5917b466edd:r.Dz,__wbg_error_4bb6c2a97407129a:r.kF,__wbindgen_throw:r.Or}});t.a(e,(e=>{var n=e([t(171)]);return n.then?n.then(r):r(n)}),1)},10:(e,n,t)=>{"use strict";t.a(e,(async e=>{t.r(n);var r=t(171),c=e([r]);(0,(r=(c.then?await c:c)[0]).QC)(),document.getElementById("game-canvas").getContext("2d")}))}}]); +(self.webpackChunkdraught=self.webpackChunkdraught||[]).push([[10],{171:(t,r,e)=>{"use strict";e.a(t,(async n=>{e.d(r,{QC:()=>j,SZ:()=>O,lA:()=>q,Ck:()=>C,ug:()=>I,h4:()=>A,h9:()=>W,Dz:()=>U,kF:()=>M,s8:()=>$,WB:()=>R,cP:()=>D,a:()=>P,l_:()=>z,U_:()=>F,EN:()=>J,qu:()=>Q,Wg:()=>N,B3:()=>K,I6:()=>L,Qb:()=>X,cI:()=>Y,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,f=new("undefined"==typeof TextEncoder?(0,t.require)("util").TextEncoder:TextEncoder)("utf-8");const w="function"==typeof f.encodeInto?function(t,r){return f.encodeInto(t,r)}:function(t,r){const e=f.encode(t);return r.set(e),{read:t.length,written:e.length}};function h(t,r,e){if(void 0===e){const e=f.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+=w(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 x(t,r){if(!(t instanceof r))throw new Error(`expected instance of ${r.name}`);return t.ptr}function j(){_.init_game()}function k(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){x(r,B);var e=r.ptr;r.ptr=0,_.board_set_cell(this.ptr,t,e)}grid_cell(t){x(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){x(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){x(t,E);var e=t.ptr;t.ptr=0,x(r,E);var n=r.ptr;return r.ptr=0,_.board_can_move(this.ptr,e,n)>>>0}validate_man_move(t,r,e){x(t,E);var n=t.ptr;t.ptr=0,x(r,E);var a=r.ptr;r.ptr=0,x(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){x(t,E);var n=t.ptr;t.ptr=0,x(r,E);var a=r.ptr;r.ptr=0,x(e,T);var i=e.ptr;return e.ptr=0,_.board_validate_king_move(this.ptr,n,a,i)>>>0}jumpee_idx(t,r){x(t,E);var e=t.ptr;t.ptr=0,x(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){x(t,E);var e=t.ptr;t.ptr=0,x(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){x(t,E);var e=t.ptr;t.ptr=0,x(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){x(t,B);var e=t.ptr;t.ptr=0,x(r,T);var n=r.ptr;return r.ptr=0,_.board_validate_jumpee(e,n)>>>0}static check_jumpee_team(t,r){x(t,T);var e=t.ptr;t.ptr=0,x(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){x(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)}static from(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){x(t,E);var e=t.ptr;t.ptr=0,x(r,E);var n=r.ptr;r.ptr=0,_.game_make_move(this.ptr,e,n)}execute_move(t,r){x(t,E);var e=t.ptr;t.ptr=0,x(r,E);var n=r.ptr;r.ptr=0,_.game_execute_move(this.ptr,e,n)}execute_jump(t,r){x(t,E);var e=t.ptr;t.ptr=0,x(r,E);var n=r.ptr;r.ptr=0,_.game_execute_jump(this.ptr,e,n)}push_new_board(t){x(t,S);var r=t.ptr;t.ptr=0,_.game_push_new_board(this.ptr,r)}set_current(t){x(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){x(t,C);var r=t.ptr;t.ptr=0,_.game_set_painter(this.ptr,r)}draw(){_.game_draw(this.ptr)}}class C{static __wrap(t){const r=Object.create(C.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 C.__wrap(i)}static new_with_canvas(t,r,e){var n=_.painter_new_with_canvas(t,r,d(e));return C.__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 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)||(x(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)||(x(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 I(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 Q(t,r){o(t).lineWidth=r}function N(t){o(t).beginPath()}function K(t){o(t).fill()}function L(t){o(t).stroke()}function X(){return k((function(t,r,e,n,_,a){o(t).arc(r,e,n,_,a)}),arguments)}function Y(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 k((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 k((function(t,r){return d(o(t).call(o(r)))}),arguments)}function nt(){return k((function(){return d(self.self)}),arguments)}function _t(){return k((function(){return d(window.window)}),arguments)}function at(){return k((function(){return d(globalThis.globalThis)}),arguments)}function it(){return k((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,"dfc37aa6c5fb55420dbe",{"./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]);(0,(n=(_.then?await _:_)[0]).QC)();const a=document.getElementById("game-canvas");a.addEventListener("click",(t=>{var r=function(t,r){var e=t.getBoundingClientRect();return{x:r.clientX-e.left,y:r.clientY-e.top}}(a,t),e={x:Math.floor(r.x/480*8),y:Math.floor(r.y/480*8)};console.log(e)}));let i=new n.Ck(480,480,"game-canvas"),o=new n.lA(8,8,3,n.SZ.Black,"game-canvas",480,480);o.set_painter(i),o.draw()}))}}]); //# sourceMappingURL=10.bootstrap.js.map \ No newline at end of file diff --git a/10.bootstrap.js.map b/10.bootstrap.js.map index 232b9ad..2ff8198 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","init_game","WASM_VECTOR_LEN","cachedTextEncoder","TextEncoder","encodeString","encodeInto","arg","view","buf","encode","set","read","written","cachegetInt32Memory0","getInt32Memory0","Int32Array","__wbindgen_object_drop_ref","arg0","ret","dropObject","takeObject","__wbindgen_string_new","arg1","__wbg_log_9a99fb1af846153b","console","log","__wbg_new_59cb74e423758ede","Error","__wbg_stack_558ba5917b466edd","ptr0","malloc","realloc","mem","offset","code","charCodeAt","slice","passStringToWasm0","stack","len0","__wbg_error_4bb6c2a97407129a","error","__wbindgen_throw","Object","freeze","Move","Jump","Black","White","Man","King","Empty","Occupied","Unplayable","Allowed","UnoccupiedSrc","OccupiedDest","OutOfBounds","WrongTeamSrc","IllegalTrajectory","NoJumpablePiece","JumpingSameTeam","document","getElementById","getContext"],"mappings":"6PAEA,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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AAOC,OAAO,CAAEK,IAAI,EAAE,EAAI,MAAMC,KAAK,EAAE,EAAI,SAGxCP,OAAOC,OAAO,CAAEO,MAAM,EAAE,EAAI,QAAQC,SAAS,EAAE,EAAI,WAAWC,WAAW,EAAE,EAAI,eAGlFV,OAAOC,OAAO,CAAEU,QAAQ,EAAE,EAAI,UAAUC,cAAc,EAAE,EAAI,gBAAgBC,aAAa,EAAE,EAAI,eAAeC,YAAY,EAAE,EAAI,cAAcJ,WAAW,EAAE,EAAI,aAAaK,aAAa,EAAE,EAAI,eAAeC,kBAAkB,EAAE,EAAI,oBAAoBC,gBAAgB,EAAE,EAAI,kBAAkBC,gBAAgB,EAAE,EAAI,wB,8bC1IhV,G,yBAAA,MAEeC,SAASC,eAAe,eACpBC,WAAW","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 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_game() {\n wasm.init_game();\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/**\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 * @param {number} row\n * @param {number} col\n * @returns {BrdIdx}\n */\n static from(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 * 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/**\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_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\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 __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n","import { init_game } from \"draught\";\nimport { memory } from \"draught/draught_bg.wasm\";\n\n// let PLAY = true;\n// let PLAY = false;\ninit_game();\n\nconst canvas = document.getElementById(\"game-canvas\");\nconst ctx = canvas.getContext('2d');\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_game","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","addEventListener","event","mousepos","evt","rect","getBoundingClientRect","clientX","left","y","clientY","top","getMousePos","cell","Math","floor","painter","game","set_painter","draw"],"mappings":"6gBAEA,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,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,CACPlJ,EAAGmJ,KAAKC,MAAOZ,EAASxI,EAbX,IAGD,GAWZ8I,EAAGK,KAAKC,MAAOZ,EAASM,EAbV,IAGD,IAYjBhE,QAAQU,IAAI0D,MAWhB,IAAIG,EAAU,IAAI,KA3BG,IACC,IA0BiC,eAKnDC,EAAO,IAAI,KA7BK,EACC,EAEF,EA0BwC,WAAY,cAhClD,IACC,KAgCtBA,EAAKC,YAAYF,GACjBC,EAAKE","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_game() {\n wasm.init_game();\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 * @returns {BrdIdx}\n */\n static from(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, Painter, Team, init_game } from \"draught\";\nimport { memory } from \"draught/draught_bg.wasm\";\n\ninit_game();\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 canvas = document.getElementById(\"game-canvas\");\ncanvas.addEventListener(\"click\", (event) => {\n var mousepos = getMousePos(canvas, event);\n // console.log(mousepos);\n var cell = {\n x: Math.floor((mousepos.x / CANVAS_WIDTH) * BOARD_WIDTH),\n y: Math.floor((mousepos.y / CANVAS_HEIGHT) * BOARD_HEIGHT),\n }\n console.log(cell);\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\nlet painter = new Painter(CANVAS_WIDTH, CANVAS_HEIGHT, \"game-canvas\");\n\n// let board = new Board(BOARD_WIDTH, BOARD_HEIGHT, Team.Black);\n// painter.draw(board);\n\nlet game = new Game(BOARD_WIDTH, BOARD_HEIGHT, PIECE_ROWS, Team.Black, \"game-canvas\", CANVAS_WIDTH, CANVAS_HEIGHT);\ngame.set_painter(painter);\ngame.draw();\n"],"sourceRoot":""} \ No newline at end of file diff --git a/cdd94e76e3c8474c3b05.module.wasm b/cdd94e76e3c8474c3b05.module.wasm deleted file mode 100644 index 08c54cb..0000000 Binary files a/cdd94e76e3c8474c3b05.module.wasm and /dev/null differ diff --git a/dfc37aa6c5fb55420dbe.module.wasm b/dfc37aa6c5fb55420dbe.module.wasm new file mode 100644 index 0000000..a563d60 Binary files /dev/null and b/dfc37aa6c5fb55420dbe.module.wasm differ diff --git a/doc/draught/all.html b/doc/draught/all.html index d18be4d..b1bd9bb 100644 --- a/doc/draught/all.html +++ b/doc/draught/all.html @@ -3,5 +3,5 @@

List of all items[] -

Structs

Enums

Macros

Functions

Constants

+

Structs

Enums

Macros

Functions

Constants

\ No newline at end of file diff --git a/doc/draught/board/constant.STD_HEIGHT.html b/doc/draught/board/constant.STD_HEIGHT.html index 7899c0a..d9c8210 100644 --- a/doc/draught/board/constant.STD_HEIGHT.html +++ b/doc/draught/board/constant.STD_HEIGHT.html @@ -1,6 +1,6 @@ STD_HEIGHT in draught::board - Rust

Constant draught::board::STD_HEIGHT[][src]

pub const STD_HEIGHT: usize = 8;

Standard height of a checkers board is 8 squares

+ Change settings

Constant draught::board::STD_HEIGHT[][src]

pub const STD_HEIGHT: usize = 8;

Standard height of a checkers board is 8 squares

\ No newline at end of file diff --git a/doc/draught/board/constant.STD_WIDTH.html b/doc/draught/board/constant.STD_WIDTH.html index 208988a..9e7b44f 100644 --- a/doc/draught/board/constant.STD_WIDTH.html +++ b/doc/draught/board/constant.STD_WIDTH.html @@ -1,6 +1,6 @@ STD_WIDTH in draught::board - Rust

Constant draught::board::STD_WIDTH[][src]

pub const STD_WIDTH: usize = 8;

Standard width of a checkers board is 8 squares

+ Change settings

Constant draught::board::STD_WIDTH[][src]

pub const STD_WIDTH: usize = 8;

Standard width of a checkers board is 8 squares

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

Module draught::board[][src]

Board module for components related to the checkers board and game structure

+ Change settings

Module draught::board[][src]

Board module for components related to the checkers board and game structure

Modules

enums
iter

Structs

Board

Single state of a checkers board

diff --git a/doc/draught/board/iter/index.html b/doc/draught/board/iter/index.html index 68a2644..dfe3043 100644 --- a/doc/draught/board/iter/index.html +++ b/doc/draught/board/iter/index.html @@ -1,6 +1,6 @@ draught::board::iter - Rust

Module draught::board::iter[][src]

Structs

+ Change settings

Module draught::board::iter[][src]

Structs

PieceIterator
RowIndexIterator
RowSquareIterator
\ No newline at end of file diff --git a/doc/draught/board/struct.Board.html b/doc/draught/board/struct.Board.html index 6a5cc1c..0792be1 100644 --- a/doc/draught/board/struct.Board.html +++ b/doc/draught/board/struct.Board.html @@ -1,7 +1,7 @@ Board in draught::board - Rust

Struct draught::board::Board[][src]

pub struct Board {
+                Change settings

Struct draught::board::Board[][src]

pub struct Board {
     cells: Vec<Square>,
     pub width: usize,
     pub height: usize,
@@ -9,76 +9,76 @@
 }

Single state of a checkers board

Fields

cells: Vec<Square>

1D backing array of board squares for the 2D game board

-
width: usizeheight: usizecurrent_turn: Team

Implementations

impl Board[src]

pub fn cell_mut(&mut self, idx: usize) -> &mut Square[src]

Get a mutable reference to a board square by 1D array index

-

pub fn adjacent_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>[src]

Get the 1D array indices for the diagonally adjacent squares of a given board square

+
width: usizeheight: usizecurrent_turn: Team

Implementations

impl Board[src]

pub fn cell_mut(&mut self, idx: usize) -> &mut Square[src]

Get a mutable reference to a board square by 1D array index

+

pub fn adjacent_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>[src]

Get the 1D array indices for the diagonally adjacent squares of a given board square

Returns

None: If the given square is unplayable

Some(Vec): A variable length vector of 1D indices for diagonally adjacent squares. Vector may be between 1 and 4 items long depending on the location of the given square

-

pub fn adjacent_dir(&self, idx: BrdIdx) -> Option<Direction<Square>>[src]

Get a Direction structure for the diagonally adjacent squares of a given board square

+

pub fn adjacent_dir(&self, idx: BrdIdx) -> Option<Direction<Square>>[src]

Get a Direction structure for the diagonally adjacent squares of a given board square

Similar to the Board::adjacent_indices function with differently formatted results

Returns

None: If the given square is unplayable

Some(Direction): A Direction structure for the diagonally adjacent squares.

-

pub fn filter_indices(
    &self,
    idx: BrdIdx,
    player: Team,
    indices: Vec<usize>
) -> Vec<usize>
[src]

Filter an array of diagonal indices (Like those from Board::adjacent_indices, Board::jumpable_indices) for those that are legal for a team’s man, i.e. solely up or down the board

-

pub fn player_adjacent_indices(
    &self,
    idx: BrdIdx,
    player: Team
) -> Option<Vec<usize>>
[src]

pub fn jumpable_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>[src]

Get the 1D array indices for the diagonally jumpable squares of a given board square

+

pub fn filter_indices(
    &self,
    idx: BrdIdx,
    player: Team,
    indices: Vec<usize>
) -> Vec<usize>
[src]

Filter an array of diagonal indices (Like those from Board::adjacent_indices, Board::jumpable_indices) for those that are legal for a team’s man, i.e. solely up or down the board

+

pub fn player_adjacent_indices(
    &self,
    idx: BrdIdx,
    player: Team
) -> Option<Vec<usize>>
[src]

pub fn jumpable_indices(&self, idx: BrdIdx) -> Option<Vec<usize>>[src]

Get the 1D array indices for the diagonally jumpable squares of a given board square

Returns

None: If the given square is unplayable

Some(Vec): A variable length vector of 1D indices for diagonally jumpable squares. Vector may be between 1 and 4 items long depending on the location of the given square

-

pub fn jumpable_dir(&self, idx: BrdIdx) -> Option<Direction<Square>>[src]

Get a Direction structure for the diagonally jumpable squares of a given board square

+

pub fn jumpable_dir(&self, idx: BrdIdx) -> Option<Direction<Square>>[src]

Get a Direction structure for the diagonally jumpable squares of a given board square

Similar to the Board::jumpable_indices function with differently formatted results

Returns

None: If the given square is unplayable

Some(Direction): A Direction structure for the diagonally jumpable squares.

-

pub fn player_jumpable_indices(
    &self,
    idx: BrdIdx,
    player: Team
) -> Option<Vec<usize>>
[src]

pub fn idx_diffs(from: BrdIdx, to: BrdIdx) -> (isize, isize)[src]

Get the difference between two BrdIdx objects

-

impl Board[src]

pub fn cell(&self, idx: usize) -> Square[src]

Get a copy of a board square by 1D array index

-

pub fn set_cell(&mut self, idx: usize, square: Square)[src]

Get a copy of a board square by 1D array index

-

pub fn grid_cell(&self, idx: BrdIdx) -> Square[src]

Get a copy of a board square by 2D BrdIdx index

-

pub fn cell_index(&self, row: usize, col: usize) -> usize[src]

Transform a 2D row/column board index into a single 1D index for use with Board::cells

-

pub fn cell_idx(&self, idx: BrdIdx) -> usize[src]

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

-

pub fn board_index(&self, idx: usize) -> BrdIdx[src]

Transform a 1D array index (for Board::cells) into a 2D game board index (by row/col)

-

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

Check whether a move given by source and destination indices is legal

-

pub fn validate_man_move(
    &self,
    from: BrdIdx,
    to: BrdIdx,
    from_square_occupant: Piece
) -> Moveable
[src]

pub fn validate_king_move(
    &self,
    from: BrdIdx,
    to: BrdIdx,
    from_square_occupant: Piece
) -> Moveable
[src]

pub fn jumpee_idx(&self, from: BrdIdx, to: BrdIdx) -> usize[src]

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

Get a pointer to the backing array of board squares, Board::cells

-

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

Get the number of board squares

-

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

Get the number of remaining pieces

-

pub fn num_player(&self, team: Team) -> usize[src]

Get the number of remaining pieces for a player

-

pub fn score(&self) -> isize[src]

Get the score value, Black - White pieces

-

pub fn cell_state(&self, idx: usize) -> SquareState[src]

Get the state of a board square by 1D array index

-

pub fn apply_move(&self, from: BrdIdx, to: BrdIdx) -> Board[src]

pub fn apply_jump(&self, from: BrdIdx, to: BrdIdx) -> Board[src]

impl Board[src]

pub fn validate_jumpee(jumpee: Square, from_occ: Piece) -> Moveable[src]

Unwrap the jumpee piece from the square and Board::check_jumpee_team with Moveable response

-

pub fn check_jumpee_team(from: Piece, jumpee: Piece) -> bool[src]

Check that the source piece and the jumpee are of opposing teams

-

pub fn new(width: usize, height: usize, current_turn: Team) -> Board[src]

Initialise a game board without game pieces

-

pub fn init_game(board: Board, piece_rows: usize) -> Board[src]

Reset the given board to a starting layout with 3 rows of opposing pieces

-

Trait Implementations

impl Clone for Board[src]

pub fn player_jumpable_indices(
    &self,
    idx: BrdIdx,
    player: Team
) -> Option<Vec<usize>>
[src]

pub fn idx_diffs(from: BrdIdx, to: BrdIdx) -> (isize, isize)[src]

Get the difference between two BrdIdx objects

+

impl Board[src]

pub fn cell(&self, idx: usize) -> Square[src]

Get a copy of a board square by 1D array index

+

pub fn set_cell(&mut self, idx: usize, square: Square)[src]

Get a copy of a board square by 1D array index

+

pub fn grid_cell(&self, idx: BrdIdx) -> Square[src]

Get a copy of a board square by 2D BrdIdx index

+

pub fn cell_index(&self, row: usize, col: usize) -> usize[src]

Transform a 2D row/column board index into a single 1D index for use with Board::cells

+

pub fn cell_idx(&self, idx: BrdIdx) -> usize[src]

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

+

pub fn board_index(&self, idx: usize) -> BrdIdx[src]

Transform a 1D array index (for Board::cells) into a 2D game board index (by row/col)

+

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

Check whether a move given by source and destination indices is legal

+

pub fn validate_man_move(
    &self,
    from: BrdIdx,
    to: BrdIdx,
    from_square_occupant: Piece
) -> Moveable
[src]

pub fn validate_king_move(
    &self,
    from: BrdIdx,
    to: BrdIdx,
    from_square_occupant: Piece
) -> Moveable
[src]

pub fn jumpee_idx(&self, from: BrdIdx, to: BrdIdx) -> usize[src]

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

Get a pointer to the backing array of board squares, Board::cells

+

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

Get the number of board squares

+

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

Get the number of remaining pieces

+

pub fn num_player(&self, team: Team) -> usize[src]

Get the number of remaining pieces for a player

+

pub fn score(&self) -> isize[src]

Get the score value, Black - White pieces

+

pub fn cell_state(&self, idx: usize) -> SquareState[src]

Get the state of a board square by 1D array index

+

pub fn apply_move(&self, from: BrdIdx, to: BrdIdx) -> Board[src]

pub fn apply_jump(&self, from: BrdIdx, to: BrdIdx) -> Board[src]

impl Board[src]

pub fn validate_jumpee(jumpee: Square, from_occ: Piece) -> Moveable[src]

Unwrap the jumpee piece from the square and Board::check_jumpee_team with Moveable response

+

pub fn check_jumpee_team(from: Piece, jumpee: Piece) -> bool[src]

Check that the source piece and the jumpee are of opposing teams

+

pub fn new(width: usize, height: usize, current_turn: Team) -> Board[src]

Initialise a game board without game pieces

+

pub fn init_game(board: Board, piece_rows: usize) -> Board[src]

Reset the given board to a starting layout with 3 rows of opposing pieces

+

Trait Implementations

impl Clone for Board[src]

impl Debug for Board[src]

impl Display for Board[src]

impl From<Board> for JsValue[src]

impl FromWasmAbi for Board[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the +

impl Debug for Board[src]

impl Display for Board[src]

impl From<Board> for JsValue[src]

impl FromWasmAbi for Board[src]

type Abi = u32

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

-

impl IntoWasmAbi for Board[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI +

impl IntoWasmAbi for Board[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

-

impl OptionFromWasmAbi for Board[src]

impl OptionFromWasmAbi for Board[src]

impl OptionIntoWasmAbi for Board[src]

impl OptionIntoWasmAbi for Board[src]

impl PartialEq<Board> for Board[src]

impl PartialEq<Board> for Board[src]

impl RefFromWasmAbi for Board[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

+

impl RefFromWasmAbi for Board[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

type Anchor = Ref<'static, Board>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more

-

impl RefMutFromWasmAbi for Board[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

+

impl RefMutFromWasmAbi for Board[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

type Anchor = RefMut<'static, Board>

Same as RefFromWasmAbi::Anchor

-

impl WasmDescribe for Board[src]

impl Eq for Board[src]

impl StructuralEq for Board[src]

impl StructuralPartialEq for Board[src]

Auto Trait Implementations

impl RefUnwindSafe for Board

impl Send for Board

impl Sync for Board

impl Unpin for Board

impl UnwindSafe for Board

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl WasmDescribe for Board[src]

impl Eq for Board[src]

impl StructuralEq for Board[src]

impl StructuralPartialEq for Board[src]

Auto Trait Implementations

impl RefUnwindSafe for Board

impl Send for Board

impl Sync for Board

impl Unpin for Board

impl UnwindSafe for Board

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

game

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

+
paint

Components for painting board states onto HTML canvases

+
player
utils

Macros

log

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

Functions

__wasm_bindgen_generated_init_game
init_game
diff --git a/doc/draught/macro.log.html b/doc/draught/macro.log.html index 45b244a..ff9b4fa 100644 --- a/doc/draught/macro.log.html +++ b/doc/draught/macro.log.html @@ -1,7 +1,7 @@ log in draught - Rust

Macro draught::log[][src]

+                Change settings

Macro draught::log[][src]

 macro_rules! log {
     ( $( $t:tt )* ) => { ... };
 }
diff --git a/doc/draught/paint/constant.BLACK_PIECE.html b/doc/draught/paint/constant.BLACK_PIECE.html new file mode 100644 index 0000000..1151a30 --- /dev/null +++ b/doc/draught/paint/constant.BLACK_PIECE.html @@ -0,0 +1,6 @@ +BLACK_PIECE in draught::paint - Rust + +

Constant draught::paint::BLACK_PIECE[][src]

const BLACK_PIECE: &str = "#ed0000";

Default hex colour value for black pieces

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

Constant draught::paint::BLACK_PIECE_OUTLINE[][src]

const BLACK_PIECE_OUTLINE: &str = "#a60000";

Default hex colour value for black piece outline

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

Constant draught::paint::BLACK_SQUARE[][src]

const BLACK_SQUARE: &str = "#000000";

Default hex colour value for black square background

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

Constant draught::paint::DRAW_OUTLINE[][src]

const DRAW_OUTLINE: bool = true;

Whether to outline black squares

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

Constant draught::paint::DRAW_PIECE_OUTLINES[][src]

const DRAW_PIECE_OUTLINES: bool = true;

Whether to outline pieces

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

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

const OUTLINE_WIDTH: f64 = 3.0;

Line width when outlining black squares

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

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

const PIECE_MARGIN: f64 = 10.0;

Margin from square to define piece radius

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

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

const PIECE_OUTLINE_WIDTH: f64 = 3.0;

Line width for outlining pieces

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

Constant draught::paint::SQUARE_OUTLINE[][src]

const SQUARE_OUTLINE: &str = "#9c9c9c";

Default hex colour value for outline of black squares

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

Constant draught::paint::WHITE_PIECE[][src]

const WHITE_PIECE: &str = "#dbdbdb";

Default hex colour value for white pieces

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

Constant draught::paint::WHITE_PIECE_OUTLINE[][src]

const WHITE_PIECE_OUTLINE: &str = "#9c9c9c";

Default hex colour value for white piece outline

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

Constant draught::paint::WHITE_SQUARE[][src]

const WHITE_SQUARE: &str = "#FFFFFF";

Default hex colour value for white square background

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

Module draught::paint[][src]

Components for painting board states onto HTML canvases

+

Structs

+
Painter

Used to paint boards onto HTML canvases

+

Constants

+
BLACK_PIECE

Default hex colour value for black pieces

+
BLACK_PIECE_OUTLINE

Default hex colour value for black piece outline

+
BLACK_SQUARE

Default hex colour value for black square background

+
DRAW_OUTLINE

Whether to outline black squares

+
DRAW_PIECE_OUTLINES

Whether to outline pieces

+
OUTLINE_WIDTH

Line width when outlining black squares

+
PIECE_MARGIN

Margin from square to define piece radius

+
PIECE_OUTLINE_WIDTH

Line width for outlining pieces

+
SQUARE_OUTLINE

Default hex colour value for outline of black squares

+
WHITE_PIECE

Default hex colour value for white pieces

+
WHITE_PIECE_OUTLINE

Default hex colour value for white piece outline

+
WHITE_SQUARE

Default hex colour value for white square background

+
+ \ No newline at end of file diff --git a/doc/draught/paint/sidebar-items.js b/doc/draught/paint/sidebar-items.js new file mode 100644 index 0000000..221623c --- /dev/null +++ b/doc/draught/paint/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["BLACK_PIECE","Default hex colour value for black pieces"],["BLACK_PIECE_OUTLINE","Default hex colour value for black piece outline"],["BLACK_SQUARE","Default hex colour value for black square background"],["DRAW_OUTLINE","Whether to outline black squares"],["DRAW_PIECE_OUTLINES","Whether to outline pieces"],["OUTLINE_WIDTH","Line width when outlining black squares"],["PIECE_MARGIN","Margin from square to define piece radius"],["PIECE_OUTLINE_WIDTH","Line width for outlining pieces"],["SQUARE_OUTLINE","Default hex colour value for outline of black squares"],["WHITE_PIECE","Default hex colour value for white pieces"],["WHITE_PIECE_OUTLINE","Default hex colour value for white piece outline"],["WHITE_SQUARE","Default hex colour value for white square background"]],"struct":[["Painter","Used to paint boards onto HTML canvases"]]}); \ No newline at end of file diff --git a/doc/draught/paint/struct.Painter.html b/doc/draught/paint/struct.Painter.html new file mode 100644 index 0000000..bde2f35 --- /dev/null +++ b/doc/draught/paint/struct.Painter.html @@ -0,0 +1,68 @@ +Painter in draught::paint - Rust + +

Struct draught::paint::Painter[][src]

pub struct Painter {
Show fields + canvas: HtmlCanvasElement, + context: CanvasRenderingContext2d, + white_square: JsValue, + black_square: JsValue, + white_piece: JsValue, + black_piece: JsValue, + white_piece_line: JsValue, + black_piece_line: JsValue, + piece_lines: bool, + piece_line_width: f64, + square_outline: JsValue, + outline_width: f64, + draw_outline: bool, + width: u32, + height: u32, +
}

Used to paint boards onto HTML canvases

+

+ Fields

canvas: HtmlCanvasElementcontext: CanvasRenderingContext2dwhite_square: JsValueblack_square: JsValuewhite_piece: JsValueblack_piece: JsValuewhite_piece_line: JsValueblack_piece_line: JsValuepiece_lines: boolpiece_line_width: f64square_outline: JsValueoutline_width: f64draw_outline: boolwidth: u32height: u32

Implementations

impl Painter[src]

fn get_canvas(canvas_id: &str) -> HtmlCanvasElement[src]

Get a canvas by element ID

+

fn get_canvas_context(canvas: &HtmlCanvasElement) -> CanvasRenderingContext2d[src]

Get a 2D canvas context for a given canvas

+

impl Painter[src]

pub fn new(width: u32, height: u32, canvas_id: &str) -> Painter[src]

Default constructor which queries for canvas by ID

+

pub fn new_with_canvas(
    width: u32,
    height: u32,
    canvas: HtmlCanvasElement
) -> Painter
[src]

Constructor with given canvas element

+

pub fn set_square_outline(&mut self, value: JsValue)[src]

Set new square outline colour value

+

pub fn set_outline_width(&mut self, value: f64)[src]

Set new line width for outlining squares

+

pub fn set_draw_outline(&mut self, value: bool)[src]

Set whether squares are outlined

+

pub fn reset_dimensions(&self)[src]

Reset the canvas dimensions to the given width and height

+

pub fn validate_board_dim(&self, board: &Board) -> bool[src]

Check whether given canvas dimensions divide evenly by given board dimenions

+

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

Draw a board onto the canvas

+

Trait Implementations

impl Debug for Painter[src]

impl From<Painter> for JsValue[src]

impl FromWasmAbi for Painter[src]

type Abi = u32

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

+

impl IntoWasmAbi for Painter[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI +boundary. Read more

+

impl OptionFromWasmAbi for Painter[src]

impl OptionIntoWasmAbi for Painter[src]

impl RefFromWasmAbi for Painter[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

+

type Anchor = Ref<'static, Painter>

The type that holds the reference to Self for the duration of the +invocation of the function that has an &Self parameter. This is +required to ensure that the lifetimes don’t persist beyond one function +call, and so that they remain anonymous. Read more

+

impl RefMutFromWasmAbi for Painter[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

+

type Anchor = RefMut<'static, Painter>

Same as RefFromWasmAbi::Anchor

+

impl WasmDescribe for Painter[src]

Auto Trait Implementations

impl RefUnwindSafe for Painter

impl !Send for Painter

impl !Sync for Painter

impl Unpin for Painter

impl UnwindSafe for Painter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/doc/draught/sidebar-items.js b/doc/draught/sidebar-items.js index 01f2509..afc1276 100644 --- a/doc/draught/sidebar-items.js +++ b/doc/draught/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["__wasm_bindgen_generated_init_game",""],["init_game",""]],"macro":[["log","Wrap the [`web_sys`] access to the browser console in a macro for easy logging"]],"mod":[["board","Board module for components related to the checkers board and game structure"],["comp","AI player logic"],["game",""],["player",""],["utils",""]]}); \ No newline at end of file +initSidebarItems({"fn":[["__wasm_bindgen_generated_init_game",""],["init_game",""]],"macro":[["log","Wrap the [`web_sys`] access to the browser console in a macro for easy logging"]],"mod":[["board","Board module for components related to the checkers board and game structure"],["comp","AI player logic"],["game","Top-level object for managing [`Board`]s, applying and managing turns"],["paint","Components for painting board states onto HTML canvases"],["player",""],["utils",""]]}); \ No newline at end of file diff --git a/doc/implementors/core/convert/trait.From.js b/doc/implementors/core/convert/trait.From.js index e2cdf14..9dd444d 100644 --- a/doc/implementors/core/convert/trait.From.js +++ b/doc/implementors/core/convert/trait.From.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl From<Piece> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Square> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<BrdIdx> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Board> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Game> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Player> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]}]; +implementors["draught"] = [{"text":"impl From<Piece> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Square> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<BrdIdx> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Board> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Game> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Player> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]},{"text":"impl From<Painter> for JsValue","synthetic":false,"types":["wasm_bindgen::JsValue"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/core/fmt/trait.Debug.js b/doc/implementors/core/fmt/trait.Debug.js index e76e674..36091ce 100644 --- a/doc/implementors/core/fmt/trait.Debug.js +++ b/doc/implementors/core/fmt/trait.Debug.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl Debug for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl Debug for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl Debug for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl Debug for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl Debug for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl Debug for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl<T: Debug + Clone + Copy> Debug for Direction<T>","synthetic":false,"types":["draught::board::Direction"]},{"text":"impl Debug for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl Debug for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl Debug for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl Debug for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl Debug for Move","synthetic":false,"types":["draught::comp::Move"]},{"text":"impl Debug for Computer","synthetic":false,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl Debug for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl Debug for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl Debug for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl Debug for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl Debug for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl Debug for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl<T: Debug + Clone + Copy> Debug for Direction<T>","synthetic":false,"types":["draught::board::Direction"]},{"text":"impl Debug for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl Debug for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl Debug for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl Debug for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl Debug for Painter","synthetic":false,"types":["draught::paint::Painter"]},{"text":"impl Debug for Move","synthetic":false,"types":["draught::comp::Move"]},{"text":"impl Debug for Computer","synthetic":false,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/core/marker/trait.Freeze.js b/doc/implementors/core/marker/trait.Freeze.js index c26c89d..2a32f9e 100644 --- a/doc/implementors/core/marker/trait.Freeze.js +++ b/doc/implementors/core/marker/trait.Freeze.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl Freeze for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Freeze for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Freeze for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Freeze for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Freeze for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Freeze for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Freeze for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Freeze for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Freeze for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Freeze for Direction<T> where
    T: Freeze
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Freeze for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Freeze for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Freeze for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl Freeze for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Freeze for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl Freeze for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Freeze for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl Freeze for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Freeze for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Freeze for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Freeze for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Freeze for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Freeze for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Freeze for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Freeze for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Freeze for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Freeze for Direction<T> where
    T: Freeze
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Freeze for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Freeze for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Freeze for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl Freeze for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Freeze for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl Freeze for Painter","synthetic":true,"types":["draught::paint::Painter"]},{"text":"impl Freeze for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Freeze for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/core/marker/trait.Send.js b/doc/implementors/core/marker/trait.Send.js index 6bbba49..84ef80a 100644 --- a/doc/implementors/core/marker/trait.Send.js +++ b/doc/implementors/core/marker/trait.Send.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl Send for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Send for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Send for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Send for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Send for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Send for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Send for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Send for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Send for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Send for Direction<T> where
    T: Send
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Send for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Send for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Send for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl Send for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Send for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl Send for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Send for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl Send for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Send for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Send for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Send for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Send for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Send for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Send for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Send for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Send for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Send for Direction<T> where
    T: Send
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Send for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Send for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Send for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl !Send for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Send for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl !Send for Painter","synthetic":true,"types":["draught::paint::Painter"]},{"text":"impl Send for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Send for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/core/marker/trait.Sync.js b/doc/implementors/core/marker/trait.Sync.js index 8484a8d..8f15e1b 100644 --- a/doc/implementors/core/marker/trait.Sync.js +++ b/doc/implementors/core/marker/trait.Sync.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl Sync for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Sync for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Sync for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Sync for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Sync for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Sync for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Sync for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Sync for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Sync for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Sync for Direction<T> where
    T: Sync
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Sync for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Sync for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Sync for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl Sync for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Sync for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl Sync for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Sync for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl Sync for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Sync for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Sync for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Sync for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Sync for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Sync for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Sync for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Sync for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Sync for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Sync for Direction<T> where
    T: Sync
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Sync for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Sync for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Sync for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl !Sync for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Sync for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl !Sync for Painter","synthetic":true,"types":["draught::paint::Painter"]},{"text":"impl Sync for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Sync for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/core/marker/trait.Unpin.js b/doc/implementors/core/marker/trait.Unpin.js index 366067a..7f7af6b 100644 --- a/doc/implementors/core/marker/trait.Unpin.js +++ b/doc/implementors/core/marker/trait.Unpin.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl Unpin for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Unpin for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Unpin for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Unpin for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Unpin for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Unpin for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Unpin for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Unpin for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Unpin for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Unpin for Direction<T> where
    T: Unpin
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Unpin for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Unpin for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Unpin for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl Unpin for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Unpin for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl Unpin for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Unpin for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl Unpin for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl Unpin for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl Unpin for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl Unpin for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl Unpin for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> Unpin for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> Unpin for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> Unpin for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl Unpin for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> Unpin for Direction<T> where
    T: Unpin
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl Unpin for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl Unpin for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl Unpin for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl Unpin for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl Unpin for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl Unpin for Painter","synthetic":true,"types":["draught::paint::Painter"]},{"text":"impl Unpin for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl Unpin for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/std/panic/trait.RefUnwindSafe.js b/doc/implementors/std/panic/trait.RefUnwindSafe.js index 4702d17..632c72f 100644 --- a/doc/implementors/std/panic/trait.RefUnwindSafe.js +++ b/doc/implementors/std/panic/trait.RefUnwindSafe.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl RefUnwindSafe for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl RefUnwindSafe for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl RefUnwindSafe for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl RefUnwindSafe for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl RefUnwindSafe for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> RefUnwindSafe for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> RefUnwindSafe for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> RefUnwindSafe for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl RefUnwindSafe for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> RefUnwindSafe for Direction<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl RefUnwindSafe for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl RefUnwindSafe for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl RefUnwindSafe for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl RefUnwindSafe for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl RefUnwindSafe for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl RefUnwindSafe for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl RefUnwindSafe for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl RefUnwindSafe for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl RefUnwindSafe for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl RefUnwindSafe for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl RefUnwindSafe for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl RefUnwindSafe for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> RefUnwindSafe for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> RefUnwindSafe for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> RefUnwindSafe for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl RefUnwindSafe for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> RefUnwindSafe for Direction<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl RefUnwindSafe for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl RefUnwindSafe for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl RefUnwindSafe for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl RefUnwindSafe for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl RefUnwindSafe for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl RefUnwindSafe for Painter","synthetic":true,"types":["draught::paint::Painter"]},{"text":"impl RefUnwindSafe for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl RefUnwindSafe for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/std/panic/trait.UnwindSafe.js b/doc/implementors/std/panic/trait.UnwindSafe.js index db83070..dcfe953 100644 --- a/doc/implementors/std/panic/trait.UnwindSafe.js +++ b/doc/implementors/std/panic/trait.UnwindSafe.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl UnwindSafe for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl UnwindSafe for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl UnwindSafe for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl UnwindSafe for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl UnwindSafe for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> UnwindSafe for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> UnwindSafe for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> UnwindSafe for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl UnwindSafe for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> UnwindSafe for Direction<T> where
    T: UnwindSafe
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl UnwindSafe for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl UnwindSafe for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl UnwindSafe for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl UnwindSafe for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl UnwindSafe for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl UnwindSafe for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl UnwindSafe for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; +implementors["draught"] = [{"text":"impl UnwindSafe for MoveType","synthetic":true,"types":["draught::board::enums::MoveType"]},{"text":"impl UnwindSafe for Team","synthetic":true,"types":["draught::board::enums::Team"]},{"text":"impl UnwindSafe for Strength","synthetic":true,"types":["draught::board::enums::Strength"]},{"text":"impl UnwindSafe for SquareState","synthetic":true,"types":["draught::board::enums::SquareState"]},{"text":"impl UnwindSafe for Moveable","synthetic":true,"types":["draught::board::enums::Moveable"]},{"text":"impl<'a> UnwindSafe for RowIndexIterator<'a>","synthetic":true,"types":["draught::board::iter::RowIndexIterator"]},{"text":"impl<'a> UnwindSafe for RowSquareIterator<'a>","synthetic":true,"types":["draught::board::iter::RowSquareIterator"]},{"text":"impl<'a> UnwindSafe for PieceIterator<'a>","synthetic":true,"types":["draught::board::iter::PieceIterator"]},{"text":"impl UnwindSafe for Piece","synthetic":true,"types":["draught::board::Piece"]},{"text":"impl<T> UnwindSafe for Direction<T> where
    T: UnwindSafe
","synthetic":true,"types":["draught::board::Direction"]},{"text":"impl UnwindSafe for Square","synthetic":true,"types":["draught::board::Square"]},{"text":"impl UnwindSafe for BrdIdx","synthetic":true,"types":["draught::board::BrdIdx"]},{"text":"impl UnwindSafe for Board","synthetic":true,"types":["draught::board::Board"]},{"text":"impl UnwindSafe for Game","synthetic":true,"types":["draught::game::Game"]},{"text":"impl UnwindSafe for Player","synthetic":true,"types":["draught::player::Player"]},{"text":"impl UnwindSafe for Painter","synthetic":true,"types":["draught::paint::Painter"]},{"text":"impl UnwindSafe for Move","synthetic":true,"types":["draught::comp::Move"]},{"text":"impl UnwindSafe for Computer","synthetic":true,"types":["draught::comp::Computer"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/convert/traits/trait.FromWasmAbi.js b/doc/implementors/wasm_bindgen/convert/traits/trait.FromWasmAbi.js index 768fb4c..3b0dc79 100644 --- a/doc/implementors/wasm_bindgen/convert/traits/trait.FromWasmAbi.js +++ b/doc/implementors/wasm_bindgen/convert/traits/trait.FromWasmAbi.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl FromWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl FromWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl FromWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl FromWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl FromWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl FromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl FromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl FromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl FromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl FromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl FromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl FromWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl FromWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl FromWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl FromWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl FromWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl FromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl FromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl FromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl FromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl FromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl FromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl FromWasmAbi for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/convert/traits/trait.IntoWasmAbi.js b/doc/implementors/wasm_bindgen/convert/traits/trait.IntoWasmAbi.js index 926931b..8f1d2b6 100644 --- a/doc/implementors/wasm_bindgen/convert/traits/trait.IntoWasmAbi.js +++ b/doc/implementors/wasm_bindgen/convert/traits/trait.IntoWasmAbi.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl IntoWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl IntoWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl IntoWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl IntoWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl IntoWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl IntoWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl IntoWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl IntoWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl IntoWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl IntoWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl IntoWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl IntoWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl IntoWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl IntoWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl IntoWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl IntoWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl IntoWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl IntoWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl IntoWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl IntoWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl IntoWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl IntoWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl IntoWasmAbi for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/convert/traits/trait.OptionFromWasmAbi.js b/doc/implementors/wasm_bindgen/convert/traits/trait.OptionFromWasmAbi.js index cc57103..5f34c8f 100644 --- a/doc/implementors/wasm_bindgen/convert/traits/trait.OptionFromWasmAbi.js +++ b/doc/implementors/wasm_bindgen/convert/traits/trait.OptionFromWasmAbi.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl OptionFromWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl OptionFromWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl OptionFromWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl OptionFromWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl OptionFromWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl OptionFromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl OptionFromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl OptionFromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl OptionFromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl OptionFromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl OptionFromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl OptionFromWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl OptionFromWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl OptionFromWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl OptionFromWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl OptionFromWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl OptionFromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl OptionFromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl OptionFromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl OptionFromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl OptionFromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl OptionFromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl OptionFromWasmAbi for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/convert/traits/trait.OptionIntoWasmAbi.js b/doc/implementors/wasm_bindgen/convert/traits/trait.OptionIntoWasmAbi.js index 05c62a3..2119014 100644 --- a/doc/implementors/wasm_bindgen/convert/traits/trait.OptionIntoWasmAbi.js +++ b/doc/implementors/wasm_bindgen/convert/traits/trait.OptionIntoWasmAbi.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl OptionIntoWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl OptionIntoWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl OptionIntoWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl OptionIntoWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl OptionIntoWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl OptionIntoWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl OptionIntoWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl OptionIntoWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl OptionIntoWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl OptionIntoWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl OptionIntoWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl OptionIntoWasmAbi for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl OptionIntoWasmAbi for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl OptionIntoWasmAbi for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl OptionIntoWasmAbi for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl OptionIntoWasmAbi for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl OptionIntoWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl OptionIntoWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl OptionIntoWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl OptionIntoWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl OptionIntoWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl OptionIntoWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl OptionIntoWasmAbi for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/convert/traits/trait.RefFromWasmAbi.js b/doc/implementors/wasm_bindgen/convert/traits/trait.RefFromWasmAbi.js index 481b41a..680bb58 100644 --- a/doc/implementors/wasm_bindgen/convert/traits/trait.RefFromWasmAbi.js +++ b/doc/implementors/wasm_bindgen/convert/traits/trait.RefFromWasmAbi.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl RefFromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl RefFromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl RefFromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl RefFromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl RefFromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl RefFromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl RefFromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl RefFromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl RefFromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl RefFromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl RefFromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl RefFromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl RefFromWasmAbi for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/convert/traits/trait.RefMutFromWasmAbi.js b/doc/implementors/wasm_bindgen/convert/traits/trait.RefMutFromWasmAbi.js index e585919..5a9912d 100644 --- a/doc/implementors/wasm_bindgen/convert/traits/trait.RefMutFromWasmAbi.js +++ b/doc/implementors/wasm_bindgen/convert/traits/trait.RefMutFromWasmAbi.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl RefMutFromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl RefMutFromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl RefMutFromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl RefMutFromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl RefMutFromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl RefMutFromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl RefMutFromWasmAbi for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl RefMutFromWasmAbi for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl RefMutFromWasmAbi for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl RefMutFromWasmAbi for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl RefMutFromWasmAbi for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl RefMutFromWasmAbi for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl RefMutFromWasmAbi for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/implementors/wasm_bindgen/describe/trait.WasmDescribe.js b/doc/implementors/wasm_bindgen/describe/trait.WasmDescribe.js index ffad111..a30a6c5 100644 --- a/doc/implementors/wasm_bindgen/describe/trait.WasmDescribe.js +++ b/doc/implementors/wasm_bindgen/describe/trait.WasmDescribe.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["draught"] = [{"text":"impl WasmDescribe for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl WasmDescribe for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl WasmDescribe for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl WasmDescribe for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl WasmDescribe for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl WasmDescribe for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl WasmDescribe for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl WasmDescribe for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl WasmDescribe for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl WasmDescribe for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl WasmDescribe for Player","synthetic":false,"types":["draught::player::Player"]}]; +implementors["draught"] = [{"text":"impl WasmDescribe for MoveType","synthetic":false,"types":["draught::board::enums::MoveType"]},{"text":"impl WasmDescribe for Team","synthetic":false,"types":["draught::board::enums::Team"]},{"text":"impl WasmDescribe for Strength","synthetic":false,"types":["draught::board::enums::Strength"]},{"text":"impl WasmDescribe for SquareState","synthetic":false,"types":["draught::board::enums::SquareState"]},{"text":"impl WasmDescribe for Moveable","synthetic":false,"types":["draught::board::enums::Moveable"]},{"text":"impl WasmDescribe for Piece","synthetic":false,"types":["draught::board::Piece"]},{"text":"impl WasmDescribe for Square","synthetic":false,"types":["draught::board::Square"]},{"text":"impl WasmDescribe for BrdIdx","synthetic":false,"types":["draught::board::BrdIdx"]},{"text":"impl WasmDescribe for Board","synthetic":false,"types":["draught::board::Board"]},{"text":"impl WasmDescribe for Game","synthetic":false,"types":["draught::game::Game"]},{"text":"impl WasmDescribe for Player","synthetic":false,"types":["draught::player::Player"]},{"text":"impl WasmDescribe for Painter","synthetic":false,"types":["draught::paint::Painter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/doc/search-index.js b/doc/search-index.js index d70bcca..898d4eb 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,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,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,12,11,11,11,11,11,11,11,11,11,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_game","board","comp","game","init_game","log","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","gen_tree","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_turn","describe","execute_jump","execute_move","fmt","fmt","from","from_abi","into","into_abi","is_none","make_move","new","none","previous_board","previous_boards","push_new_board","ref_from_abi","ref_mut_from_abi","return_abi","set_current","to_string","try_from","try_into","type_id","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::player","","","","","","","","","","","","","","","","","","","","draught::utils"],"d":["","Board module for components related to the checkers board …","AI player logic","","","Wrap the [web_sys] access to the browser console in a …","","","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","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","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[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,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,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0],"f":[[[]],null,null,null,[[]],null,null,null,null,null,null,null,null,null,null,[[["brdidx",3]],[["direction",3],["option",4]]],[[["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]],[[["usize",15],["vec",3],["brdidx",3],["team",4]],[["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]]],[[["usize",15],["board",3]],["board",3]],[[]],[[]],[[]],[[]],[[]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["u32",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],[[],["bool",15]],null,[[["brdidx",3]],[["direction",3],["option",4]]],[[["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]],[[["squarestate",4],["option",4],["piece",3]],["square",3]],[[["usize",15],["team",4]],["board",3]],[[]],[[]],[[]],[[]],[[],["usize",15]],[[],["usize",15]],[[["team",4]],["usize",15]],null,null,[[["team",4],["strength",4]],["square",3]],[[["brdidx",3],["team",4]],[["option",4],["vec",3]]],[[["brdidx",3],["team",4]],[["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]]],[[],[["option",4],["vec",3]]],[[],["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]]],[[]],[[["board",3]],[["board",3],["vec",3]]],[[["board",3],["vec",3]],[["vec",3],["nodeid",3]]],[[]],[[]],null,[[["move",3]],["bool",15]],[[["movetype",4],["brdidx",3]],["move",3]],[[["usize",15],["board",3],["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]],[[],["team",4]],[[]],[[["brdidx",3]]],[[["brdidx",3]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[]],[[["u32",15]]],[[]],[[],["u32",15]],[[],["bool",15]],[[["brdidx",3]]],[[["usize",15],["team",4]],["game",3]],[[]],[[["usize",15]],["board",3]],null,[[["board",3]]],[[]],[[]],[[]],[[["board",3]]],[[],["string",3]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],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,"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,3,17,17,17,17,12,12,12,11,11,12,12,11,11,12,11,11,11,11,11,12,11,11,11,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_game","board","comp","game","init_game","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","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","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","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,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]],[[["brdidx",3],["vec",3],["usize",15],["team",4]],[["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]]],[[["usize",15],["board",3]],["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,[[["strength",4],["team",4]],["piece",3]],[[["option",4],["piece",3],["squarestate",4]],["square",3]],[[["usize",15],["team",4]],["board",3]],[[]],[[]],[[]],[[]],[[],["usize",15]],[[],["usize",15]],[[["team",4]],["usize",15]],null,null,[[["strength",4],["team",4]],["square",3]],[[["brdidx",3],["team",4]],[["option",4],["vec",3]]],[[["brdidx",3],["team",4]],[["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]]],[[],[["option",4],["vec",3]]],[[],["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]],[["vec",3],["nodeid",3]]],[[]],[[]],null,[[["move",3]],["bool",15]],[[["brdidx",3],["movetype",4]],["move",3]],[[["usize",15],["board",3],["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]]],[[["usize",15],["team",4]],["game",3]],[[["str",15],["usize",15],["u32",15],["team",4]],["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,[[]],[[["board",3]]],null,[[["formatter",3]],["result",6]],[[]],[[["u32",15]]],[[["str",15]],["htmlcanvaselement",3]],[[["htmlcanvaselement",3]],["canvasrenderingcontext2d",3]],null,[[]],[[],["u32",15]],[[],["bool",15]],[[["u32",15],["str",15]],["painter",3]],[[["u32",15],["htmlcanvaselement",3]],["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/source-files.js b/doc/source-files.js index f856e09..e8c7383 100644 --- a/doc/source-files.js +++ b/doc/source-files.js @@ -1,3 +1,3 @@ var N = null;var sourcesIndex = {}; -sourcesIndex["draught"] = {"name":"","dirs":[{"name":"board","files":["enums.rs","iter.rs","mod.rs"]},{"name":"comp","files":["mod.rs"]},{"name":"game","files":["mod.rs"]}],"files":["lib.rs","player.rs","utils.rs"]}; +sourcesIndex["draught"] = {"name":"","dirs":[{"name":"board","files":["enums.rs","iter.rs","mod.rs"]},{"name":"comp","files":["mod.rs"]},{"name":"game","files":["mod.rs"]}],"files":["lib.rs","paint.rs","player.rs","utils.rs"]}; createSourceSidebar(); diff --git a/doc/src/draught/board/enums.rs.html b/doc/src/draught/board/enums.rs.html index 2be4289..9143762 100644 --- a/doc/src/draught/board/enums.rs.html +++ b/doc/src/draught/board/enums.rs.html @@ -85,7 +85,7 @@ extern crate wasm_bindgen; use wasm_bindgen::prelude::*; -use std::fmt::{Display, Write}; +use std::fmt::{Display}; #[wasm_bindgen] #[repr(u8)] diff --git a/doc/src/draught/board/iter.rs.html b/doc/src/draught/board/iter.rs.html index c3909c7..e76fcd8 100644 --- a/doc/src/draught/board/iter.rs.html +++ b/doc/src/draught/board/iter.rs.html @@ -195,8 +195,9 @@ 192 193 194 +195
-use crate::board::{Board, Piece, Square};
+use crate::board::{Board, Square};
 use crate::board::enums::*;
 
 pub struct RowIndexIterator<'a> {
@@ -302,9 +303,10 @@
 pub mod tests {
     use super::*;
     use crate::board::enums::SquareState;
+    use crate::board::Piece;
     use wasm_bindgen_test::*;
 
-    use crate::log;
+    // use crate::log;
 
     wasm_bindgen_test_configure!(run_in_browser);
 
diff --git a/doc/src/draught/board/mod.rs.html b/doc/src/draught/board/mod.rs.html
index a4389cc..e86a6a0 100644
--- a/doc/src/draught/board/mod.rs.html
+++ b/doc/src/draught/board/mod.rs.html
@@ -796,6 +796,11 @@
 793
 794
 795
+796
+797
+798
+799
+800
 
 //! Board module for components related to the checkers board and game structure
 
@@ -813,6 +818,8 @@
 use std::fmt::{Display, Write};
 use std::option::Option;
 
+use crate::log;
+
 extern crate wasm_bindgen;
 use wasm_bindgen::prelude::*;
 
@@ -918,8 +925,8 @@
 #[wasm_bindgen]
 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
 pub struct BrdIdx {
-    row: usize,
-    col: usize
+    pub row: usize,
+    pub col: usize
 }
 
 #[wasm_bindgen]
@@ -1580,10 +1587,13 @@
             for j in 0..self.width {
                 let idx = self.cell_index(i, j);
 
-                match self.cell_state(idx) {
-                    Empty => { write!(string, "_ "); },
-                    Occupied => { write!(string, "{} ", self.cell(idx).occupant.unwrap().team); },
-                    Unplayable => { write!(string, ". "); },
+                let result = match self.cell_state(idx) {
+                    Empty => write!(string, "_ "),
+                    Occupied => write!(string, "{} ", self.cell(idx).occupant.unwrap().team),
+                    Unplayable => write!(string, ". "),
+                };
+                if let Err(err) = result {
+                    log!("Error printing cell state, ({}, {}), {}", i, j, err);
                 }
             }
             string.push('\n');
diff --git a/doc/src/draught/comp/mod.rs.html b/doc/src/draught/comp/mod.rs.html
index 0388f3c..ca79278 100644
--- a/doc/src/draught/comp/mod.rs.html
+++ b/doc/src/draught/comp/mod.rs.html
@@ -148,25 +148,39 @@
 145
 146
 147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
 
 //! AI player logic
 
-use indextree::{Arena, NodeId, Node};
+use indextree::{Arena, NodeId};
 
 extern crate wasm_bindgen;
-use wasm_bindgen::prelude::*;
+// use wasm_bindgen::prelude::*;
 
-use crate::log;
+// use crate::log;
 
-use crate::board::{Square, Board, BrdIdx};
-use crate::board::enums::{SquareState, MoveType, Moveable, Team, Strength};
+use crate::board::{Board, BrdIdx};
+use crate::board::enums::{MoveType, Moveable, Team};
 use crate::board::iter::{PieceIterator};
 
-use Team::*;
-use Strength::*;
-use SquareState::*;
+// use Team::*;
+// use Strength::*;
+// use SquareState::*;
 
-use std::fmt::{Display, Write};
+// use std::fmt::{Display, Write};
 
 #[cfg(test)] pub mod tests;
 
@@ -267,9 +281,23 @@
         moves
     }
 
-    pub fn gen_tree(&mut self, board: Board) {
+    // pub fn gen_tree(&mut self, tree: &mut Arena<Board>, board: Board) {
 
-    }
+        // let boards = self.get_move_boards(&board);
+
+        // let root_id = vec!(tree.new_node(board));
+        // let ids = self.insert_boards(boards);
+
+        // for d in 0..self.search_depth {
+
+        //     for root in root_id.iter(){
+        //         for id in ids.into_iter() {
+        //             root.append(id, tree);
+        //         }
+        //     }
+        // }
+
+    // }
 
     pub fn insert_boards(&mut self, boards: Vec<Board>) -> Vec<NodeId> {
         
diff --git a/doc/src/draught/game/mod.rs.html b/doc/src/draught/game/mod.rs.html
index 07d2bf4..2d4fb59 100644
--- a/doc/src/draught/game/mod.rs.html
+++ b/doc/src/draught/game/mod.rs.html
@@ -106,7 +106,47 @@
 103
 104
 105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
 
+//! Top-level object for managing [`Board`]s, applying and managing turns
+
 use crate::board::Board;
 
 extern crate wasm_bindgen;
@@ -115,12 +155,13 @@
 use crate::log;
 
 use crate::board::{Square, BrdIdx};
-use crate::board::enums::{SquareState, Moveable, Team};
+use crate::board::enums::{Moveable, Team};
+use crate::paint::Painter;
 
-use Team::*;
-use SquareState::*;
+// use Team::*;
+// use SquareState::*;
 
-use std::fmt::{Display, Write};
+use std::fmt::{Display};
 
 #[cfg(test)] pub mod tests;
 
@@ -130,6 +171,7 @@
 pub struct Game {
     current: Board,
     previous_boards: Vec<Board>,
+    painter: Option<Painter>
 }
 
 impl Game {
@@ -146,6 +188,16 @@
 
 #[wasm_bindgen]
 impl Game {
+    /// Get pointer to current board's squares
+    pub fn current_board_cells(&self) -> *const Square {
+        self.current.cells()
+    }
+
+    /// Get pointer to current board's squares
+    pub fn current_board_len(&self) -> usize {
+        self.current.num_cells()
+    }
+
     /// Current turn's team
     pub fn current_turn(&self) -> Team {
         self.current.current_turn
@@ -203,6 +255,30 @@
                 Board::new(width, height, first_turn), piece_rows,
             ),
             previous_boards: Vec::with_capacity(10),
+            painter: None,
+        }
+    }
+
+    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 {
+        Game {
+            current: Board::init_game(
+                Board::new(width, height, first_turn), piece_rows,
+            ),
+            previous_boards: Vec::with_capacity(10),
+            painter: Some(
+                Painter::new(canvas_width, canvas_height, canvas_id)
+            ),
+        }
+    }
+
+    pub fn set_painter(&mut self, value: Painter) {
+        self.painter = Some(value);
+    }
+
+    pub fn draw(&self) {
+        match &self.painter {
+            Some(p) => p.draw(&self.current),
+            None => log!("No painter to draw board with")
         }
     }
 }
@@ -211,6 +287,7 @@
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result{
         write!(f, "{}", self.current)
     }
-}
+} +
\ No newline at end of file diff --git a/doc/src/draught/lib.rs.html b/doc/src/draught/lib.rs.html index f09b94e..ac980a4 100644 --- a/doc/src/draught/lib.rs.html +++ b/doc/src/draught/lib.rs.html @@ -48,6 +48,7 @@ pub mod utils; pub mod game; pub mod player; +pub mod paint; pub mod comp; extern crate wasm_bindgen; @@ -55,6 +56,8 @@ pub use board::Board; pub use game::Game; +pub use comp::Computer; +pub use paint::Painter; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. @@ -72,11 +75,8 @@ #[wasm_bindgen] pub fn init_game() { - log!("initialising wasm"); + log!("Initialising WebAssembly"); utils::set_panic_hook(); - - #[cfg(feature = "random_init")] - log!("random layout enabled"); }
\ No newline at end of file diff --git a/doc/src/draught/paint.rs.html b/doc/src/draught/paint.rs.html new file mode 100644 index 0000000..aee2c20 --- /dev/null +++ b/doc/src/draught/paint.rs.html @@ -0,0 +1,666 @@ +paint.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+
+//! Components for painting board states onto HTML canvases
+ 
+extern crate wasm_bindgen;
+use wasm_bindgen::prelude::*;
+use wasm_bindgen::{JsCast, JsValue};
+
+use web_sys::HtmlCanvasElement;
+use web_sys::CanvasRenderingContext2d;
+
+use std::f64;
+
+use crate::log;
+use crate::board::{Board};
+use crate::board::iter::PieceIterator;
+
+use crate::board::enums::Team::*;
+
+/// Default hex colour value for white square background
+const WHITE_SQUARE: &str = "#FFFFFF";
+/// Default hex colour value for black square background
+const BLACK_SQUARE: &str = "#000000";
+
+/// Default hex colour value for outline of black squares
+const SQUARE_OUTLINE: &str = "#9c9c9c";
+/// Line width when outlining black squares
+const OUTLINE_WIDTH: f64 = 3.0;
+/// Whether to outline black squares
+const DRAW_OUTLINE: bool = true;
+
+/// Default hex colour value for white pieces
+const WHITE_PIECE: &str = "#dbdbdb";
+/// Default hex colour value for black pieces
+const BLACK_PIECE: &str = "#ed0000";
+
+/// Default hex colour value for white piece outline
+const WHITE_PIECE_OUTLINE: &str = "#9c9c9c";
+/// Default hex colour value for black piece outline
+const BLACK_PIECE_OUTLINE: &str = "#a60000";
+/// Whether to outline pieces
+const DRAW_PIECE_OUTLINES: bool = true;
+/// Line width for outlining pieces
+const PIECE_OUTLINE_WIDTH: f64 = 3.0;
+
+/// Margin from square to define piece radius
+const PIECE_MARGIN: f64 = 10.0;
+
+/// Used to paint boards onto HTML canvases
+#[wasm_bindgen]
+#[derive(Debug)]
+pub struct Painter {
+    canvas: HtmlCanvasElement,
+    context: CanvasRenderingContext2d,
+
+    white_square: JsValue,
+    black_square: JsValue,
+
+    white_piece: JsValue,
+    black_piece: JsValue,
+
+    white_piece_line: JsValue,
+    black_piece_line: JsValue,
+
+    piece_lines: bool,
+    piece_line_width: f64,
+
+    square_outline: JsValue,
+    outline_width: f64,
+    draw_outline: bool,
+
+    width: u32,
+    height: u32,
+}
+
+impl Painter {
+    /// Get a canvas by element ID
+    fn get_canvas(canvas_id: &str) -> HtmlCanvasElement {
+        // JS WINDOW
+        let window = match web_sys::window(){
+            Some(win) => win,
+            None => panic!("No Js window returned"),
+        };
+        // JS DOCUMENT
+        let document = match window.document() {
+            Some(doc) => doc,
+            None => panic!("No Js window document returned"),
+        };
+
+        // CANVAS
+        let canvas = match document.get_element_by_id(canvas_id) {
+            Some(el) => el,
+            None => panic!("No element found for {}", canvas_id),
+        };
+        let canvas = match canvas.dyn_into::<web_sys::HtmlCanvasElement>() {
+            Ok(el) => el,
+            Err(err) => panic!("Failed to cast canvas {:?}", err),
+        };
+
+        canvas
+    }
+
+    /// Get a 2D canvas context for a given canvas
+    fn get_canvas_context(canvas: &HtmlCanvasElement) -> CanvasRenderingContext2d {
+
+        // CANVAS CONTEXT
+        let context = match canvas.get_context("2d") {
+            Ok(op) => match op {
+                // UNWRAP OPTION
+                Some(object) => object,
+                None => panic!("Nothing found when unwrapping canvas context"),
+            },
+            Err(err) => panic!("Error when getting canvas context: {:?}", err),
+        };
+        // CAST CONTEXT
+        let context = match context.dyn_into::<web_sys::CanvasRenderingContext2d>() {
+            Ok(dyn_cast) => dyn_cast,
+            Err(cast_err) => panic!("Error when casting canvas context: {:?}", cast_err)
+        };
+
+        context
+    }
+}
+
+#[wasm_bindgen]
+impl Painter {
+
+    /// Default constructor which queries for canvas by ID
+    #[wasm_bindgen(constructor)]
+    pub fn new(width: u32, height: u32, canvas_id: &str) -> Painter {
+
+        let canvas = Painter::get_canvas(canvas_id);
+
+        canvas.set_width(width);
+        canvas.set_height(height);
+
+        let context = Painter::get_canvas_context(&canvas);
+
+        Painter {
+            canvas,
+            context,
+            width, height,
+
+            white_square: JsValue::from_str(WHITE_SQUARE),
+            black_square: JsValue::from_str(BLACK_SQUARE),
+            
+            white_piece: JsValue::from_str(WHITE_PIECE),
+            black_piece: JsValue::from_str(BLACK_PIECE),
+
+            white_piece_line: JsValue::from_str(WHITE_PIECE_OUTLINE),
+            black_piece_line: JsValue::from_str(BLACK_PIECE_OUTLINE),
+            piece_lines: DRAW_PIECE_OUTLINES,
+            piece_line_width: PIECE_OUTLINE_WIDTH,
+
+            square_outline: JsValue::from_str(SQUARE_OUTLINE),
+            outline_width: OUTLINE_WIDTH,
+            draw_outline: DRAW_OUTLINE,
+        }
+    }
+
+    /// Constructor with given canvas element
+    pub fn new_with_canvas(width: u32, height: u32, canvas: HtmlCanvasElement) -> Painter {
+        canvas.set_width(width);
+        canvas.set_height(height);
+
+        let context = Painter::get_canvas_context(&canvas);
+
+        Painter {
+            canvas,
+            context,
+            width, height,
+
+            white_square: JsValue::from_str(WHITE_SQUARE),
+            black_square: JsValue::from_str(BLACK_SQUARE),
+            
+            white_piece: JsValue::from_str(WHITE_PIECE),
+            black_piece: JsValue::from_str(BLACK_PIECE),
+
+            white_piece_line: JsValue::from_str(WHITE_PIECE_OUTLINE),
+            black_piece_line: JsValue::from_str(BLACK_PIECE_OUTLINE),
+            piece_lines: DRAW_PIECE_OUTLINES,
+            piece_line_width: PIECE_OUTLINE_WIDTH,
+
+            square_outline: JsValue::from_str(SQUARE_OUTLINE),
+            outline_width: OUTLINE_WIDTH,
+            draw_outline: DRAW_OUTLINE,
+        }
+    }
+
+    /// Set new square outline colour value
+    pub fn set_square_outline(&mut self, value: JsValue) {
+        self.square_outline = value;
+    }
+
+    /// Set new line width for outlining squares
+    pub fn set_outline_width(&mut self, value: f64) {
+        self.outline_width = value;
+    }
+
+    /// Set whether squares are outlined
+    pub fn set_draw_outline(&mut self, value: bool) {
+        self.draw_outline = value;
+    }
+
+    /// Reset the canvas dimensions to the given width and height
+    pub fn reset_dimensions(&self) {
+        self.canvas.set_width(self.width);
+        self.canvas.set_height(self.height);
+    }
+
+    /// Check whether given canvas dimensions divide evenly by given board dimenions
+    pub fn validate_board_dim(&self, board: &Board) -> bool {
+        let mut ans = true;
+
+        if self.height as usize % board.height != 0 {
+            log!("Canvas and board heights do not evenly divide, Canvas({}) / Board({}) = {} px/cell", self.height, board.height, self.height as f32 / board.height as f32);
+            ans = false;
+        }
+
+        if self.width as usize % board.width != 0 {
+            log!("Canvas and board widths do not evenly divide, Canvas({}) / Board({}) = {} px/cell", self.width, board.width, self.width as f32 / board.width as f32);
+            ans = false;
+        }
+
+        ans
+    }
+
+    /// Draw a board onto the canvas
+    pub fn draw(&self, board: &Board) {
+
+        self.validate_board_dim(board);
+
+        let cell_height = self.height as usize / board.height;
+        let cell_width = self.width as usize / board.width;
+
+        self.context.set_fill_style(&self.white_square);
+        self.context.fill_rect(0.0, 0.0, self.width as f64, self.height as f64);
+
+        self.context.set_fill_style(&self.black_square);
+        self.context.set_stroke_style(&self.square_outline);
+        self.context.set_line_width(self.outline_width);
+
+        // Draw black squares onto canvas
+        for i in 0..board.height {
+            for j in 0..board.width {
+
+                if i % 2 == 0 {
+                    if j % 2 == 1 {
+                        self.context.fill_rect(
+                            (j * cell_width) as f64, 
+                            (i * cell_height) as f64, 
+                            cell_width as f64, 
+                            cell_height as f64
+                        );
+
+                        if self.draw_outline {
+                            self.context.stroke_rect(
+                                (j * cell_width) as f64, 
+                                (i * cell_height) as f64, 
+                                cell_width as f64, 
+                                cell_height as f64
+                            );
+                        }
+                    }
+                }
+                else {
+                    if j % 2 == 0 {
+                        self.context.fill_rect(
+                            (j * cell_width) as f64, 
+                            (i * cell_height) as f64, 
+                            cell_width as f64, 
+                            cell_height as f64
+                        );
+
+                        if self.draw_outline {
+                            self.context.stroke_rect(
+                                (j * cell_width) as f64, 
+                                (i * cell_height) as f64, 
+                                cell_width as f64, 
+                                cell_height as f64
+                            );
+                        }
+                    }
+                }
+            }
+        }
+
+        // Draw pieces onto canvas
+        for (idx, square) in PieceIterator::new(board) {
+            match square.occupant {
+                Some(piece) => {
+
+                    let brd_idx = board.board_index(idx);
+
+                    match piece.team {
+                        Black => {
+                            self.context.set_fill_style(&self.black_piece);
+                            self.context.set_stroke_style(&self.black_piece_line);
+                        },
+                        White => {
+                            self.context.set_fill_style(&self.white_piece);
+                            self.context.set_stroke_style(&self.white_piece_line);
+                        },
+                    }
+
+                    let center_x: f64 = (brd_idx.col as f64 * cell_width as f64) + (cell_width as f64) / 2.0;
+                    let center_y: f64 = (brd_idx.row as f64 * cell_height as f64) + (cell_height as f64) / 2.0;
+
+                    self.context.begin_path();
+                    match self.context.arc(
+                        center_x, 
+                        center_y, 
+                        (cell_width as f64 / 2.0) - PIECE_MARGIN, // radius 
+                        0.0, // start angle
+                        f64::consts::PI * 2.0) // end angle
+                    {
+                        Ok(res) => res,
+                        Err(err) => log!("Failed to draw piece, idx: {}, square: {:?}, {:?}", idx, square, err),
+                    };
+                    self.context.fill();
+
+                    if self.piece_lines {
+                        self.context.set_line_width(self.piece_line_width);
+                        self.context.stroke()
+                    }
+
+                },
+                None => panic!("No piece found when attempting to draw, idx: {}, square: {:?}", idx, square),
+            }
+        }
+    }
+}
+
+ \ No newline at end of file diff --git a/index.html b/index.html index 47ce3d6..6a09245 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ - game of life + draught