Recreation of HexGame in Pygame. More features will come soon !

Overview

Hex with Pygame

Whats is Hex ?

Historical point of view


Hex as been created in 1942 by a Danish mathematician named Piet Hein. The first commercialization of this game is in 1952. With time, some strategies to win have been seeking. Thus, techniques have been found to consistently win on a 7x7 and 9x9 Board. More recently, in 2019, Facebook succeeds in beating the best player of Hex on a 19x19 board.

What Are the rules of this game ?


First, Hex is a two player game. It's a strategic and abstract board game. Each players have a color, black and white. The cells of the board are made up of hexagons. Hence the name "Hex".The goal for each player is to form a connected path of their stones linking the opposing sides of the board marked by their colors before their opponent similarly connects his or her sides.

Illustration from the Game

In this example, white won because they form a line that is linking the opposite white side. Traditionally, board measure 9x9, 11x11, 13x13 or 17x17.

Some Strategies and tips


Easy and Faster connections

Usually, beginners place their pawns directly next to them to create a connection. But there is a faster way to proceed. If you have 2 pawns that have 2 hexagons in common (1), they can be connected, even if black put a Hexagon in one of them (2) > (3). Example:

Stopping a pawn

Imagine playing black and being in this situation:


How can you stop white ? First play a pawn in front of white's pawn.


Now white is obligate to play at the left if they want to win.


Now that you are in this position you must put white in a situation where they must play near your pion, by playing like that:


Now white as no option:


Last be not the least, play a pawn like the first time


And that's it ! You blocked them.

The program

The algorithm for the Win


How can the algorithm detect if a player has won ?

Step 1:

If there is a pawn on the first line, it would be marked as "solution pawn". If there is no pawn on this line, then, the player can't win

Step 2:

All pawns connected to a solution Pawn becomes Solution pawn. But when a Solution Pawn makes a non-solution pawn to become a solution, then this pawn becomes "past". A past pawn can't be a solution pawn anymore.

Step 3:

If a solution pawn is on the last line, the player won.



This algorithm can be similar to Mathematical induction ("Raisonnement par Récurrence" in French) in Maths

Other fonctionnalities


Color

You can customize the main color of this game. Just by pressing a button

Languages

Many languages are available. (French 🇫🇷 , English 🇺🇸 , Japan 🇯🇵 , Korean 🇰🇷 , Greek 🇬🇷 and Sweden 🇸🇪 )

Sound/Music

There is an default music made by the author. The volume of the music can be modified from 0.0% to 100.0%

Lenght of the Board

The Lenght of the board can go from 5x5 to 50x50


How to install Python and Pygame ?

Install Python

If Python is not installed on your computer (to verify that, you can do: "python --version" on a Terminal. If you don't know how to access a Terminal you can click here : How to access a Terminal) you can click on this link Installing Python, than click on "Download Python 3.X.X". After that, you can execute this File. A window should appear. At the bottom of the screen, there is a small box where it's written: "Add Python3.X to path". Check this box. After that, click on "Customize Installation". Check all the boxes if they aren't checked and click on "Next". Then, click on "Install". After that, you can close the window

Install Pygame

If you want to check if Python is installed you can open a Terminal and write python --version. Installing Pygame is not difficult. Now you need to open a Terminal if there is none open. And just type py -m pip install pygame. It will take some time for being installed.

Install Hex Game

To install Hex Game you need to download this project as a .zip, then you have to decompress it. After the installation and the decompression, you have to execute it by doing py main.py
⚠️ Make sure that you are in the good Folder when you do that. For example, if the file is on your Desktop you should do cd Desktop. You don't understand what I just said? Path of a file in Windows / Mac. How to use CD: Here (It's the same with Mac) ⚠️

Owner
Main: Python3 Also: HTML/CSS/JS and C#
Discord based board game, Sneks and Ladders

sneks-and-ladders Discord based board game, Sneks and Ladders intro This is the code-base for the Discord based game, Sneks and Ladders, as used for s

Yohei Nakajima 3 Nov 04, 2022
Python module providing simple game networking

nethelper Python module providing simple game networking This module was originally created to facilitate a class on creating multiplayer games in Pyg

Cort 3 Jan 11, 2022
Lutris helps you install and play video games from all eras and from most gaming systems.

