A two-player strategy game played on a rectangular grid made up of smaller square cells of chocolate 🍫 or cookies 🍪

Overview

Chomp Game ©️

Chomp is a two-player strategy game played on a rectangular grid made up of smaller square cells of chocolate 🍫 or cookies 🍪 , which can be thought of as the blocks of a chocolate bar. The players take it in turns to choose one block and "eat it" (remove from the board), together with those that are below it and to its right. The top left block is "poisoned" and the player who eats this loses.

The chocolate-bar formulation of Chomp is due to David Gale, but an equivalent game expressed in terms of choosing divisors of a fixed integer was published earlier by Frederik Schuh.

Chomp is a special case of a poset game where the partially ordered set on which the game is played is a product of total orders with the minimal element (poisonous block) removed.

Text Guide

  1. Example Game 🎮

    Below shows the sequence of moves in a typical game starting with a 5 × 4 bar:

    Chomp Game

    Player A eats two blocks from the bottom right corner; Player B eats three from the bottom row; Player A picks the block to the right of the poisoned block and eats eleven blocks; Player B eats three blocks from the remaining column, leaving only the poisoned block. Player A must eat the last block and so loses.

    Note that since it is provable that player A can win when starting from a 5 × 4 bar, at least one of A's moves is a mistake.

  2. Positions of the Game ♟️

    The intermediate positions in an m × n Chomp are integer-partitions (non-increasing sequences of positive integers) λ1 ≥ λ2 ≥···≥ λr, with λ1 ≤ n and r ≤ n. Their number is the binomial coefficient equation, which grows exponentially with m and n.

  3. How to Win the Game 🏆

    Chomp belongs to the category of impartial two-player perfect information games.

    For any rectangular starting position, other than 1×1, the first player can win. This can be shown using a strategy-stealing argument: assume that the second player has a winning strategy against any initial first-player move. Suppose then, that the first player takes only the bottom right hand square. By our assumption, the second player has a response to this which will force victory. But if such a winning response exists, the first player could have played it as their first move and thus forced victory. The second player therefore cannot have a winning strategy.

    Computers can easily calculate winning moves for this game on two-dimensional boards of reasonable size. However, as the number of positions grows exponentially, this is infeasible for larger boards.

    For a square starting position (i.e., n × n for any n ≥ 2), the winning strategy can easily be given explicitly. The first player should present the second with an L shape of one row and one column only, of the same length, connected at the poisonous square. Then, whatever the second player does on one arm of the L, the first player replies with the same move on the second arm, always presenting the second player again with a symmetric L shape. Finally, this L will degenerate into the single poisonous square, and the second player would lose.

  4. Generalization of Chomp 🌏

    Three-dimensional Chomp has an initial chocolate bar of a cuboid of blocks indexed as (i,j,k). A move is to take a block together with any block all of whose indices are greater or equal to the corresponding index of the chosen block. In the same way Chomp can be generalised to any number of dimensions.

    Chomp is sometimes described numerically. An initial natural number is given, and players alternate choosing positive divisors of the initial number, but may not choose 1 or a multiple of a previously chosen divisor. This game models n-dimensional Chomp, where the initial natural number has n prime factors and the dimensions of the Chomp board are given by the exponents of the primes in its prime factorization. Ordinal Chomp is played on an infinite board with some of its dimensions ordinal numbers: for example a 2 × (ω + 4) bar. A move is to pick any block and remove all blocks with both indices greater than or equal the corresponding indices of the chosen block. The case of ω × ω × ω Chomp is a notable open problem; a $100 reward has been offered[2] for finding a winning first move.

    More generally, Chomp can be played on any partially ordered set with a least element. A move is to remove any element along with all larger elements. A player loses by taking the least element.

    All varieties of Chomp can also be played without resorting to poison by using the misère play convention: The player who eats the final chocolate block is not poisoned, but simply loses by virtue of being the last player. This is identical to the ordinary rule when playing Chomp on its own, but differs when playing the disjunctive sum of Chomp games, where only the last final chocolate block loses.

Installation 🛠️

You can install the Chomp Game from PyPI:

python -m pip install chomp

The Chomp Game is supported on Python 3.7 and above. Older versions of Python, including Python 2.7, are supported by version 1.0.0 of the Chomp Game.

Credits 📑

Owner
Farivar Tabatabaei
Founder and CEO of NewHorizon LLC Founder and CTO of Infinite Tech LLC Founder of Space Origin LLC
Farivar Tabatabaei
Repository for the DecodED2 Game Project!

