Terminal interface based, online multiplayer, Russian Roulette where the loser executes the winner's Python payload file.
![]() |
![]() |
![]() |
![]() |
Code Roulette is a Terminal User Interface (TUI) based, online multiplayer, Russian Roulette game where the loser is forced to execute a Python payload of the winner's choice. Chat included.
The game's interface is entirely terminal-based using Textual and supports both keyboard and mouse interactions. So, it can be played anywhere Python packages can be installed and a terminal opened.
By executing another player's Python payload on your computer if you lose, the essence of the original game of Russian Roulette can be adequately simulated in the digital space.
The game begins by all users connecting to a local or remote server, and selecting their usernames and payload files. Once enough players are in the lobby, the first to connect (the lobby "Owner") can start the game.
All players will be paired, server-side, to another player. Then each player will be shown their opponent's Python payload file and given a chance to back out.
Once all remaining players ready up, the game begins. Each player will take turns pulling the trigger on the ASCII revolver. The chambers are hidden, so any one could be the one that sends you to the loser's screen.
For those who didn't pull the trigger for the last time, a winner's screen is shown detailing whose code is now being executed, a preview of the code itself, and the name of the player who lost.
For the loser, the payload file they agreed to gamble with is now being executed on their system.
Caution
This program can execute arbitrary code supplied by another player on your computer if you lose the game.
Please review and ensure you understand the risks of remote code execution, how the game works, and read the disclaimer before using this software!
Note
Code Roulette is not yet available as a PyPi package or a native executable. However, I do plan to implement this when the program is ready for wider distribution.
This repo can be run locally and easily using the UV package manager.
- Ensure you have UV installed.
- View the command line help by running:
uv run main.py --help- To start the server, run:
uv run main.py server - To start the client interface, run:
uv run main.py client
- To start the server, run:
For convenience, a requirements.txt is also included for pip users.
With Code Roulette you can use any default library Python 3 features in your payload files. Since the system is open, you could devise a way to import further packages. However, that support will not be implemented natively to the game.
For a selection of example payload files, check out the payloads/ directory.
A JSON format index of the payload files is also accessible from this repository for developers. The future roadmap includes integrating selection of files from this database.
Make sure textual-dev is also added as a dependency.
The Client can be opened in Textual's developer mode by running: textual run --dev -c uv run main.py --log-level debug client
This repo, with the exception of the content of the payloads/ directory, is offered under the GNU General Public License v3.0.
Under nearly all circumstances, I strongly advise against the use of this license. However, for the nature of this project being a complete end product (a game), I feel it is appropriate in this context. If you have a compelling reason to open it up, let me know and maybe we can approach licensing for use.
The content of the payloads/ directory only is offered under the MIT License.
Caution
This program can execute arbitrary code supplied by another player on your computer if you lose the game.
Please review and ensure you understand the risks of remote code execution, how the game works, and read the disclaimer before using this software!
This software is provided "as is", without warranty of any kind, expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
You are solely responsible for any consequences that may arise from using this software, including but not limited to data loss, system damage, or legal issues resulting from executing code provided by other players. Always review and understand the code you are agreeing to execute before participating in the game.
Russian Roulette is a life-threateningly dangerous game in real life. This software is intended for entertainment purposes only and should not be taken as an endorsement of such activities. If you or someone you know is struggling with issues related to gambling or life threatening behaviors, please seek professional help. There's always someone willing to listen and help.
If you choose to use this software, you do so at your own risk.





