commit c0a023e721decb09a6e323adc6695f2736400f58 Author: Sarsoo Date: Mon Jun 21 21:48:40 2021 +0000 deploy: b52ca7d6c1ff2cb817aeca62a6cabfc1372b151e diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/bootstrap.js b/bootstrap.js new file mode 100644 index 0000000..c806d32 --- /dev/null +++ b/bootstrap.js @@ -0,0 +1,379 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./bootstrap.js": +/*!**********************!*\ + !*** ./bootstrap.js ***! + \**********************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +eval("// A dependency graph that contains any wasm must all be imported\n// asynchronously. This `bootstrap.js` file does the single async import, so\n// that no one else needs to worry about it again.\n__webpack_require__.e(/*! import() */ \"index_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./index.js */ \"./index.js\"))\n .catch(e => console.error(\"Error importing `index.js`:\", e));\n\n\n//# sourceURL=webpack://game-of-life-web/./bootstrap.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ loaded: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/async module */ +/******/ (() => { +/******/ var webpackThen = typeof Symbol === "function" ? Symbol("webpack then") : "__webpack_then__"; +/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; +/******/ var completeQueue = (queue) => { +/******/ if(queue) { +/******/ queue.forEach((fn) => (fn.r--)); +/******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn())); +/******/ } +/******/ } +/******/ var completeFunction = (fn) => (!--fn.r && fn()); +/******/ var queueFunction = (queue, fn) => (queue ? queue.push(fn) : completeFunction(fn)); +/******/ var wrapDeps = (deps) => (deps.map((dep) => { +/******/ if(dep !== null && typeof dep === "object") { +/******/ if(dep[webpackThen]) return dep; +/******/ if(dep.then) { +/******/ var queue = []; +/******/ dep.then((r) => { +/******/ obj[webpackExports] = r; +/******/ completeQueue(queue); +/******/ queue = 0; +/******/ }); +/******/ var obj = { [webpackThen]: (fn, reject) => (queueFunction(queue, fn), dep.catch(reject)) }; +/******/ return obj; +/******/ } +/******/ } +/******/ return { [webpackThen]: (fn) => (completeFunction(fn)), [webpackExports]: dep }; +/******/ })); +/******/ __webpack_require__.a = (module, body, hasAwait) => { +/******/ var queue = hasAwait && []; +/******/ var exports = module.exports; +/******/ var currentDeps; +/******/ var outerResolve; +/******/ var reject; +/******/ var isEvaluating = true; +/******/ var nested = false; +/******/ var whenAll = (deps, onResolve, onReject) => { +/******/ if (nested) return; +/******/ nested = true; +/******/ onResolve.r += deps.length; +/******/ deps.map((dep, i) => (dep[webpackThen](onResolve, onReject))); +/******/ nested = false; +/******/ }; +/******/ var promise = new Promise((resolve, rej) => { +/******/ reject = rej; +/******/ outerResolve = () => (resolve(exports), completeQueue(queue), queue = 0); +/******/ }); +/******/ promise[webpackExports] = exports; +/******/ promise[webpackThen] = (fn, rejectFn) => { +/******/ if (isEvaluating) { return completeFunction(fn); } +/******/ if (currentDeps) whenAll(currentDeps, fn, rejectFn); +/******/ queueFunction(queue, fn); +/******/ promise.catch(rejectFn); +/******/ }; +/******/ module.exports = promise; +/******/ body((deps) => { +/******/ if(!deps) return outerResolve(); +/******/ currentDeps = wrapDeps(deps); +/******/ var fn, result; +/******/ var promise = new Promise((resolve, reject) => { +/******/ fn = () => (resolve(result = currentDeps.map((d) => (d[webpackExports])))); +/******/ fn.r = 0; +/******/ whenAll(currentDeps, fn, reject); +/******/ }); +/******/ return fn.r ? promise : result; +/******/ }).then(outerResolve, reject); +/******/ isEvaluating = false; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/ensure chunk */ +/******/ (() => { +/******/ __webpack_require__.f = {}; +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = (chunkId) => { +/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => { +/******/ __webpack_require__.f[key](chunkId, promises); +/******/ return promises; +/******/ }, [])); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/get javascript chunk filename */ +/******/ (() => { +/******/ // This function allow to reference async chunks +/******/ __webpack_require__.u = (chunkId) => { +/******/ // return url for filenames based on template +/******/ return "" + chunkId + ".bootstrap.js"; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/******/ /* webpack/runtime/harmony module decorator */ +/******/ (() => { +/******/ __webpack_require__.hmd = (module) => { +/******/ module = Object.create(module); +/******/ if (!module.children) module.children = []; +/******/ Object.defineProperty(module, 'exports', { +/******/ enumerable: true, +/******/ set: () => { +/******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); +/******/ } +/******/ }); +/******/ return module; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/load script */ +/******/ (() => { +/******/ var inProgress = {}; +/******/ var dataWebpackPrefix = "game-of-life-web:"; +/******/ // loadScript function to load a script via script tag +/******/ __webpack_require__.l = (url, done, key, chunkId) => { +/******/ if(inProgress[url]) { inProgress[url].push(done); return; } +/******/ var script, needAttach; +/******/ if(key !== undefined) { +/******/ var scripts = document.getElementsByTagName("script"); +/******/ for(var i = 0; i < scripts.length; i++) { +/******/ var s = scripts[i]; +/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; } +/******/ } +/******/ } +/******/ if(!script) { +/******/ needAttach = true; +/******/ script = document.createElement('script'); +/******/ +/******/ script.charset = 'utf-8'; +/******/ script.timeout = 120; +/******/ if (__webpack_require__.nc) { +/******/ script.setAttribute("nonce", __webpack_require__.nc); +/******/ } +/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key); +/******/ script.src = url; +/******/ } +/******/ inProgress[url] = [done]; +/******/ var onScriptComplete = (prev, event) => { +/******/ // avoid mem leaks in IE. +/******/ script.onerror = script.onload = null; +/******/ clearTimeout(timeout); +/******/ var doneFns = inProgress[url]; +/******/ delete inProgress[url]; +/******/ script.parentNode && script.parentNode.removeChild(script); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); +/******/ if(prev) return prev(event); +/******/ } +/******/ ; +/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000); +/******/ script.onerror = onScriptComplete.bind(null, script.onerror); +/******/ script.onload = onScriptComplete.bind(null, script.onload); +/******/ needAttach && document.head.appendChild(script); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/publicPath */ +/******/ (() => { +/******/ var scriptUrl; +/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + ""; +/******/ var document = __webpack_require__.g.document; +/******/ if (!scriptUrl && document) { +/******/ if (document.currentScript) +/******/ scriptUrl = document.currentScript.src +/******/ if (!scriptUrl) { +/******/ var scripts = document.getElementsByTagName("script"); +/******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src +/******/ } +/******/ } +/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration +/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic. +/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser"); +/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/"); +/******/ __webpack_require__.p = scriptUrl; +/******/ })(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ (() => { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "main": 0 +/******/ }; +/******/ +/******/ __webpack_require__.f.j = (chunkId, promises) => { +/******/ // JSONP chunk loading for javascript +/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; +/******/ if(installedChunkData !== 0) { // 0 means "already installed". +/******/ +/******/ // a Promise means "currently loading". +/******/ if(installedChunkData) { +/******/ promises.push(installedChunkData[2]); +/******/ } else { +/******/ if(true) { // all chunks have JS +/******/ // setup Promise in chunk cache +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); +/******/ promises.push(installedChunkData[2] = promise); +/******/ +/******/ // start chunk loading +/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId); +/******/ // create error before stack unwound to get useful stacktrace later +/******/ var error = new Error(); +/******/ var loadingEnded = (event) => { +/******/ if(__webpack_require__.o(installedChunks, chunkId)) { +/******/ installedChunkData = installedChunks[chunkId]; +/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined; +/******/ if(installedChunkData) { +/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); +/******/ var realSrc = event && event.target && event.target.src; +/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; +/******/ error.name = 'ChunkLoadError'; +/******/ error.type = errorType; +/******/ error.request = realSrc; +/******/ installedChunkData[1](error); +/******/ } +/******/ } +/******/ }; +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); +/******/ } else installedChunks[chunkId] = 0; +/******/ } +/******/ } +/******/ }; +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ // no on chunks loaded +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { +/******/ var [chunkIds, moreModules, runtime] = data; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkIds[i]] = 0; +/******/ } +/******/ +/******/ } +/******/ +/******/ var chunkLoadingGlobal = self["webpackChunkgame_of_life_web"] = self["webpackChunkgame_of_life_web"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ })(); +/******/ +/******/ /* webpack/runtime/wasm chunk loading */ +/******/ (() => { +/******/ __webpack_require__.v = (exports, wasmModuleId, wasmModuleHash, importsObj) => { +/******/ var req = fetch(__webpack_require__.p + "" + wasmModuleHash + ".module.wasm"); +/******/ if (typeof WebAssembly.instantiateStreaming === 'function') { +/******/ return WebAssembly.instantiateStreaming(req, importsObj) +/******/ .then((res) => (Object.assign(exports, res.instance.exports))); +/******/ } +/******/ return req +/******/ .then((x) => (x.arrayBuffer())) +/******/ .then((bytes) => (WebAssembly.instantiate(bytes, importsObj))) +/******/ .then((res) => (Object.assign(exports, res.instance.exports))); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./bootstrap.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/de0e97b9a311abef847f.module.wasm b/de0e97b9a311abef847f.module.wasm new file mode 100644 index 0000000..657c663 Binary files /dev/null and b/de0e97b9a311abef847f.module.wasm differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..1469a49 --- /dev/null +++ b/index.html @@ -0,0 +1,38 @@ + + + + + game of life + + + + + + + + + + + + + + + + + +
+ + + diff --git a/index_js.bootstrap.js b/index_js.bootstrap.js new file mode 100644 index 0000000..0c1067c --- /dev/null +++ b/index_js.bootstrap.js @@ -0,0 +1,44 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +(self["webpackChunkgame_of_life_web"] = self["webpackChunkgame_of_life_web"] || []).push([["index_js"],{ + +/***/ "../pkg/game_of_life_bg.js": +/*!*********************************!*\ + !*** ../pkg/game_of_life_bg.js ***! + \*********************************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__) => {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"init\": () => (/* binding */ init),\n/* harmony export */ \"Cell\": () => (/* binding */ Cell),\n/* harmony export */ \"Universe\": () => (/* binding */ Universe),\n/* harmony export */ \"__wbindgen_object_drop_ref\": () => (/* binding */ __wbindgen_object_drop_ref),\n/* harmony export */ \"__wbindgen_string_new\": () => (/* binding */ __wbindgen_string_new),\n/* harmony export */ \"__wbg_new_59cb74e423758ede\": () => (/* binding */ __wbg_new_59cb74e423758ede),\n/* harmony export */ \"__wbg_stack_558ba5917b466edd\": () => (/* binding */ __wbg_stack_558ba5917b466edd),\n/* harmony export */ \"__wbg_error_4bb6c2a97407129a\": () => (/* binding */ __wbg_error_4bb6c2a97407129a),\n/* harmony export */ \"__wbg_log_9a99fb1af846153b\": () => (/* binding */ __wbg_log_9a99fb1af846153b),\n/* harmony export */ \"__wbg_time_8897e55ebee4075f\": () => (/* binding */ __wbg_time_8897e55ebee4075f),\n/* harmony export */ \"__wbg_timeEnd_6186a583833a7163\": () => (/* binding */ __wbg_timeEnd_6186a583833a7163),\n/* harmony export */ \"__wbindgen_throw\": () => (/* binding */ __wbindgen_throw)\n/* harmony export */ });\n/* harmony import */ var _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./game_of_life_bg.wasm */ \"../pkg/game_of_life_bg.wasm\");\n/* module decorator */ module = __webpack_require__.hmd(module);\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__]);\n_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? await __webpack_async_dependencies__ : __webpack_async_dependencies__)[0];\n\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 !== _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.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/**\n*/\nfunction init() {\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.init();\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);\n }\n return cachegetInt32Memory0;\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/**\n*/\nconst Cell = Object.freeze({ Dead:0,\"0\":\"Dead\",Alive:1,\"1\":\"Alive\", });\n/**\n*/\nclass Universe {\n\n static __wrap(ptr) {\n const obj = Object.create(Universe.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 _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbg_universe_free(ptr);\n }\n /**\n */\n tick() {\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_tick(this.ptr);\n }\n /**\n * @param {number} width\n * @param {number} height\n * @param {number} rand_threshold\n * @param {number} seed\n * @returns {Universe}\n */\n static new(width, height, rand_threshold, seed) {\n var ret = _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_new(width, height, rand_threshold, seed);\n return Universe.__wrap(ret);\n }\n /**\n * @returns {string}\n */\n render() {\n try {\n const retptr = _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_add_to_stack_pointer(-16);\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_render(retptr, this.ptr);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n return getStringFromWasm0(r0, r1);\n } finally {\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_add_to_stack_pointer(16);\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_free(r0, r1);\n }\n }\n /**\n * @returns {number}\n */\n width() {\n var ret = _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_width(this.ptr);\n return ret >>> 0;\n }\n /**\n * @returns {number}\n */\n height() {\n var ret = _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_height(this.ptr);\n return ret >>> 0;\n }\n /**\n * @returns {number}\n */\n cells() {\n var ret = _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_cells(this.ptr);\n return ret;\n }\n /**\n */\n reset() {\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.universe_reset(this.ptr);\n }\n}\n\nfunction __wbindgen_object_drop_ref(arg0) {\n takeObject(arg0);\n};\n\nfunction __wbindgen_string_new(arg0, arg1) {\n var ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n};\n\nfunction __wbg_new_59cb74e423758ede() {\n var ret = new Error();\n return addHeapObject(ret);\n};\n\nfunction __wbg_stack_558ba5917b466edd(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_malloc, _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nfunction __wbg_error_4bb6c2a97407129a(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n _game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_free(arg0, arg1);\n }\n};\n\nfunction __wbg_log_9a99fb1af846153b(arg0) {\n console.log(getObject(arg0));\n};\n\nfunction __wbg_time_8897e55ebee4075f(arg0, arg1) {\n console.time(getStringFromWasm0(arg0, arg1));\n};\n\nfunction __wbg_timeEnd_6186a583833a7163(arg0, arg1) {\n console.timeEnd(getStringFromWasm0(arg0, arg1));\n};\n\nfunction __wbindgen_throw(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n\n});\n\n//# sourceURL=webpack://game-of-life-web/../pkg/game_of_life_bg.js?"); + +/***/ }), + +/***/ "../pkg/game_of_life_bg.wasm": +/*!***********************************!*\ + !*** ../pkg/game_of_life_bg.wasm ***! + \***********************************/ +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +eval("var __webpack_instantiate__ = ([WEBPACK_IMPORTED_MODULE_0]) => {\n\treturn __webpack_require__.v(exports, module.id, \"de0e97b9a311abef847f\", {\n\t\t\"./game_of_life_bg.js\": {\n\t\t\t\"__wbindgen_object_drop_ref\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_object_drop_ref,\n\t\t\t\"__wbindgen_string_new\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_string_new,\n\t\t\t\"__wbg_new_59cb74e423758ede\": WEBPACK_IMPORTED_MODULE_0.__wbg_new_59cb74e423758ede,\n\t\t\t\"__wbg_stack_558ba5917b466edd\": WEBPACK_IMPORTED_MODULE_0.__wbg_stack_558ba5917b466edd,\n\t\t\t\"__wbg_error_4bb6c2a97407129a\": WEBPACK_IMPORTED_MODULE_0.__wbg_error_4bb6c2a97407129a,\n\t\t\t\"__wbg_log_9a99fb1af846153b\": WEBPACK_IMPORTED_MODULE_0.__wbg_log_9a99fb1af846153b,\n\t\t\t\"__wbg_time_8897e55ebee4075f\": WEBPACK_IMPORTED_MODULE_0.__wbg_time_8897e55ebee4075f,\n\t\t\t\"__wbg_timeEnd_6186a583833a7163\": WEBPACK_IMPORTED_MODULE_0.__wbg_timeEnd_6186a583833a7163,\n\t\t\t\"__wbindgen_throw\": WEBPACK_IMPORTED_MODULE_0.__wbindgen_throw\n\t\t}\n\t});\n}\n__webpack_require__.a(module, (__webpack_handle_async_dependencies__) => {\n\t/* harmony import */ var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__(/*! ./game_of_life_bg.js */ \"../pkg/game_of_life_bg.js\");\n\tvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([WEBPACK_IMPORTED_MODULE_0]);\n\treturn __webpack_async_dependencies__.then ? __webpack_async_dependencies__.then(__webpack_instantiate__) : __webpack_instantiate__(__webpack_async_dependencies__);\n}, 1);\n\n//# sourceURL=webpack://game-of-life-web/../pkg/game_of_life_bg.wasm?"); + +/***/ }), + +/***/ "./index.js": +/*!******************!*\ + !*** ./index.js ***! + \******************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__) => {\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var game_of_life__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! game-of-life */ \"../pkg/game_of_life_bg.js\");\n/* harmony import */ var game_of_life_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! game-of-life/game_of_life_bg.wasm */ \"../pkg/game_of_life_bg.wasm\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([game_of_life__WEBPACK_IMPORTED_MODULE_0__, game_of_life_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_1__]);\n([game_of_life__WEBPACK_IMPORTED_MODULE_0__, game_of_life_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? await __webpack_async_dependencies__ : __webpack_async_dependencies__);\n\n\n\n// let PLAY = true;\n// let PLAY = false;\n(0,game_of_life__WEBPACK_IMPORTED_MODULE_0__.init)();\nconst randSlider = document.getElementById(\"randThreshold\");\nconst randSliderLabel = document.getElementById(\"randThreshold-label\");\n\nconst CELL_SIZE = 5; // px\nconst GRID_COLOR = \"#BBBBBB\";\nconst DEAD_COLOR = \"#FFFFFF\";\nconst ALIVE_COLOR = \"#FF55AA\";\n\nlet universe = game_of_life__WEBPACK_IMPORTED_MODULE_0__.Universe.new(100, 100, randSlider.value, new Date().getTime() / 1000);\nlet width = universe.width();\nlet height = universe.height();\n\nconst canvas = document.getElementById(\"game-of-life-canvas\");\ncanvas.height = (CELL_SIZE + 1) * height + 1;\ncanvas.width = (CELL_SIZE + 1) * width + 1;\n\nconst ctx = canvas.getContext('2d');\n \nconst drawGrid = () => {\n ctx.beginPath();\n ctx.strokeStyle = GRID_COLOR;\n\n // Vertical lines.\n for (let i = 0; i <= width; i++) {\n ctx.moveTo(i * (CELL_SIZE + 1) + 1, 0);\n ctx.lineTo(i * (CELL_SIZE + 1) + 1, (CELL_SIZE + 1) * height + 1);\n }\n\n // Horizontal lines.\n for (let j = 0; j <= height; j++) {\n ctx.moveTo(0, j * (CELL_SIZE + 1) + 1);\n ctx.lineTo((CELL_SIZE + 1) * width + 1, j * (CELL_SIZE + 1) + 1);\n }\n\n ctx.stroke();\n};\n\nconst getIndex = (row, column) => {\n return row * width + column;\n};\n\nconst drawCells = () => {\n const cellsPtr = universe.cells();\n const cells = new Uint8Array(game_of_life_game_of_life_bg_wasm__WEBPACK_IMPORTED_MODULE_1__.memory.buffer, cellsPtr, width * height);\n\n ctx.beginPath();\n\n for (let row = 0; row < height; row++) {\n for (let col = 0; col < width; col++) {\n const idx = getIndex(row, col);\n\n ctx.fillStyle = cells[idx] === game_of_life__WEBPACK_IMPORTED_MODULE_0__.Cell.Dead\n ? DEAD_COLOR\n : ALIVE_COLOR;\n\n ctx.fillRect(\n col * (CELL_SIZE + 1) + 1,\n row * (CELL_SIZE + 1) + 1,\n CELL_SIZE,\n CELL_SIZE\n );\n }\n }\n\n ctx.stroke();\n};\n\nconst renderSingle = () => {\n fps.render(); //new\n universe.tick();\n \n drawGrid();\n drawCells();\n}\n\nconst start = () => {\n if(loop != null) clearInterval(loop);\n loop = setInterval(renderSingle, frameInterval);\n}\n\nconst stop = () => {\n if(loop != null) clearInterval(loop);\n loop = null;\n}\n\n// const renderLoop = () => {\n// if(PLAY){\n// renderSingle();\n// requestAnimationFrame(renderLoop);\n// }\n// };\n\n// renderSingle();\n// requestAnimationFrame(renderLoop);\n\nvar frameInterval = 50;\n// var loop = setInterval(renderSingle, frameInterval);\nvar loop = null;\n\nconst frameSlider = document.getElementById(\"frameRate\");\nconst frameSliderLabel = document.getElementById(\"frameRate-label\");\nconst onFrameSlider = () => {\n stop();\n\n frameInterval = frameSlider.value;\n frameSliderLabel.innerHTML = `Frame Interval: ${frameSlider.value}`;\n\n if(playCheck.checked) start();\n}\nframeSlider.onchange = onFrameSlider;\n\nconst onRandSlider = () => {\n stop();\n\n universe = game_of_life__WEBPACK_IMPORTED_MODULE_0__.Universe.new(width, height, randSlider.value, new Date().getTime() / 1000);\n refreshCanvas();\n randSliderLabel.innerHTML = `Rand Threshold: ${randSlider.value}`;\n\n if(playCheck.checked) start();\n}\nrandSlider.onchange = onRandSlider;\n\nconst refreshCanvas = () => {\n canvas.width = (CELL_SIZE + 1) * width + 1;\n canvas.height = (CELL_SIZE + 1) * height + 1;\n drawGrid();\n drawCells();\n}\n\nconst widthBox = document.getElementById(\"width\");\nconst onWidth = () => {\n // PLAY = false;\n width = widthBox.value;\n universe = game_of_life__WEBPACK_IMPORTED_MODULE_0__.Universe.new(width, height, randSlider.value, new Date().getTime() / 1000);\n refreshCanvas();\n // PLAY = true;\n // requestAnimationFrame(renderLoop);\n}\nwidthBox.onchange = onWidth;\n\nconst heightBox = document.getElementById(\"height\");\nconst onHeight = () => {\n // PLAY = false;\n height = heightBox.value;\n universe = game_of_life__WEBPACK_IMPORTED_MODULE_0__.Universe.new(width, height, randSlider.value, new Date().getTime() / 1000);\n refreshCanvas();\n // PLAY = true;\n // requestAnimationFrame(renderLoop);\n}\nheightBox.onchange = onHeight;\n\nconst playCheck = document.getElementById(\"play-check\");\nconst onPlay = () => {\n console.log(\"play: \" + playCheck.checked);\n if(playCheck.checked) {\n start();\n }else {\n stop();\n }\n // PLAY = playCheck.checked;\n // requestAnimationFrame(renderLoop);\n}\nplayCheck.onchange = onPlay;\n\nconst onStep = () => {\n console.log(\"stepping\");\n renderSingle();\n}\ndocument.getElementById(\"step\").onclick = onStep;\n\n\nconst onReset = () => {\n universe = game_of_life__WEBPACK_IMPORTED_MODULE_0__.Universe.new(width, height, randSlider.value, new Date().getTime() / 1000);\n refreshCanvas();\n}\ndocument.getElementById(\"reset\").onclick = onReset;\n\ndrawGrid();\ndrawCells();\n\nconst fps = new class {\n constructor() {\n this.fps = document.getElementById(\"fps\");\n this.frames = [];\n this.lastFrameTimeStamp = performance.now();\n }\n \n render() {\n // Convert the delta time since the last frame render into a measure\n // of frames per second.\n const now = performance.now();\n const delta = now - this.lastFrameTimeStamp;\n this.lastFrameTimeStamp = now;\n const fps = 1 / delta * 1000;\n \n // Save only the latest 100 timings.\n this.frames.push(fps);\n if (this.frames.length > 100) {\n this.frames.shift();\n }\n \n // Find the max, min, and mean of our 100 latest timings.\n let min = Infinity;\n let max = -Infinity;\n let sum = 0;\n for (let i = 0; i < this.frames.length; i++) {\n sum += this.frames[i];\n min = Math.min(this.frames[i], min);\n max = Math.max(this.frames[i], max);\n }\n let mean = sum / this.frames.length;\n \n // Render the statistics.\n this.fps.textContent = `\n Frames per Second:\n latest = ${Math.round(fps)} // \n avg of last 100 = ${Math.round(mean)} // \n min of last 100 = ${Math.round(min)} // \n max of last 100 = ${Math.round(max)}\n `.trim();\n }\n };\n});\n\n//# sourceURL=webpack://game-of-life-web/./index.js?"); + +/***/ }) + +}]); \ No newline at end of file