diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html new file mode 100644 index 0000000..9f5aed4 --- /dev/null +++ b/index.html @@ -0,0 +1,30 @@ + + + + + + + Ultimate TicTacToe AI + + + + + + + + + + + diff --git a/uttt-gui-8522049185606245.js b/uttt-gui-8522049185606245.js new file mode 100644 index 0000000..982679a --- /dev/null +++ b/uttt-gui-8522049185606245.js @@ -0,0 +1,607 @@ +let wasm; + +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +let WASM_VECTOR_LEN = 0; + +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(state => { + wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b) +}); + +function makeMutClosure(arg0, arg1, dtor, f) { + const state = { a: arg0, b: arg1, cnt: 1, dtor }; + const real = (...args) => { + // First up with a closure we increment the internal reference + // count. This ensures that the Rust closure environment won't + // be deallocated while we're invoking it. + state.cnt++; + const a = state.a; + state.a = 0; + try { + return f(a, state.b, ...args); + } finally { + if (--state.cnt === 0) { + wasm.__wbindgen_export_3.get(state.dtor)(a, state.b); + CLOSURE_DTORS.unregister(state); + } else { + state.a = a; + } + } + }; + real.original = state; + CLOSURE_DTORS.register(real, state, state); + return real; +} +function __wbg_adapter_26(arg0, arg1, arg2) { + wasm.closure114_externref_shim(arg0, arg1, arg2); +} + +function __wbg_adapter_29(arg0, arg1, arg2) { + wasm.closure190_externref_shim(arg0, arg1, arg2); +} + +function __wbg_adapter_32(arg0, arg1) { + wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h799d28ef5f36b59c(arg0, arg1); +} + +function getFromExternrefTable0(idx) { return wasm.__wbindgen_export_2.get(idx); } + +function getCachedStringFromWasm0(ptr, len) { + if (ptr === 0) { + return getFromExternrefTable0(len); + } else { + return getStringFromWasm0(ptr, len); + } +} + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); + return idx; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); + } +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; } + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_cb_drop = function(arg0) { + const obj = arg0.original; + if (obj.cnt-- == 1) { + obj.a = 0; + return true; + } + const ret = false; + return ret; + }; + imports.wbg.__wbg_new_abda76e883ba8a5f = function() { + const ret = new Error(); + return ret; + }; + imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) { + const ret = arg1.stack; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1, 1); } + console.error(v0); +}; +imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) { + const ret = arg0.crypto; + return ret; +}; +imports.wbg.__wbindgen_is_object = function(arg0) { + const val = arg0; + const ret = typeof(val) === 'object' && val !== null; + return ret; +}; +imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) { + const ret = arg0.process; + return ret; +}; +imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) { + const ret = arg0.versions; + return ret; +}; +imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) { + const ret = arg0.node; + return ret; +}; +imports.wbg.__wbindgen_is_string = function(arg0) { + const ret = typeof(arg0) === 'string'; + return ret; +}; +imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () { + const ret = module.require; + return ret; +}, arguments) }; +imports.wbg.__wbindgen_is_function = function(arg0) { + const ret = typeof(arg0) === 'function'; + return ret; +}; +imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return ret; +}; +imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) { + const ret = arg0.msCrypto; + return ret; +}; +imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) { + arg0.randomFillSync(arg1); +}, arguments) }; +imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) { + arg0.getRandomValues(arg1); +}, arguments) }; +imports.wbg.__wbg_id_707ed0d6f490c6d1 = function(arg0, arg1) { + const ret = arg1.$id; + getDataViewMemory0().setInt32(arg0 + 4 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); +}; +imports.wbg.__wbg_setid_ccb8358feb5d172c = function(arg0, arg1) { + arg0.$id = arg1 >>> 0; +}; +imports.wbg.__wbg_queueMicrotask_848aa4969108a57e = function(arg0) { + const ret = arg0.queueMicrotask; + return ret; +}; +imports.wbg.__wbg_queueMicrotask_c5419c06eab41e73 = typeof queueMicrotask == 'function' ? queueMicrotask : notDefined('queueMicrotask'); +imports.wbg.__wbg_removeAttribute_2dc68056b5e6ea3d = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + arg0.removeAttribute(v0); +}, arguments) }; +imports.wbg.__wbg_setAttribute_2a8f647a8d92c712 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg3, arg4); + arg0.setAttribute(v0, v1); +}, arguments) }; +imports.wbg.__wbg_body_8e909b791b1745d3 = function(arg0) { + const ret = arg0.body; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; +imports.wbg.__wbg_createComment_91ba91f80deb16bd = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = arg0.createComment(v0); + return ret; +}; +imports.wbg.__wbg_createElement_e4523490bd0ae51d = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = arg0.createElement(v0); + return ret; +}, arguments) }; +imports.wbg.__wbg_createTextNode_3b33c97f8ef3e999 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = arg0.createTextNode(v0); + return ret; +}; +imports.wbg.__wbg_instanceof_Window_6575cd7f1322f82f = function(arg0) { + let result; + try { + result = arg0 instanceof Window; + } catch (_) { + result = false; + } + const ret = result; + return ret; +}; +imports.wbg.__wbg_document_d7fa2c739c2b191a = function(arg0) { + const ret = arg0.document; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; +imports.wbg.__wbg_parentNode_7e7d8adc9b41ce58 = function(arg0) { + const ret = arg0.parentNode; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; +imports.wbg.__wbg_nextSibling_46da01c3a2ce3774 = function(arg0) { + const ret = arg0.nextSibling; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); +}; +imports.wbg.__wbg_settextContent_f9c4b60e6c009ea2 = function(arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + arg0.textContent = v0; +}; +imports.wbg.__wbg_appendChild_bc4a0deae90a5164 = function() { return handleError(function (arg0, arg1) { + const ret = arg0.appendChild(arg1); + return ret; +}, arguments) }; +imports.wbg.__wbg_insertBefore_5caa6ab4d3d6b481 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.insertBefore(arg1, arg2); + return ret; +}, arguments) }; +imports.wbg.__wbg_removeChild_aa85e67649730769 = function() { return handleError(function (arg0, arg1) { + const ret = arg0.removeChild(arg1); + return ret; +}, arguments) }; +imports.wbg.__wbg_replaceChild_354ecd959bd42553 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.replaceChild(arg1, arg2); + return ret; +}, arguments) }; +imports.wbg.__wbg_addEventListener_4357f9b7b3826784 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + arg0.addEventListener(v0, arg3); +}, arguments) }; +imports.wbg.__wbg_now_d3cbc9581625f686 = function(arg0) { + const ret = arg0.now(); + return ret; +}; +imports.wbg.__wbg_clearTimeout_76877dbc010e786d = typeof clearTimeout == 'function' ? clearTimeout : notDefined('clearTimeout'); +imports.wbg.__wbg_setTimeout_75cb9b6991a4031d = function() { return handleError(function (arg0, arg1) { + const ret = setTimeout(arg0, arg1); + return ret; +}, arguments) }; +imports.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Function(v0); + return ret; +}; +imports.wbg.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) { + const ret = Reflect.get(arg0, arg1); + return ret; +}, arguments) }; +imports.wbg.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) { + const ret = arg0.call(arg1); + return ret; +}, arguments) }; +imports.wbg.__wbg_self_bf91bf94d9e04084 = function() { return handleError(function () { + const ret = self.self; + return ret; +}, arguments) }; +imports.wbg.__wbg_window_52dd9f07d03fd5f8 = function() { return handleError(function () { + const ret = window.window; + return ret; +}, arguments) }; +imports.wbg.__wbg_globalThis_05c129bf37fcf1be = function() { return handleError(function () { + const ret = globalThis.globalThis; + return ret; +}, arguments) }; +imports.wbg.__wbg_global_3eca19bb09e9c484 = function() { return handleError(function () { + const ret = global.global; + return ret; +}, arguments) }; +imports.wbg.__wbindgen_is_undefined = function(arg0) { + const ret = arg0 === undefined; + return ret; +}; +imports.wbg.__wbg_call_3bfa248576352471 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.call(arg1, arg2); + return ret; +}, arguments) }; +imports.wbg.__wbg_is_4b64bc96710d6a0f = function(arg0, arg1) { + const ret = Object.is(arg0, arg1); + return ret; +}; +imports.wbg.__wbg_resolve_0aad7c1484731c99 = function(arg0) { + const ret = Promise.resolve(arg0); + return ret; +}; +imports.wbg.__wbg_then_748f75edfb032440 = function(arg0, arg1) { + const ret = arg0.then(arg1); + return ret; +}; +imports.wbg.__wbg_buffer_ccaed51a635d8a2d = function(arg0) { + const ret = arg0.buffer; + return ret; +}; +imports.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) { + const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); + return ret; +}; +imports.wbg.__wbg_new_fec2611eb9180f95 = function(arg0) { + const ret = new Uint8Array(arg0); + return ret; +}; +imports.wbg.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) { + arg0.set(arg1, arg2 >>> 0); +}; +imports.wbg.__wbg_newwithlength_76462a666eca145f = function(arg0) { + const ret = new Uint8Array(arg0 >>> 0); + return ret; +}; +imports.wbg.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) { + const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0); + return ret; +}; +imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; +imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; +imports.wbg.__wbindgen_memory = function() { + const ret = wasm.memory; + return ret; +}; +imports.wbg.__wbindgen_closure_wrapper271 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 115, __wbg_adapter_26); + return ret; +}; +imports.wbg.__wbindgen_closure_wrapper485 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 191, __wbg_adapter_29); + return ret; +}; +imports.wbg.__wbindgen_closure_wrapper874 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 209, __wbg_adapter_32); + return ret; +}; +imports.wbg.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_2; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +return imports; +} + +function __wbg_init_memory(imports, memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedDataViewMemory0 = null; + cachedUint8ArrayMemory0 = null; + + + wasm.__wbindgen_start(); + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (typeof module !== 'undefined') { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (typeof module_or_path === 'undefined') { + module_or_path = new URL('uttt-gui_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync }; +export default __wbg_init; diff --git a/uttt-gui-8522049185606245_bg.wasm b/uttt-gui-8522049185606245_bg.wasm new file mode 100644 index 0000000..5bc31fb Binary files /dev/null and b/uttt-gui-8522049185606245_bg.wasm differ