Building a 3D Rock Paper Scissors Battle Simulation in Python

Rhett Allain
10 min readMay 25, 2023
Photo: Rhett Allain. Rock, Paper, Scissors

It’s a classic game of rock-paper-scissors that everyone loves (I assume). But what about a giant R-P-S battle between a bunch of automated bots? That’s exactly what we see here in this very entertaining simulation.

Basically you have some 2D space with a bunch of random rocks, papers, and scissors. If the rock catches a scissor, the scissor turns into a rock. If the paper catches the rock, that rock turns into paper. I think you get the idea, right? Anyway, it’s fairly entertaining to watch.

But do you know what’s more fun than watching? Building. Yes, I want to make my own version of this game in python (technically, I’m going to use Web VPython). Oh, and I’m going to let the bots move in 3D not just 2D.

Interaction Physics

I don’t really know how to make bots that chase stuff — but I do know how to use physics. So, here’s my plan. I’m going to have a bunch of objects and then calculate the forces on each object. The force on a rock will be such that it is attracted to scissors but…

--

--

Rhett Allain
Rhett Allain

Written by Rhett Allain

Physics faculty, science blogger of all things geek. Technical Consultant for CBS MacGyver and MythBusters. WIRED blogger.

Responses (2)