Lutris Lutris helps you install and play video games from all eras and from most gaming systems. By leveraging and combining existing emulators, engin

Pop!_OS 2 Nov 15, 2021
SelectionSortVisualization - This pygame project is helping you to understand the selection sorting algorithm

SelectionSortVisualization (If you have any comments or suggestion, please conta

Berkay IPEK 3 Feb 17, 2022
What games should I design next quarter?

Project1_Next-Quarter-Game-Design-Prediction What games should I design next quarter? 상황 : 게임회사 데이터팀 합류 문제 : '다음 분기에 어떤 게임을 설계해야할까' Data Description N

Jayden Lee(JaeHo Lee) 1 Jul 04, 2022
PyCraft - A Minecraft launcher made in python

A Minecraft launcher made in python. The main objective of this launcher is to enable players to enjoy minecraft (especially those without a mojang/microsoft account). This launcher is not illegal as

38 Dec 12, 2022
A Minecraft clone written in python and pyglet.

PyCraft A Minecraft clone written in python and pyglet. Running PyCraft To run PyCraft, run the following code: git clone https://github.com/TheWebCra

The WebCrafters 17 Dec 29, 2022
A Simple Scissor Paper Rock Game On Python Using Pygame.

Scissor Paper Stone Game Using Pygame This is a simple GUI based game made on pygame python. Installation Run code on your machine: git clone https:

Dipin Adhikari 0 Mar 21, 2022
This is a script which can be used to autobattle, upgrade metamon, compose eggs and open eggs in metamon game.

This is a script which can be used to autobattle, upgrade metamon, compose eggs and open eggs in metamon game. The only parameters you need to input are you wallet address and sign. The sign can be o

Taxiria 37 May 11, 2022
A classic alien shooting game.

Space-Invaders A classic alien shooting game. Description An open source game created by me and friends. How to play Install the latest python version

Phạm Thanh Sơn 1 Feb 08, 2022
A python snake game based on pygame.

PySnake A python snake game based on pygame. Requirements Package version pygame = 2.1.2 opencv-python = 4.5.1.48 Run Windows python main.py Linux &

2 Jan 31, 2022
This is a repository created to run a workshop on Game Theory using the programming language Python and more specifically an open-source software called the Axelrod Python library

Game-Theory-and-Python This is a repository created to run a workshop on Game Theory using the programming language Python and more specifically an op

Nikoleta Glynatsi 136 Dec 01, 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
AWBW Replay Parser - a Python package to open and step through AWBW game replays.

AWBW Replay Parser This repository is home to the AWBW Replay Parser, a Python package to open and step through AWBW game replays. This project is una

Tarkan Al-Kazily 2 Feb 09, 2022
Snake (PyGame-based) port for Minecraft:Bedrock Edition using PEWSAPI

Snake_PEWSAPI Snake (PyGame-based) port for Minecraft:Bedrock Edition using PEWSAPI And we are not going to make any change to the original Snake sour

Azuki 1 Mar 17, 2022
Multi minecraft server helper for python

呐 Yuki 您的群组服操作小助手。 使用Python3编写。使用 .yaml 配置文件记录子服,配合Screen管理Linux系统上的Minecraft子服,支持MCDR子服与非MCDR子服。 功能: 开启所有子服 关闭所有子服 重载所有子服MCDR 重载所有子服ChatBridge 使用方法:

3 Mar 17, 2022
Flappy Bird hack using Deep Reinforcement Learning (Deep Q-learning).

Using Deep Q-Network to Learn How To Play Flappy Bird 7 mins version: DQN for flappy bird Overview This project follows the description of the Deep Q

Yen-Chen Lin 6.4k Dec 30, 2022
Simple car game written in PyGame

Welcome to CarGame 👋 Car Game written in PyGame! NOTE: This is still new and there may be stuff broken... 🏠 Homepage Install install pygame by typin

John 1 Oct 29, 2021
For the Exapunk minigame, ПАСЬЯНС

Exapunks Automation This repository solves Exapunk's Solitaire minigame, ПАСЬЯНС. This repository is useable, but only with specific display condition

Will C 5 Jul 29, 2022
Simplerpg - python terminal game made from scratch.

Simplerpg - python terminal game made from scratch.

reversee 3 Sep 17, 2022