The beer production-distribution game, in short "The Beer Game", is a multiplayer board game, where each individual player acts as an independent agent. The game is widely used in management education aiming to give an experience to the participants about the potential dynamic problems that can be encountered in supply chain management, such as oscillations and amplification of oscillations as one moves from downstream towards upstream echelons. The game is also used in numerous scientific studies. In this paper, we construct a mathematical model that is an exact one-to-one replica of the original board version of The Beer Game. We apply model replication principles and discuss the difficulties we faced in the process of constructing the mathematical model. Accordingly, the model is presented in full precision including necessary assumptions, explanations, and units for all parameters and variables. In addition, the adjustable parameters are stated, the equations governing the artificial agents' decision making processes are mentioned, and an R code of the model is provided. We also shortly discuss how the R code can be used in experimentation and how it can also be used to create a single-player or multiplayer beer game on a computer. Our code can produce the exact same benchmark cost values reported by Sterman (1989) verifying that it is correctly implemented. The mathematical model and the R code presented in this paper aims to facilitate potential future studies based on The Beer Game.