--- title: "Standalone WebGL Applet" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Standalone WebGL Applet} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup} library(mergeGridR) ``` ## Play The Applet This standalone applet runs the puzzle entirely in the browser. It uses WebGL for the board, JavaScript for the rules, and browser-local storage for high scores. No Shiny session, R process, or Rcpp runtime is needed after the page loads. When viewing the source on GitHub, open the direct pkgdown app link: [open the standalone app](https://fbertran.github.io/mergeGridR/static/mergeGridR.html). If the embedded applet does not load, open [the standalone app](https://fbertran.github.io/mergeGridR/static/mergeGridR.html). ## Shiny Or Static HTML Use `run_drop_number()` when you want the package-backed Shiny interface and the Rcpp engine available from an R session. This is the best route for development, testing, reproducible simulations, and autoplay benchmarking. Use the standalone applet when you want a single browser page for play or local sharing. The puzzle rules match the package engine, but all computation happens in the browser. The static app includes preview-horizon, spawn-distribution, and continue controls, and high scores are saved in browser `localStorage`, separated by preview horizon. ## Export A Local Copy To write the self-contained HTML file from an installed package: ```{r export-static, eval = FALSE} out <- file.path(tempdir(), "mergeGridR-static.html") export_static_app(out, overwrite = TRUE) ``` The exported file can be opened directly in a modern desktop or mobile browser with WebGL support.