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#
Code infrastructure and player algorithms for the Codenames board game.

Codenames Code infrastructure and player algorithms for the Codenames board game. This is the active fork of mkali-personal/codenames. Intro This is b

Asaf Kali 1 May 18, 2022
Pygame Raycaster made by me.

Pygame Raycaster made by me.

Sable 0 Jan 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
This is the card game like HearthStone and Magic

Territory War How to use it use pip3 to install django and channels: pip3 install Django pip3 install channels go to CardGame/first/consumers.py and g

Caesar 3 Oct 24, 2022
linorobot2 is a ROS2 port of the linorobot package

linorobot2 is a ROS2 port of the linorobot package. If you're planning to build your own custom ROS2 robot (2WD, 4WD, Mecanum Drive) using accessible parts, then this package is for you. This reposit

linorobot 195 Dec 29, 2022
Game-of-life - A simple python program to simulate and visualise the Conway's Game of life

Conway's game of life A simple python program to simulate and visualise the Conw

Dhravya Shah 3 Feb 20, 2022
Tool for Path of Exile game to automatically scan Archemesis inventory and display related information

poe-archnemesis-scanner Tool for Path of Exile game to automatically scan Archemesis inventory and display related information Features Controls When

70 Nov 10, 2022
A rhythm-based game that automatically generates obstacles based on a song's features.

DISCLAIMER: This is my first coding project, created in December 2019. The game may not be optimized, and looking back on it, there are a lot of chang

Kenneth Huang 1 Dec 27, 2021
A simple script which allows you to see how much GEXP you earned for playing in the last Minecraft Hypixel server session

Project Landscape A simple script which allows you to see how much GEXP you earned for playing in the Minecraft Server Hypixel Usage Install python 3.

Vincenzo Deluca 4 Dec 18, 2021
user friendly python script who is able to catch fish in the game New World

new-world-fishing-bot release 1.1.1 click img for demonstration Download guide Click at latest release: Download and extract bot.zip: When you run fil

297 Jan 08, 2023
Pong is one of the first computer games that ever created, this simple

Pong-Game Pong is one of the first computer games that ever created, this simple "tennis like" game features two paddles and a ball, the goal is to de

Lateefah Ajadi 0 Jan 15, 2022
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
The Turtle Race Game built in Python with Turtle module.

Turtle Race Game The Turtle Race Game built in Python with Turtle module. Installation If you don't have Turtle module on your computer. You can downl

Aytaç Kaşoğlu 1 Nov 09, 2021
Chesston (Chess+Python) is a two-player chess game with graphical user interface written in PyQt5

♟️ Chesston (Chess+Python) is a two-player chess game with graphical user interface written in PyQt5. 💿 Dependencies This program uses Py

6 May 26, 2022
A fun, casual and strategic game made using Python!

Steve's Pixels A fun, casual and strategic game made using Python! Prerequisites See requirements.txt Demo video demo.mp4 Usage python -m steves_pixel

Jaivardhan Bhola 9 Sep 17, 2022
Wordlebot - A simple Wordle puzzle solver in python

WordleBot A simple search-based puzzle solver for Wordle, built in Python. Inspi

Rob Kimball 2 Jan 27, 2022
Generates and prints proxies for the card game Magic: the Gathering

MTG-Proxy-Generator This program generates proxies for the card game Magic: the Gathering. These proxies can then be printed off and used. These copie

Carl L. 1 Jan 31, 2022
Tic Tac Toe Game build with Python

Tic Tac Toe Game Description two players who take turns marking the spaces in a three-by-three grid with X or O. The player who succeeds in placing th

Kemal Kochekov 2 Jan 21, 2022
Basic Python physics library.

pythonPhysics Basic Python physics library. Must have pygame installed. How to: Sketon program is included. for p in env.particles: pygame.draw.circle

1 Jan 16, 2022
Track your favorite minecraft servers' (too bee too tee) queue at any time at your own convenience!

2b2t Queue Monitor Track your favorite minecraft servers' (too bee too tee) queue at any time at your own convenience! Compiled Usage go to https://gi

Addi 1 Feb 05, 2022