Quantum version of the classical Nim game. An automatic opponent allows to game to not be as easy as it seems.

Overview

Nim game

Running the game

To run the program just launch : python3 game.py

Rules

This game is inspiring from the Nim game. You are 2 players face to face, you have 11 sticks in front of you :

          \o/
           |
          / \
#######################
 | | | | | | | | | | | 
#######################
          \ /
           |
          /o\

The goal is NOT take the last stick !! Originally, this game can be automatize by classical computer to always loose again a computer or against someone knowing the strategy. But what happens if we implement quantum rules ?

Like the original game each player can take 1 to 3 sticks each turn but this time, they can say if they want to take the stick normally, put it in superposition or creating an entanglement between this stick and the sticks previously on the board (played before) :

Symbols table name means action possible ?
| stick left a simple sticks any action
/ superposition stick sticks in states : |0> + |1> no action (only here for info)
¬ entangle stick the faith of this stick depends of the previous one no action (only here for info)
[ ] blank space the previous stick has been fully taken an cx action can be done with if it's not the first turn of the circuit generation

Here each stick correspond to a qubit at the |0> state.

Example of a game : 11 sticks in board : | | | | | | | | | | |
1st turn :
Robin choose 2 sticks

  • Robin apply an x gate the 11th stick
  • Robin apply an h gate to the 10th stick

9 sticks in board : | | | | | | | | | /
Batman choose 3 sticks

  • Batman apply a cx to the 9th stick (now the 9th stick is automatically link with the 10th)
  • Batman apply a x gate to the 8th stick
  • Batman apply a x gate to the 7th stick

6 sticks in board : | | | | | |

etc ...

2 sticks left : | | ¬
Robin choose 1 sticks

  • Robin apply an x gate to the 2nd stick

1 sticks left : |
Batman choose 1 sticks

  • Batman apply an x gate to the last stick

When it doesn't have a stick anymore we run the circuit we create with the gates and get the result, for each qubit still at the state |0> we had 1 stick left. Then we continue wit the sticks remaning until we don't have stick at all after running the circuit.

Modes

2 players

A 2 players mode is available is you want to play with a friend or with your cat

1 player

A 1 player is available and you'll fight against a quantum ia made with a quadratical equation, QAOA and Grover.

You might also like...
This a Chess PGN saver which allows you to save your game pgns, in a .pgn file
This a Chess PGN saver which allows you to save your game pgns, in a .pgn file

PGN Saver This a Chess PGN saver which allows you to save your game pgns, in a .pgn file This can be a very useful tool for the people using chessbase

Open source Brawl Stars server emulator for version 29 of the game!
Open source Brawl Stars server emulator for version 29 of the game!

Welcome to Classic-Brawl v29 Remake 👋 Open source Brawl Stars server emulator for version 29 of the game! (Remake) What's working ? Battles Trophies

This is a Python solver for the game Wordle, which recently received its PT-BR version

PT_BR_Wordle_Solver Este é um solver feito em Python do jogo Wordle, que recebeu sua versão PT-BR recentemente. Onde jogar Os sites para se jogar mais

An easy to use game engine/framework for python.
An easy to use game engine/framework for python.

A game engine powered by python and panda3d.

Easy and fun game to play a bit. Written in python
Easy and fun game to play a bit. Written in python

NumGuesser Easy and fun game to play a bit. Written in python

Minecraft-Bedrock-Modpack-Maker - Simple tool to combine multiple addons into one. Not finished

Minecraft-Bedrock-Modpack-Maker Simple tool to combine multiple addons into one. Not finished! Any contributing is welcome. How to use: Move all .mcpa

Parkour game made in Python with Ursina Game Engine along with ano0002, Greeny127 and Someone-github Snake game mixed with Conway's Game of Life
Snake game mixed with Conway's Game of Life

SnakeOfLife Snake game mixed with Conway's Game of Life The rules are the same than a normal snake game but you have to avoid cells created by Conway'

Lint game data metafiles against GTA5.xsd for Rockstar's game engine (RAGE)
Lint game data metafiles against GTA5.xsd for Rockstar's game engine (RAGE)

rage-lint Lint RAGE (only GTA5 at the moment) meta/XML files for validity based off of the GTA5.xsd generated from game code. This script accepts a se

Releases(2.1)
Owner
Michaël
Qiskit Advocate & Fan of AI Electrical engineer @ESNFranceG33kTeam
Michaël
A program to read, edit, and write save files for the game Railroads! Online

RROSE - v0.3.6 This program is intended to be used as an external tool to Railroads Online server hosts. It will read save files, allow to modify entr