DecodED2 Game Project Hello everyone! Welcome to the GitHub Repository for DecodED2, as a start you'll need to clone this repository and make sure you

6 Sep 29, 2021
A playable version of Chess – classic two-player, various AI levels, and the crazyhouse variant! Written in Python 3

A playable version of Chess – classic two-player, various AI levels, and the crazyhouse variant! Written in Python 3. Requires the installation of PIL/Pillow and Requests

1 Dec 24, 2021
An open source Python library for the Snake retro game.

An open source Python library for the Snake retro game.

3 Jul 13, 2021
TwoDMaker (2DMaker) - Simple engine for 2D games making!

TwoDMaker (2DMaker) - Simple engine for 2D games making! Create simple games (or ui) in one hour! About. This is a simple engine for game or gui app c

Ivan Perzhinsky. 1 Jan 03, 2022
A car learns to drive in a small 2D environment using the NEAT-Algorithm with Pygame

Self-driving-car-with-Pygame A car learns to drive in a small 2D environment using the NEAT-Algorithm with Pygame Description A car has 5 sensors ("ey

Henri 3 Feb 01, 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
Python game engine for 2D multiplayer online games.

LAN-Caster The goal of LAN-Caster is to provide an easy-to-use code base (game engine) for developing 2D multiplayer online games. LAN-Caster original

Douglas Bakewell 1 Feb 11, 2022
An implementation of John Conway's Game of Life.

This is an implementation of John Conway's Game of Life in Python, and a very basic and straightforward one at that.

Mae 3 Feb 11, 2022
Ladder network is a deep learning algorithm that combines supervised and unsupervised learning

This repository contains source code for the experiments in a paper titled Semi-Supervised Learning with Ladder Networks by A Rasmus, H Valpola, M Hon

Curious AI 505 Nov 15, 2022
Crazy fast kahoot game flooder with a GUI and multi OS support.

kahoot flooder Crazy fast kahoot game flooder with a GUI and multi OS support. Made in python using tkinter and KahootPY with toast notifications. Req

Ben Tettmar 1 Apr 09, 2022
PYGA: Python Google Analytics (ga.js) - Data Collection API

PYGA: Python Google Analytics - Data Collection API pyga is an implementation of Google Analytics (ga.js) in Python; so that it can be used at server

Arun Karunagath 136 Sep 19, 2022
A short non 100% Accurate Solar System in pygame

solar-system-pygame Controls UP/DOWN for Emulation Speed Control ESC for Pause/Unpause q to Quit c or ESC again to Continue LEFT CLICK to Add an orbit

LightCrimson 2 May 28, 2022
This is an amazing game make using pygame.

This is an awesome balloon game. It is made in python using Pygame library. It is a project game while learning game development.

Rishikesh Kumar 2 Oct 10, 2021
Game of life, with python code.

Game of Life The Game of Life, also known simply as Life, is a cellular automaton. It is a zero-player game, meaning that its evolution is determined

Mohammad Dori 3 Jul 15, 2022
Rock Paper Scissors Game with PyQt5

Rock-Paper-Scissors-Game rock paper scissors is a old game that all of us played it but this time let's play with computer Description This is Rock Pa

MohammadAli.HBA 4 Nov 11, 2021
Racers-API - a game where you have to go around racing with your car, earning money

Racers-API About Racers API is a game where you have to go around racing with yo

3 Jan 09, 2022
Tic-Tac-Toe Game in python3 Tkinter

Tic Tac Toe Tic-Tac-Toe Game in python3 Tkinter About: Tic Tac Toe or Noughts and Crosses as called in British is a pencil and paper game for two play

Sai Swarup Yakkala 5 Nov 06, 2022
A chess engine with basic AI capabilities (search for best move using MinMax algorithm)

A chess engine with basic AI capabilities (search for best move using MinMax algorithm)

Ken Wu 1 Feb 02, 2022
🐥Flappy Birds🐤 Video game. With your help I can go through🚀 the pipes. All UI is made with 🐍Pygame🐍

🐠 Flappy Fish 🐢 I am Flappy Fish 🐟 . With your help I can jump through the pipes and experience an interesting and exciting flight deep into the fi

MohammadReza 2 Jan 14, 2022
Wordle player - A Class that plays wordle optimally

wordle_player A Class that plays wordle optimally if you want to play wordle opt

Andrés Hernández 1 Jan 31, 2022