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
It calculates the Nim sum of a nim game.

nim-sum It calculates the Nim sum of a nim game. The rules of Nim The traditional game of Nim is played with a number of coins arranged in heaps: the

null 2 Jan 2, 2022
It calculates the Nim sum of a nim game

nim-sum It calculates the Nim sum of a nim game. The rules of Nim The traditional game of Nim is played with a number of coins arranged in heaps: the

null 4 Dec 9, 2021
Quantum version of the game Tic Tac Toe.

QTicTacToe Quantum version of the game Tic Tac Toe. This game was inspired by the game at this site. Installation The game requires the qiskit python

null 1 Jan 5, 2022
A quantum version of Ladders and Snakes

QPath-and-Snakes A quantum version of Ladders and Snakes Desarrollo Para continuar el desarrollo sin pensar en instalación de dependencias: Descargue

null 2 Oct 22, 2021
Several implementations of classical games (ex: FlappyBird, Minesweeper etc.) using Python (pygame)

Mini Games with Pygame This projects implement several classic and popular games in Python, using python package -- pygame. Currently, 4 games are alr

null 1 Feb 14, 2022
Allows you to email people wordle spoilers. Very beta, not as many features

wordlespoiler Allows you to email people wordle spoilers. Very beta, not as many features How to Use 1.) Make a new gmail account. Go to settings (Man

null 0 Jan 4, 2023
MCRPC (Minecraft Resource Pack Comparator) checks your resource pack against any version of Minecraft to show resources missing from your pack for that version.

Minecraft Resource Pack Comparator MCRPC checks your resource pack against any version of Minecraft to show resources missing from your pack for that

null 3 Nov 3, 2022
AutoPilot is a game where the player controls a car and tries to get the highest score he can while not dying under falling cement blocks.

AutoPilot AutoPilot is a game where the player controls a car and tries to get the highest score he can while not dying under falling cement blocks. C

Enoc Mena 1 Nov 17, 2021
Automatic game data translator for RPGMaker-MV

RPGMaker-MV Translator ??️ ?? Use AI to translate all the dialogs and texts of your RPGMaker automatically. ?? You worked hard to make your game, now

Davide Liu 11 Dec 26, 2022
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022