17 Dec 09, 2022
A Higher-Lower web game made in Python using Flask framework.

Higher Lower Web Game Guess the random number from 0 to 9 in this web game made with Python and Flask Framework Modules that were used Random Flask In

Yago Goltara 1 Oct 27, 2021
Deep Running

Deep Running 1. Install $ pip install --user deep_running 2. Lap N Lap. Name Remarks Citation Meta 1 Mario Deeeeeep Running I was born to run. dannyso

karaage 69 Jan 31, 2022
A Snake Game built by Python Turtle Module 🐍

Snake-Game A Snake Game built with Python Turtle Module 🐍 Icons made by Freepik from www.flaticon.com Intro Control the direction of snake by simply

Megan 1 Oct 24, 2021
NSI project --> 2D platformer in Python with Pygame

Projet de NSI (2021-2022): Jeu sous Python Collaborateurs: Remi K-S et Nathan D Lien de l'environnement IDE de Python en ligne: https://replit.com/@Re

Remi K-S 3 May 24, 2022
Pratice Project - Tic tac toe game

Hello! This tic-tac-toe game project and its notes are result from a course pratice milestone. The project itself is written in Python using the Jupyt

Rafael Nascimento 1 Jan 07, 2022
This a Chess PGN saver which allows you to save your game pgns, in a .pgn file

PGN Saver This a Chess PGN saver which allows you to save your game pgns, in a .pgn file This can be a very useful tool for the people using chessbase

3 Jan 06, 2022
This repository contains the Unix Game challenges and metadata

This repository contains the Unix Game challenges and metadata

Nokia 7 Apr 06, 2022
The Sinclair ZX Spectrum BASIC compiler!

ZX BASIC Copyleft (K) 2008, Jose Rodriguez-Rosa (a.k.a. Boriel) http://www.boriel.com All files in this project are covered under the GPLv3 LICENSE ex

Jose Rodriguez 143 Dec 13, 2022
PyCheckers - A classic board game implemented in pygame

PyCheckers! A classic board game implemented in pygame! Complete with every feature you need to play checkers! (including handsome sprites drawn by a

helaxious 1 Jan 21, 2022
A basic quiz game using Python

QuizGame A basic quiz game using Python Passwords for quizzes (NO CAPS LOCK!): -ryzermattishandsome -canisleepwithyou Before using this, please make s

Austin 1 Nov 12, 2021
Snake Game in Python

Snake game is one of the most popular arcade games of all time. In this game, the main objective of the player is to catch the maximum number of fruits without hitting the wall or itself.

Pavan Ananth Sharma 4 Jul 05, 2022
Wordle-Python - A simple low-key clone of the popular game WORDLE made with python and a 2D Graphics module Pygame

Wordle-Python A simple low-key clone of the popular game WORDLE made with python

Showmick Kar 7 Feb 10, 2022
XO game with server, client and visualizer for AI bots.

XO game with server, client and visualizer for AI bots.

Ali 4 Jul 14, 2022
python script to convert .OBJ files into Minecraft, rendering them in game with a core shader.

samples: random notes about the tool general output format: (animation not supported yet but planned) vertex id Minecraft's gl_VertexID isn't per mode

199 Jan 02, 2023
Software Design | Spring 2020 | Classic Arcade Game

Breakout Software Design Final Project, Spring 2020 Team members: Izumi, Lilo For our Interactive Visualization, we implemented the classic arcade gam

Lilo Heinrich 1 Jul 26, 2022
Editing tool (read/write) .sc files (*_tes.sc , *.sc, *_dl.sc ) from Supercell games (Brawl Stars, Clash Royale, Clash of Clans and others).

SupercellSWF Version 0.1.0.2 About Editing tool (read/write) .sc files (*_tes.sc , *.sc, *_dl.sc ) from Supercell games (Brawl Stars, Clash Royale, Cl

Fred31 11 Jun 23, 2022
Simple game where you try to survive as long as you can on screen.

Survival Game Simple game where you try to survive as long as you can on screen. Play To run, download the code and run the survival_game.py file. Fro

Logan Morris 1 Feb 10, 2022
Rock-Paper-Scissors - Rock Paper Scissors With Python

Rock-Paper-Scissors The familiar game of Rock, Paper, Scissors is played like th

Lateefah Ajadi 0 Jan 15, 2022
Client-Server design (guess the closest number to the average score game)

Multiplayer game (enter the number closest to the average) Design Client-Server design The client's side is responsible for sending numbers from the g

Adam Piszczek 0 Jun 29, 2022