How mathematicians use Minecraft to calculate pi

The iconic game Minecraft, known for its blocky landscapes and limitless creativity, has found an unexpected intersection with mathematics. While the game’s cubic world may seem ill-suited for calculating pi (π)—the mathematical constant representing the ratio of a circle’s circumference to its diameter—mathematicians Molly Lynch from Hollins University and Michael Weselcouch from Roanoke College have ingeniously bridged this gap. Their innovative approach allows players to approximate the value of pi, 3.14159…, within the confines of Minecraft.

For those unfamiliar with Minecraft, it is a sandbox game that empowers players to explore a pixelated universe and construct various structures using cube-shaped building blocks. Players gather resources and transform them into new materials, enabling a wide range of creative possibilities. This flexibility has led to the realization that Minecraft is Turing complete, meaning it can simulate any computer program, including algorithms for calculating mathematical constants.


On supporting science journalism

If you’re enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription, you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


Recognizing the potential of Minecraft as a medium for engaging young minds in mathematics, Lynch and Weselcouch set out to develop a method for calculating pi that could be easily implemented in the game. They chose the well-known darts technique, a probabilistic method that approximates pi through random sampling.

Throwing Darts at a Board

Imagine a scenario where you are throwing darts at a circular board mounted on a square wall. The randomness of your throws means that each dart has an equal chance of landing anywhere within the square area, including the circular dartboard. By throwing a sufficient number of darts, you can estimate the value of pi.

To illustrate, consider a square with a side length of two meters, giving it an area of four square meters. The circle inscribed within this square has a diameter of two meters, resulting in an area of π square meters. The probability of a dart landing within the circle is π/4. By counting the darts that land inside the circle and dividing by the total number of darts thrown, one can derive an approximation of π by multiplying the result by four.

Lynch and Weselcouch implemented this darts technique in Minecraft in 2024 by constructing a circular structure using red blocks with a radius of 11 blocks, surrounded by blue blocks to form a square. They then introduced random events in the game that mimicked the dart throws. This was achieved using a Minecraft creature known as a slime, which moves randomly when players are absent. To enhance the randomness, they paired slimes with zoglins, creatures that eliminate slimes.

By utilizing funnel-shaped blocks called hoppers to collect items dropped by slain slimes, the researchers created a system to track the outcomes of their random events. Each time a slime was killed, it dropped items that were collected by the hoppers. By calculating the ratio of slimes killed within the circle to the total number of slimes killed, they could approximate π/4.

During their test, a total of 619 slimes were killed, with 508 of them meeting their end within the circular area. This data yielded an approximate value for pi: π ≈ 4 × (508 / 619) = 3.283. While this approximation may not be particularly precise, the researchers acknowledged two methods to enhance accuracy: increasing the size of the square and the number of slimes involved. A larger circle better approximates a true circle, and the Monte Carlo method becomes more accurate with more random events.

Although the method devised by Lynch and Weselcouch may not be the most efficient way to calculate pi, their primary objective is to inspire interest in mathematics among young people. A whimsical battle between slimes and zoglins in Minecraft may well capture the imagination far more effectively than a traditional algorithm.

This article originally appeared in Spektrum der Wissenschaft and was reproduced with permission. It was translated from the original German version with the assistance of artificial intelligence and reviewed by our editors.

AppWizard
How mathematicians use Minecraft to calculate pi