Skip to content

skranz/gtreeWebPlay

Repository files navigation

gtreeWebExp: Create web apps to play gtree games in the web

Author: Sebastian Kranz, Ulm University

This packages is an companion package to gtree. gtree allows to specify and solve game theoretic games in a way akin to the specification of economic experiments via stages in ztree. gtreeWebExp allows to create simple shiny web apps from such games in which a single player can play against bots. A bot could e.g. follow an equilibrium strategy (see bot_eq) or allow the current player to play against randomly drawn strategies of earlier users of the app (see bot_pop). The appearance of the shown stages can be customized by adapting RMarkdown files that are initially automatically generated.

As Github does not show embedded iframes in the README.md. Take a look at skranz.github.io/gtreeWebPlay for embedded examples. Or directly browse to gtree.econ.mathematik.uni-ulm.de/KuhnPoker

Installation

To install the package will all dependencies simply run

install.packages("gtreeWebPlay",repos = c("https://skranz-repo.github.io/drat/",getOption("repos")))

(I have my own drat powered R repositorium for my own packages. While CRAN ist great, I find it too time consuming to maintain all my packages there and devtools::install_github does not handle custom dependencies as easily.)

Deploy an Example App

The best way to get started is to look at an example and modify it for your own purposes. The following code copies all files for a simple Ultimatum Game app to the directory specified in dest.dir.

deploy_webplay_example(example="UltimatumGame",dest.dir = "D:/gtreeExamples/UltimatumGame")

You can open the global.R file in the destination directory and then press in RStudio Run App to run the example. You can adapt the example to create an app for your own game. A more complex example using a population bot can be deployed with the argument example="KuhnPoker".